How to Export and Import the SAP HANA Schema
- The following documentation is for Produmex WMS version 19.2 and later. If you use a previous version, please upgrade at least to 19.2. Only with version 19.2 you can upgrade further. To learn about how to upgrade to version 19.2, click here.
- From Produmex WMS 19.2 there is no separate PMX schema.
- The next steps have been tested on HANA 1.00.112.03 and 1.00.122.05.
1. Export and import commands
HANA's EXPORT command exports the objects defined in the command and all other row-stored tables, views, functions, stored procedures or synonyms for these objects which are referenced in the defined objects.
The following sections describe the export and import steps and in the examples the SBO company schema is called SBODEMOUS. For a more detailed description you can consult with the export and import process described by SAP.
1.1. Export
SAP reference for EXPORT command
1. Export the SBODEMOUS schema:
EXPORT "SBODEMOUS"."*" AS BINARY INTO '/usr/sap/HDB/HDB00/work/backups/SBODEMOUS' WITH REPLACE THREADS 8
The number of THREADS should not be more than the actual number of cpu cores in the server. It is recommended to leave at least 2 cores for other tasks so if you have 10 cores, you should use THREADS 8.
If you do the export and import during working hours and your server is quite busy, it is recommended to consider using less THREADS. This way the export and import will take more time, but there will be less chance of timeout and deadlock problems because of this.
The path in the commands depends on the configuration of the actual server. The target folders should exist and be empty.
The path works with the group 'sapsys', owner 'hdbadm' and default rights 755.
If any of these are different, it can cause errors during the export and import.
If the export is successful, the path will contain an 'export' and an 'index' folder.
Under the 'export' and 'index' folders there will be the folder(s) of the schema(s).
The 'export' folder in the '/usr/sap/HDB/HDB00/work/backups/SBODEMOUS' folder should contain the SBODEMOUS folder.
2. Compress the folders if you need to move or backup them:
cd /usr/sap/HDB/HDB00/work/backups/SBODEMOUS tar -cvzf sbodemous.tar.gz SBODEMOUS
1.2. Import
SAP reference for IMPORT command
In this example we will import a copy of the SBODEMOUS schema and rename it during the import process. The new schema that will be imported in this example will be called SBODEMOUS_COPY.
1. Copy the exported archives onto the target server.
2. Extract the archives:
cd /usr/sap/HDB/HDB00/work/backups/SBODEMOUS tar -zxvf sbodemous.tar.gz
3. To rule out the possible errors that can result from overwriting the schemas, make sure that before the import you delete SBODEMOUS_COPY schema with cascade if it exists.
4. In the IMPORT command, you have the possibility to rename schemas. You should use this to avoid any additional schema to be overwritten, other than the schema you actually want to import.
For this reason, you should check in the exported “export” and “index” folders if any other schema is referenced. Then in the IMPORT commands, make sure that every referenced schema is renamed.
5. Import the SBODEMOUS schema:
IMPORT "SBODEMOUS"."*" AS BINARY FROM '/usr/sap/HDB/HDB00/work/backups/SBODEMOUS' WITH REPLACE THREADS 8 RENAME SCHEMA "SBODEMOUS" TO "SBODEMOUS_COPY", "SBOCOMMON" TO "SBOCOMMON_TEMP"
6. Delete all the *_TEMP schemas with cascade if they have been created.
7. After the import it can happen that the SBO_SP_TRANSACTIONNOTIFICATION does not exist in the SBODEMOUS_COPY.
In this case it should be created again from the backup you created before the export.
If the SBO_SP_TRANSACTIONNOTIFICATION is missing, you will be informed about it in a message when you log in to SBO and you will get a “The transaction has aborted.” error during the PMX Database Update.
8. Run the PMX Database Update Tool and execute an update with the correct connection string.
This will create the deleted PMX stored procedures. Please note that the PMX_SP_TransactionNotification stored procuredure is only created if the Force to re-install PMX_SP_TransactionNotification checkbox is checked.
9. The PMX_SP_TransactionNotification can contain custom code. In this case we recommend re-creating it manually from a backup instead of adding it automatically by enabling the checkbox.
10. Now you can re-enable the call for PMX_SP_TransactionNotification in SBO_SP_TRANSACTIONNOTIFICATION.
Import into the Schema with the Same Name
If you want to import into the schema with the same name as the export was executed for, you should omit the whole RENAME section in the command above.
2. Using the Export/Import Wizard in SAP HANA Studio
The following section describes the steps of using the Export and Import Wizard in SAP HANA Studio. In the examples below the SBO company is called SBODEMOUS.
2.1. Using the Export Wizard in SAP HANA Studio
1. Select the Export… menu item.
2. Click Next
.
3. Specify the Directory for the export.
4. Set the number of threads.
5. Click Finish
.
2.2. Using the Import Wizard in SAP HANA Studio
1. Select the Import… menu item.
2. Specify the Directory where the exported items can be found.
3. Click Next
.
4. Select all the items on the left side as follows.
Click on the first item, press <Ctrl>-<A> and click Add.
5. Now all the items appear on the right side as well. Click Next
.
6. Check in the Replace existing catalog object option.
7. Set the number of threads.
8. Click Finish
.