skip to main content

SAP NetWeaver Newbie

OS/DB Migration - CMD. STR, TOC, EXT, R3load, DDLDBS.TPL and more

With increasing need to improve performance or reduce costs or vanishing support for operating systems/databases it becomes inevitable to migrate to a better OS or DB. We feel take a quick look at the primary ingredients of the tools for OS/DB migration handled by R3SETUP.

Tools - R3load, R3ldctl and R3szchk

R3ldctl creates STRucture files, TemPLate files by reading the technical settings for table/indexes in SAP data dictionary. R3szchk calculates the database size object sizes (EXTent files) for the target system based on the STR files created by R3ldctl. The EXT and STR files can be later split into smaller groups.

R3ldctl and R3szchk create STR, EXT and TPL files

The most crucial tool R3load is responsible for unloading and loading data from the database. R3load uses the files created by R3ldctl and R3szchk and dumps the data into compressed binary format as .001, .002 .. files. It uses cmd files to achieve the task. If the cmd files are not present, it creates on its own.

R3load to unload and load data from and to database


Command files*.cmd are created in the installation directory by R3load process if they are not already present. The command files contain path to database independent structure file (*.STR), database dependent template files (*.TPL), directory file (*.TOC) containing contents of dump files and directory containing data dump files.

Command Files *.cmd are generated and used by R3load

DB independent structure files *.STR are created by R3ldctl. Together, these files describe every table and index recognized in the SAP data dictionary. The TABART (class) and TABKAT (category) are read from the technical settings of the tables/indexes defined in DD09L.

Table and index attributes are extracted to STR files

DB dependent template files DDL<DBS>.TPL contain the database specific syntax which are used for creating tables and indexes. By carefully adjusting the template file, certain import steps can be made to run fast and certain potential errors can be avoided.

Editing DDLORA.TPL to use PARALLEL clause

Editing the max and next extents in DDLORA.TPL

In case of Oracle database,  DDLORA.TPL contains the mapping of tablespaces with the table classes (TABART) and table category to extent definitions.

Extent parameter files *.EXT contain the initial sizes of the tables/indexes. The default values of the initial extents are 16KB for Oracle database.

EXT files contain tables sizes. 16KB is the smallest value.

During export, the initial extent sizes of large tables are limited to 1.7 GB. This may be small and is very likely to pose a problem during import. Find all occurrence of 1782579200 in EXT files and increase them to a large value (say 10GB 10000*1024*1024 = 10485760000)

Export log shows initial extents limited to 1782579200

Change initial extents for big tables

Data dump files *.001, *.002 etc are the binary data files created by R3load while unloading the data from the database. These files are highly compressed. As a rule of thumb, the total size of the dump files may be about 10% of the database. It may be smaller if the tables are highly fragmented (for example as a result of data archiving). The dump files should not be edited.

Data dump file - R3load

Content directory files *.TOC contain the number of rows, which portion of the dump file holds which table and the timestamp of unload. You should never edit TOC files.

TOC - Mapping table data location in the dump files

DB size template DBSIZE.TPL contains how the datafiles are layed out accross the sapdata file systems. The source database may have had datafiles arrnaged in disorderly fashion. Editing DBSIZE.TPL before tablespace creation helps you control how big and where the datafiles are created.

Datafile layout in DBSIZE.TPL

Reading datafile layout in DBSIZE.TPL

You have to ensure that you are not exceeding the FS size and the summations at the bottom of the file match. You can use the following command to do the check for each SAPDATA

cat DBSIZE.TPL | awk -F"=" '{ print $2}' | sed  's/!/ /g' | xargs -n1 | grep @SAPDATA1@ | awk -F";" '{ print $2}' | awk '{s+=$1} END {print s}'

DBSIZE.TPL sum totals

R3SETUP Control files *.R3S orchestrate the export and import process. DBEXPORT.R3S controls export and DBMIG.R3S controls the database (only) migration.

There is no practical need to edit DBEXPORT.R3S, but DBMIG.R3S may need editing to insert exit routines.

Insert a line in the [EXE] section. If you find some activities in the import phase that can be performed before export completes, you may wish to run them while export is in progress to reduce downtime. Before the data loading is started by R3load, you should exit the import program. This can be achieved by adding an exit routine before DBR3LOADEXECDUMMY_IND_IND step starts.

Search for DBR3LOADEXECDUMMY_IND_IND in the DBMIG.R3S file. Just before that line, add <previous line number + 5>=EXITSAPNWNEBWIE_IND_IND to exit before the R3load process begins.

Custom exit section in the list of steps

By adding the line you have specified another step to be executed by R3SETUP, but the definition of that step is not added yet.

Note that the steps in R3S file [EXAMPLELABEL_OS_DB] are sorted in alphabetical order. Therefore the new exit section should follow the alphabetical sequence.

Adding CExitStep in R3S file

EXITSAPNWNEWBIE... section is alphabetically ordered between EXITORA.. and EXITSTARTR3...


  1. Hi,

    The blog is good. Could you post some more like TSK files and other files. How to troubleshoot when error occurs especially during a restart error situation.


    1. The use of TSK files begins with 610 release. This post was written for systems earlier than 610 release, specifically relevant for 4.6c, which is why there is no mention of TSK files. Although it is relevant for older release, some of the concepts are still valid. Moreover, the older tools and procedures were lot simpler, so it is easier to follow.

      Getting to TSK files:
      As of 610, the R3load process is NOT DIRECTLY controlled by sequence of objects in SAP[TABART].STR or DDL[DBS].TPL files. The actions are determined by [Package].TSK file, which is created from STR file. These TSK files contain an entry for each action in the following form:
      Object_type Object_name Action Status

      Object_Type can be T (table), D (data), P (primary key), I (index), V (view)
      Action can be C (create), I (import), E (export)
      Status can be xeq (yet to execute), err (completed with error), ok (completed successfully), ign (ignore, set by admin or SAP support)

      When started for the first time, R3load:
      0. Checks if there is any [Package].TSK.bck exists, if there is any, it terminates immediately.
      1. Reads a TSK file completely, closes the file, renames it in a [Package].TSK.bck
      2. Opens the TSK file for writing.
      3. After each executed action, an entry is written with the corresponding status.
      4. If all actions are processed, or if the unprocessed actions could be written back to the TSK file after an error, the TSK.bck file is deleted.

      SO the presence of [Package].TSK.BCK file means that either R3load is in progress or it terminated with an error.

      To deal with an error situation:
      1. Check why the particular action has failed (disk crash, disk full, incomplete or corrupt files etc) from [Package].log and address that problems.
      2. Go to the directory where TSK and TSK.BCK files are present
      3. Merge the two files using the command: R3load -merge_only [file].TSK
      4. Restart R3load

  2. Hi,

    thank you for the nice blog. this blog gives me better understanding of migration than sap tadm70 guide. please can you write a blog on table and package splitting, parallel export import using migmon and distribution monitor. there is a file that is used to update the status of export and using it the import will start in target system,please can you write a blog on it


  3. Simply great Blog, very useful


Email Subscription

Get every new post into your inbox by subscribing us.

Want a reason to subscribe?
1. This sitemap might convince you to subscribe.
2. We do not misuse email IDs. We respect privacy.

© 2008 - 2017 sapnwnewbie. All rights reserved.