5

Hana Table Migration using Export & Import

 1 year ago
source link: https://blogs.sap.com/2022/09/24/hana-table-migration-using-export-import/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
September 24, 2022 3 minute read

Hana Table Migration using Export & Import

Requirement –

One of most common requirement in Hana is to move user defined table from one Hana environment to another (Ex: Dev > QA > Prod). Here is one of the method i.e. Export & Import we can use.

Solution –

Will migrate the Hana Table from Source Hana Environment to Target Hana Environment.

Step 1 Export Table First we have to export the table from source system.

Connect to source Hana system and create sample table and load data using below script or any other script.

CREATE COLUMN TABLE XX.IMPORT_EXPORT (ID INTEGER, NAME NVARCHAR (100), AMOUNT DECIMAL (38, 18));

DO BEGIN
DECLARE v_NEW_ID INTEGER;
DECLARE v_COUNTER INTEGER;
DECLARE v_NAME NVARCHAR (100);
v_COUNTER = 1;
WHILE v_COUNTER <= 100000
DO
	INSERT INTO XX.IMPORT_EXPORT VALUES (:v_COUNTER, 'A', 100);
	v_COUNTER = :v_COUNTER + 1;
END WHILE;
END;

Click on File menu in Hana Studio -> Select Export Option.

File_Menu-1.png

Export screen will appear. Type Catalog in the search box and Catalog Object will come on the screen. Select this option and hit Next

Export.png

Select Source Hana Database on next screen and click next.

System.png

Now, select which table needs to be exported.

Select_Table.png

On next screen we will see additional configuration for the Export.

    1. Column Table Format – We can choose the Export format as Binary or CSV.
    2. Including Data – Checking this checkbox will Export table with data.
    3. Including Dependencies – Checking this checkbox will Export table with it’s dependent objects like Triggers.
    4. Export Location – We can save the exported table to Server or to Local System.
    5. Export Options – We can define the Number for Parallel Threads can be used during export.
Export_Options.png

After clicking finish, table we get exported to provided location and create folders like below.

Export of table completed now.

Folder.png

Step 2 Import Table As table is exported now we can import the table into target Hana environment using below steps.

Connect to Target Hana system. Click on File menu in Hana Studio -> Select Import Option.

File_Import.png

Import screen will appear. Type Catalog in the search box and Catalog Object will come on the screen. Select this option and hit Next

Import_Screen.png

Select Target Hana Database on next screen and click next.

Note – Here, I have used same System as Target and Source for testing purpose. Before Importing, I have dropped the table from database.

System-1.png

On next screen we have to choose location at which we exported the table in Step 1.

Import_Location.png

Next screen will show the exported table name.

Import-Catalog.png

On next screen we will see additional configuration for the Import.

  1. Including Data – Checking this checkbox will Import table with data.
  2. Including Dependencies – Checking this checkbox will Import table with it’s dependent objects like Triggers.
  3. Import Options – We can define the Number for Parallel Threads can be used during Import.
  4. Replace Existing Catalog Objects – This option will overwrite the existing objects during import.
Import_Option-2.png

After clicking finish table will get imported in the target system.

Hope this helpful.

Thanks & Happy Learning!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK