SAPTechno

Note 962019 - System copy of an SAP MaxDB Content Server database

Header
Version / Date 25 / 2011-08-15
Priority Recommendations/additional info
Category Consulting
Primary Component BC-DB-SDB MaxDB
Secondary Components KM-KW SAP Knowledge Warehouse

Summary
Symptom

You use a MaxDB Content Server database, and you want to copy it to another host.

    1. To do this, you use a homogeneous system copy with the backup/recovery procedure.

              Homogeneous system copies (backup/recovery) can be executed only in systems that fulfill the following conditions:

      a) Database version of source and target system

      For possible release combinations, refer to Note 129352.
      b) The processor uses the same byte sorting sequence (Little Endian -> Little Endian, Big Endian -> Big Endian).

      Note 552464 describes the permitted combinations. The current SAP MaxDB documentation provides a complete matrix under
    • German: Grundwissen -> Konzepte des Datenbanksystems -> Verwaltung -> Replikation und High-Availability -> Datenbankkopie -> Kompatible Prozessorarchitekturen für Datenbankkopien
    • English: Basic Concepts -> Administration -> Replication and High Availability -> Database Copy -> Compatible Processor Architecture for Database Copies

              Exception:

              A homogeneous system copy of the content server can also be performed in the following case:

              Source system: LINUX 32-bit; target system: LINUX X86_64

              The procedure in the case of a homogeneous system copy is described in Note 129352.

              If the specified operating system prerequisites are met in the source and target system, you MUST use the homogeneous system copy and not the heterogeneous system copy.

    2. Heterogeneous system copy

              If you cannot use the homogeneous system copy procedure for a Content Server for one of the reasons specified under 1., the system copy of a Content Server database with SAP MaxDB takes place using the database loader tool (command line program loadercli) instead of R3load.

              This procedure is described in the following sections.

              C A U T I O N:

              In your source system, check the settings of the following database parameter: _UNICODE

              If the database parameter _UNICODE is set to the value NO, and you want to start the target system with SAP MaxDB Version 7.6, you can use the procedure described here for the import into a target system only with SAP MaxDB Version 7.6.05 build 11 or higher (PTS: 1157386).

              The required SAP MaxDB version is available on SWDC.

              Note that the target system must be installed at least with Version 7.6.05 build 11.

      a) An upgrade to this version does not help. Stop the target system (shutdown) and delete the database instance (drop database). SAPinst provides the uninstall option. This guides you through the uninstall procedure. Then repeat the software installation with 7.6.05 build 11 or higher.
      b) If you have not yet installed the target system, you can copy the software from the DVD to a temporary directory. You must replace the SAP MaxDB software package with the package that you downloaded from the SWDC before you start the installation from the temporary directory.

              Comments:

              This note describes the page-by-page export because this is the fastest procedure for the heterogeneous system copy.

              If you have several repositories in your source system, you can perform the export and the import in parallel.

              You do not use the loader command EXPORT/IMPORT USER to export or import the data that belongs to a database user; instead, you use the command EXPORT/IMPORT TABLE to import or export table by table. You must execute these commands for each repository.

              For more information, see the SAP MaxDB documentation.

              Alternatively, you can also export the data from a content server record-by-record. To do this, use the PAGES key word instead of the RECORDS in the loader command EXPORT/IMPORT TABLES.

Other terms

Heterogeneous system copy, content server, loader, loadercli, encoding type of source and target database do not match: source = ASCII target = UNICODE;

Reason and Prerequisites
    1. You use the Content Server on an SAP MaxDB.
    2. For exporting and importing you require at least a database loader tool with Version 7.6.05 build 11 or higher (regardless of which database version you use).

              You can use the command sdbregview -l (for example) to determine the loader version on your system. If you require an update, refer to Note 649814.

    3. Important: You must use the same binary-compatible loader for the entire export an import; for example, you cannot start the export with a loader on Windows (little endian) loader and then carry out the import with a loader on AIX (big endian). For the entire process (export and import) you must only use the loader of the source system or only the loader of the target system. Using a combination of both will later cause a termination due to missing binary compatibility.

              We recommend that you use the loader of the target system (because there, the loader version is more current or is at least the same as the version installed on the source system).

    4. In the source system, you use SAP DB core version 7.3.00 build 57 (PTS 1143300) or higher, or SAP MaxDB core version 7.5.00 build 40 (PTS 1143301), 7.6.00 build 31, or higher.
    5. In the target system, you use SAP DB core version 7.3.00 build 57 (PTS 1143300) or higher, or SAP MaxDB core version 7.5.00 build 40 (PTS 1143301), 7.6.05 build 11 (PTS 1157386), or higher.
    6. If the minimum version 7.3.00 build 57 is not yet available on SAP Service Marketplace, you must first upgrade Content Server Version 7.3. to Version 7.5.00 build 40 before you can execute a heterogeneous system copy.
    7. The procedure described in this note supports the following migrations:
  • The source system has the same database core version as the target system.
  • The source system has a lower database core version than the target system.
  • The source system runs on a 32-bit platform, and the target system runs on a 64-bit platform.
  • The source system has an ASCII database catalog (database parameter _UNICODE = NO), and the target system has a UNICODE database catalog (parameter _UNICODE = YES). For each installation as of SAP MaxDB Version 7.6, the Unicode database catalog (_UNICODE=YES) is preconfigured.

Solution


For performance reasons, it always makes sense to start the loader on the host that takes less time.
To perform the system copy, proceed as follows:

    1. Actions in the source system:
      a) CHECK DATA

                       Execute CHECK DATA (Verify) in the source system. This checks whether the data in the source database (Content Server) is consistent.

      b) CREATE INDEX (only database versions 7.3 and 7.5)

                       To accelerate later execution of the loader actions, you must create the following index (for example, using the SQL Studio) in the source system as the database system administrator (for example SUPERDBA):

                       CREATE INDEX PACKAGE_INDEX ON
  TRANSFORMATIONMODEL (PACKAGEGUID,OWNER,TABLENAME)

      c) Control file for exporting the catalog and the data

                       In the Content Server, all data belongs to the user SAPR3. Therefore, you can use the EXPORT USER loader command to export all repositories.

                       You require a command file for the loader in order to export the data of the source system. The data must be exported page-by-page.

                       The following is an example of an SDB_EXPORT.sql control file created for the export into the file system in the directory c:\export:

                       EXPORT USER
catalog outstream file 'c:\export\SAPR3.cat'
data outstream file 'c:\export\SAPR3.data' PAGES
package outstream file 'c:\export\SAPR3.pack' csv

    • The file SAPR3.cat contains the catalog information of the Content Server (CREATE statements and so on).
    • The files SAPR3.data<nnnn> contain the data of the Content Server. SAPR3.data0000 is an administration file that is required later for the import.
    • The file SAPR3.pack is a log file for support in case of an error.

                       Adjust the directory details in accordance with your system environment. Note that the directories must be set up on a sufficiently large disk or file system to ensure that all data can be saved to that location.

                       You can also export data via remote pipes or external tape drives. To do this, adjust the sample command mentioned above accordingly.

                       The directory into which the data is loaded can also be shared or mounted for the import into the target system.

      d) Export the data.

                       Start the loader as follows:

                       loadercli -d <source_database_name> -u <user>,<password> -n <source_computer_name> -b <export_user_script>

                       Example:
loadercli -d SDB -u SAPR3,SAP -n comp1234 -b c:\export\SDB_EXPORT.sql

                       If the error "-1013 Too many order columns" occurs during the export, and if the file SAPR3.data0000 was not generated, see Note 1171018.

                       Remark: If the export is cancelled before the end, you can restart the export. To do this, you require the loader log of this export.

                       The loader log has the following content (among other things):

                       export user data outstream file 'c:\export\SAPR3.data' PAGES
// *
// M Import    PACKAGE x'010000004E844A002C170000430B0000935DD49DCA5CE711'
// *
:
:

                       You require PACKAGEGUID for the restart; in this case, this has the following value: 010000004E844A002C170000430B0000935DD49DCA5CE711

                       Use the following command for the restart:

                       EXPORT USER DATA outstream file 'c:\export\SAPR3.data' PAGES RESTART '010000004E844A002C170000430B0000935DD49DCA5CE711'

                       The restart in the export case starts with the last table that was not exported completely, and it exports this table again.

              Background information: For the restart, the loader evaluates the entries in the file SYSLOADER.TRANSFORMATIONMODEL. Here, a line is exported for each table accessed by the loader during EXPORT USER, and this line contains the PACKAGEGUID. This line also contains the information as to whether the table was unloaded completely and successfully (RESTART = FALSE) or not (RESTART = TRUE). The first entry for a PACKAGEGUID with RESTART = TRUE is the starting point for the loader.

    2. Actions in the target system:
      a) Installation of the software

                       You have already installed the Content Server database software in the target system with the relevant SAP MaxDB version and created a database.

      b) CREATE INDEX (only target systems with Version 7.3 and 7.5)

                       If the target system has database version 7.3 or 7.5 (not required as of Version 7.6), note the following: Create the following index (for example, using the SQL Studio) as the database system administrator (for example, SUPERDBA):

                       CREATE INDEX PACKAGE_INDEX ON
  TRANSFORMATIONMODEL (PACKAGEGUID,OWNER,TABLENAME)

      c) COLUMNCOMPRESSION (only target systems with Version 7.6 or higher)

                       If the target system has SAP MaxDB Version 7.6, you must check the parameter configuration of the support parameter COLUMNCOMPRESSION in the target system. The correct setting (for the duration of the import) must depend on the database version of the source system.

                       Source version   Parameter setting in target system
7.3            COLUMNCOMPRESSION= NO
7.4            COLUMNCOMPRESSION= NO
7.5             COLUMNCOMPRESSION= NO

                       If the source system has MaxDB Version 7.6 or higher, the parameter COLUMNCOMPRESSION in the target system must be set to the same value as in the source system for the duration of the import. The COLUMNCOMPRESSION parameter can be changed ONLINE.

      d) Control file for importing the catalog and the data

                       You require a command file for the import. The data is loaded page-by-page.

                       The following is an example of an 'SDB_IMPORT.sql' control file created for the import into the target database in the directory c:\import:

                       IMPORT USER
catalog instream file 'c:\export\SAPR3.cat'
data instream file 'c:\export\SAPR3.data' PAGES
package outstream file'c:\import\SAPR3.pack' csv

      e) Schema

                       The data is loaded in the schema of the database user SAPR3. If this database user has not yet been created in the target system, the import terminates and the system issues an error message.

                       Check whether the database user SAPR3 has already been created in the target system (for example, using the SQL Studio):

                       Log on to the SQL Studio as the database system administrator (for example SUPERDBA). The SQL statement SELECT * FROM USERS may return the following results:

  • The database user SAPR3 is displayed.

           You can perform the import as described in point f).

  • The database user SAPR3 is not displayed.

           You must use the following SQL statement to create this database user:

           CREATE USER SAPR3 PASSWORD SAP DBA NOT EXCLUSIVE

           You can perform the import as described in point f).

      a) Import

                       Note that you are permitted to use only the loader of the source system or only the loader of the target system for the entire export and import. If you change the loader at a later stage, an error occurs during the import because the versions are not binary-compatible.

                       If the data is on the target host, the loader is started there, and the option -n is not required.

                       loadercli -d <target_database_name> [-n <target_database_computer>] -u <database_user>,<password> -b c:\import\SDB_IMPORT.sql

                       Example of importing from the source system:

                       loadercli -d SDB -n comp1234 -u SAPR3,SAP -b c:\import\SDB_IMPORT.sql

                       Example of importing from the target system:

                       loadercli -d SDB -u SAPR3,SAP -b c:\import\SDB_IMPORT.sql

                       If an error occurs during the import process, the import can be restarted. To do this, you require the loader to determine the PACKAGEGUID.

                       Example:

                       import user data instream file 'c:\export\SAPR3.data' PAGES
// M Import    PACKAGE x'010000004E844A002C170000430B0000935DD49DCA5CE711'
// *
:

                       The command for restarting the import is then as follows:

                       IMPORT USER data instream file 'c:\export\SAPR3.data' PAGES RESTART '010000004E844A002C170000430B0000935DD49DCA5CE711'

                       The restart in the IMPORT case starts with the last table that was not imported successfully, and loads this table again.

      b) Backup

                       After the page-by-page import into the target database, the data is write-protected. A complete database backup (SAVE DATA) is therefore essential once the import process is completed and before production operation can be resumed.

Related Notes
1171018-1013 = Too many order columns during export
1014782FAQ: MaxDB system copy
744774Migrating the database catalog to Unicode
129352Homogeneous system copy with MaxDB (SAP DB)