Show TOC

Backing Up the Data (Online)Locate this document in the navigation structure

  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>/TRX<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 exporting indexes ( is located in: /usr/sap/<SAPSID>/TRX<instance_number>/exe/python_support.
  3. Execute the Python script for exporting indexes with the following parameters:


    --indexId=<my_index_id> (mandatory)

    --excludeIndexId=<my_index_id> (optional)






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


    Note that the --schemaOnly=<0|1> parameter is only significant for using the and Python scripts for the data backup and restore of OLAP and join indexes in the BI Accelerator (BIA). For more information, seeBacking Up and Restoring BIA Data.

Explanations for the Python Script

Command Explanation

--indexId=<my_index_Id> (mandatory)

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

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

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

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

--excludeIndexId= <my_index_Id> (optional)

You can specify that certain indexes are not to be backed up.

If you enter the following, all indexes are backed up apart from index_1 and index_2.

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

--exportPath= <path_to_backup_directory>  (optional)

You can use the exportPath parameter to define the directory for the backup indexes.

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

Note that you enter the path to the directory for the indexes to be backed up (<path_to_backup_directory>) without entering the directory name \index, because the Python script creates the \index subdirectory manually.

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

  • %SID: Is replaced by the SID of the current instance
  • %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 export path looks like this:


This is useful if you want to schedule the export using a CRON mechanism.

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

  • 0: The queue is not backed up. The content of the queue is lost.
  • 1 (default): The queue is backed up. Content such as queue status is retained. Queues are saved in the \queue subdirectory of the export path.

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

  • 0 (default): If an index backup already exists, the system does not overwrite it.
  • 1: The system overwrites an existing index backup.

--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.

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

  • 0 (default): The system carries out the export.
  • 1: The system simulates the export. No data is written. However, errors are displayed. This can be useful if you want to see whether or not an export is viable or which errors would occur if you carried out an export.

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

This parameter only affects logical indexes such as join indexes and OLAP indexes when using TREX as the BI Accelerator (BIA) in BI.

  • 0 (default): The system always copies the complete index.
  • 1: The system only exports the metadata for an index

-- help

You can use the python --help command to display more information about the script.


The specified index, <my_index_Id> was backed up in the directory that you specified in --exportPath=<path_to_backup_directory>. If you did not specify a value for the backup directory, the TREX indexes were backed up in the default backup directory, /usr/sap/<SAPSID>/TRX<instance_number>/backup/index.