Stage Copy utility

The Stage Copy utility copies data from the production database to the staging database. Note that you cannot use this command if RFQs are on your production system.

To run the Stage Copy utility, type the following from a command line on a machine that can connect to both the staging server and the production server database. Type the entire script on one line. It is shown here on more than one line for presentation purposes only.

Working with databases other than DB2 for z/OS

This diagram shows the syntax for the stagingcopy utility. Refer to the list entitled Parameter values for the values.

Notes:

  1. Oracle You must include the optional parameters, logon user ID and password in the command even if you are currently running this utility with the same user ID.
  2. i5/OSiSeriesTo run shell scripts:
    1. Log on as a user profile that has a CCSID other than 65535.
    2. Open a QSHELL command window by typing the following command: STRQSH.
    3. Run the utility as follows:
      /QIBM/ProdData/CommerceServer56/bin/stagingCopy.sh (parameters . . .)
      Note
      : The user parameters must always be specified.

Parameter values

scope
The level of scope for the copy to the staging server. Specify one of the following:
_all_
Type _all_ to copy both records related to the site and to all merchants.
_site_
Type _site_ to copy only site-related records. This is data that is common to all merchants, for example, the language and country or region code used by the system.
_merchant_
Type _merchant_ to copy only records related to individual merchants. For example, store information is customized for individual merchants, and rows from the store tables could be specific for each merchant. Note that you must copy all data for all merchants, not just data for one individual merchant.

If you do not set your scope to _all_:

  • Copy site data before merchant data, since the site data is used by all merchants. Otherwise, your copy will fail due to a mismatch between the foreign and primary keys.
  • When you use the parameter cleanup_stage_db to clean the site data, merchant data can be deleted because of the delete cascade. You should clean the merchant data followed by the site data then copy the site data followed by the merchant data.
sourcedb
The name of the database on the production server.

i5/OSiSeries If the dbtype parameter is DB2/OS400, specify the name of the database on the production server, as displayed in the relational database directory. If the dbtype parameter is DB2/OS400ToolBox, specify the hostname of the server on which the production database resides.

destdb
The name of the database on the staging server.

i5/OSiSeriesIf the dbtype parameter is DB2/OS400, specify the name of the database on the staging server, as displayed in the relational database directory. If the dbtype parameter is DB2/OS400ToolBox, specify the hostname of the server on which the staging database resides.

dbtable
(Optional) The name of any specific table to be copied. All records in this table will be copied, provided the records are within the scope specified by the scope parameter; otherwise, no records will be copied.
sourcedb_user
The logon ID of the database administrator who has created the source database schema.

i5/OSiSeries (Required) The user profile associated with the commerce instance. This is the same as the source database schema.

sourcedb_passwd
The password of the logon ID that is specified by the sourcedb_user parameter.
destdb_user
The logon ID of the database administrator who has created the destination database schema.

i5/OSiSeries (Required) The user profile associated with the commerce instance. This is the same as the destination database schema.

destdb_passwd
The password of the logon ID that is specified by the destdb_user parameter.
log
(Optional) The path and name of the file in which the Stage Copy utility records its activities and errors. The timestamp is appended to the file name, for example, myLog_yyyy.mm.dd_hh.mm.ss.zzz.log. If this parameter is not specified, a log file called stagingcopy_yyyy.mm.dd_hh.mm.ss.zzz.log is created in the following log directory.
cleanup_stage_db
(Optional) Use this parameter to clean the staging tables before using the Stage Copy utility. When you use the -cleanup_stage_db parameter to clean the site data, note that the merchant data can be deleted because of the delete cascade. You should clean and copy the merchant data after you clean and copy the site data. Yes is the default. If you specify no, nothing will be deleted from the staging tables. Your copy might fail if your copy data generates conflict or duplicate key on primary key or unique indexes. To use the staging copy to clean up your stage database only, without a data copy from the production database, specify the -cleanup_stage_db as only.
script_file
i5/OSiSeriesThis parameter is not supported.
WindowsAIXSun Solaris Operating EnvironmentLinux (Optional) The name of the SQL script file generated by the Stage Copy utility when using export and import to copy the production database to the staging database on the specified scope. The script file also generates the delete statements to clean the staging database if you use the default value or specify -cleanup_stage_db as yes.

Before you run the script, verify that you have enough disk space to hold the exported tables. The script file is located in the Stage Copy utility directory where you invoke the Stage Copy utility.

DB2 Use db2 -vtd# -f script_file_name to run the script file.

dbtype
(Optional) WindowsAIXSun Solaris Operating EnvironmentLinux The database type (DB2 or Oracle). The default is DB2.i5/OSiSeriesSpecify one of the following:
DB2/OS400
Type DB2/OS400 when using the native JDBC driver. This is the default value if no dbtype is specified.
DB2/OS400ToolBox
Type DB2/OS400ToolBox when using the toolbox JDBC driver.

zSeriesWorking with DB2 for z/OS

This diagram shows the syntax for the stagingcopy utility. Refer to the list entitled Parameter values for the values.

Note: Both users (specified by -sourcedb_user and -destdb_user) need to have the DBADM privilege on the database objects created by each other

Parameter values

scope
(Required) The level of scope for the copy to the staging server. Specify one of the following:
_all_
Type _all_ to copy both records related to the site and to all merchants.
_site_
Type _site_ to copy only site-related records. This is data that is common to all merchants, for example, the language and country or region code used by the system.
_merchant_
Type _merchant_ to copy only records related to individual merchants. For example, store information is customized for individual merchants, and rows from the store tables could be specific for each merchant. Note that you must copy all data for all merchants, not just data for one individual merchant.

When you do not set your scope to _all_:

  • Copy site data before merchant data, since the site data is used by all merchants. Otherwise, your copy will fail due to a mismatch between the foreign and primary keys.
  • If you use the parameter cleanup_stage_db to clean the site data, merchant data can be deleted because of the delete cascade. You should clean the merchant data followed by the site data then copy the site data followed by the merchant data.
sourcedb
(Required) The name of the database on the production server.
destdb
(Required) The name of the database on the staging server.
dbtable
(Optional) The name of any specific table to be copied or cleaned, if using the cleanup_stage_db parameter. All records in this table will be copied, provided the records are within the scope specified by the scope parameter; otherwise, no records will be copied. If you clean a specific table, you will also clean the child tables by the delete cascade. If you copy a specific table, you should first copy the parent table, otherwise your copy will fail.
sourcedb_user
(Required) The logon ID of the database administrator who has created the source database schema.
sourcedb_passwd
(Required) The password of the logon ID that is specified by the sourcedb_user parameter.
sourcedb_schema
(Required) The schema for the source database.
destdb_user
(Required) The logon ID of the database administrator who has created the destination database schema.
destdb_passwd
(Required) The password of the logon ID that is specified by the destdb_user parameter.
destdb_schema
(Required) The schema for the destination database
log
(Optional) The path and name of the file in which the Stage Copy utility records its activities and errors. The timestamp is appended to the file name, for example, myLog_yyyy.mm.dd_hh.mm.ss.zzz.log. If this parameter is not specified, a log file called stagingcopy_yyyy.mm.dd_hh.mm.ss.zzz.log is created in the directory <<var> WC_installdir/logs.
cleanup_stage_db
(Optional) Use this parameter to clean the staging tables before using the Stage Copy utility. When you use the -cleanup_stage_db parameter to clean the site data, note that the merchant data can be deleted because of the delete cascade. You should clean and copy the merchant data after you clean and copy the site data. Yes is the default. If you specify no, nothing will be deleted from the staging tables. Your copy might fail if your copy data generates conflict or duplicate key on primary key or unique indexes. To use the staging copy to clean up your stage database only, without a data copy from the production database, specify the -cleanup_stage_db as only.
script_file
(Optional) The name of the SQL script file generated by the Stage Copy utility when using export and import to copy the production database to the staging database on the specified scope. The script file also generates the delete statements to clean the staging database if you use the default value or specify -cleanup_stage_db as yes.

Before you run the script, verify that you have enough disk space to hold the exported tables. The script file is located in the Stage Copy utility directory where you invoke the Stage Copy utility.

DB2 Use db2 -vtd# -f script_file_name to run the script file.

dbtype
(Required) The database type must be DB2/390.

Feedback