Show TOC

Restoring the DataLocate this document in the navigation structure


Make sure that no old TREX files exist in the directory into which you want to import the TREX installation. If necessary, delete old files. At file-system level, check the sr/sap/<SAPSID>/TRX<instance_number>/index and usr/sap/<SAPSID>/TRX<instance_number>/ queue directories to make sure that all entries really were deleted.

  1. Execute the following scripts to set the environment variables required by TREX and the Python scripts:

    • UNIX:

      Bourne shell sh, Bourne-again shell bash, Korn shell ksh:

      . /usr/sap/<SAPSID>/TREX_<instance_number>/

      C shell csh:

      source usr/sap/<SAPSID>/TRX<instance_number>/TREXSettings.csh

    • Windows: c: usr\sap\<SAPSID>\TRX<instance_number>\TREXSettings.bat

  2. Navigate to the TREX directory that the Python script for importing indexes ( is located in: usr/sap/<SAPSID>/TRX<instance_number>/exe/python_support.

  3. Restore the backed up indexes by executing the Python script for importing indexes using the following parameters:


    --indexId=<my_index_id> (mandatory)

    --excludeIndexId=<my_index_id> (optional)

    --importPath=<path_to_backup_directory> (optional)

    --force=<0|1> (optional)

    --useQueueServer=<0|1> (optional)

    --verbose=<0|1> (optional)

    --ignoreExportErrors=<0|1> (optional)

    --testOnly=<0|1> (optional)

    --updateExport=<0|1> (optional)

    --directUse=<0|1> (optional)

    --topologyPath=<path_to_the topology> (optional)

    --importParts=<0|1> (optional; nur BIA)

    --importSharedParts=<0|1> (optional; nur BIA)

    --schemaOnly=<0|1> (optional; nur BIA)


    Note that the --importParts=<0|1>, --importSharedParts=<0|1>, and --schemaOnly=<0|1> parameters are only significant for using the Python script for the data backup and restore of OLAP and join indexes in the BI Accelerator (BIA). For more information, see Backing Up and Restoring BIA Data.

Explanations for the Python script



--indexId=<my_index_id> (mandatory)

You can specify that one or more indexes are to be restored.

As <my_index_Id>, you must specify the index name, for example, first_index_name.

To specify two or more indexes to be restored, use the following syntax: --indexId=index_1 --indexId=index_2 (and so on).

If you want to restore all indexes, use the following syntax: --indexId=*

--excludeIndexId= <my_index_id> (optional)

You can specify that certain indexes are not to be imported.

To import all indexes apart from index_1 and index_2, enter the following:

--indexId=* --excludeIndexId=index_1 --excludeIndexId=index_2

--importPath= <path_to_backup_directory> (optional)

Use the --importPath parameter to define the directory from which the indexes are to be imported.

If you do not specify this value, the system imports the index from default backup directory / usr/sap/<SAPSID>/TRX<instance_number>/backup/index.

Note that you must specify only the path itself without the directory name \index that the backed up index is located in as the path to the backup indexes (<path_to_backup_directory>).

The --importPath parameter can contain the following special characters:

  • %Y: Is replaced by the current year

  • %m: Is replaced by the current month

  • %d: Is replaced by the current day

  • %a: Is replaced by the current day of the week

    This means that a valid import path looks like the following:


--force=<0|1> (optional)

  • 0 (default): If the index to be imported already exists, the system issues an error message and the index is not overwritten.

  • 1: Existing indexes are overwritten before the import. The index in question is then imported.

--useQueueServer=<0|1> (optional)

  • 0: The queue is not restored.

  • 1 (default): If they exist, queues belonging to the indexes are also restored.

--verbose=<0|1> (optional)

  • 0: The system only displays error messages and does not display any other information.

  • 1 (default): The system displays error messages and information on running processes.

--ignoreExportErrors=<0|1> (optional)

Errors that occur during the export are logged in the exportStatus.log file.

  • 0 (default): If the exportStatus.log log file specifies that the export for an index terminated in an error, the index in question is not imported.

  • 1: The exportStatus.log file is not analyzed, and the system attempts to import the index regardless of errors in the export.

--testOnly=<0|1> (optional)

  • 0 (default): The index is imported.

  • 1: All data is initialized and the system simulates an import without actually performing it.

--updateExport=<0|1|2> (optional)

To import and index, the system requires the two files called saved_configuration.cfg and SnapshotFiles.lst. These files are both generated during a normal export. However, if you want to import indexes that were not exported, these files are missing, and the import cannot take place. Use the --updateExport parameter to generate the two missing files. If the files are already available, they are overwritten.

  • 0: The missing export files are not generated.

  • 1 (default): The missing export files are generated and the index is then imported.

--directUse=<0|1> (optional)

The indexes loaded to TREX are normally located in a normal index directory (such as /usr/sap/<SAPSID>/TRX<instance_number>/index) that is created when the indexes are generated. However, the indexes to be imported are located in an export directory after the export. When an import takes place, the indexes are copied from the export directory into the actual index directory. Use the --directUse parameter to suppress this copying operation if required.

  • 0 (default): During the import the index is copied to the normal index directory (such as /usr/sap/<SAPSID>/TRX<instance_number>/index). This is the standard scenario.

  • 1: The indexes are not copied to the normal index directory during the import opreation. Following an import with the --directUse=1 parameter value, the export directory for the imported indexes therefore has the function of the normal index directory.

--topologyPath= <path_to_the topology> (optional)

This parameter is only taken into account if the --updateExport=1 parameter is also set.

As described above, if --updateExport=1, the system attempts to restore the two missing files saved_configuration.cfg and SnapshotFiles.lst.

The topology.ini files can be used to generate the data required to generate these two files. If the topology.ini file is not available or is incomplete, default values are used for the missing files.

--replicateIndexAfterImport= <0|1> (optional)

  • 0 (default): No action is taken.

  • 1: The imported indexes are replicated on the slaves.

-- help

You can use the commend python --help to display more information on the script.

In the case of a distributed TREX landscape, the script runs the replication of the indexes automatically on all hosts in a TREX landscape.


The backed up indexes have been restored in the TREX index directory.