stagingcopy utility

+

Search Tips   |   Advanced Search

The stagingcopy utility (stagingcopy.sh, stagingcopy.bat) copies data from the production database to the production-ready data on a staging or authoring server.

Note that you cannot use stagingcopy.sh if RFQs are on your production system.

After creating the authoring and staging servers, run the stagingcopy utility, before running stagingprop.

Run stagingcopy.sh on a machine that can connect to both the staging or authoring server database and the production server database.

For example...

nohup ./stagingcopy.sh -scope _all_
                       -sourcedb sourcedb
                       -destdb destdb
                       -dbtype DB2
                       -sourcedb_user wasuser
                       -sourcedb_passwd wasuser1
                       -destdb_user wasuser
                       -destdb_passwd wasuser1

For I5/OS: To run shell scripts:

  1. Log on as a user profile that has a CCSID other than 65535.

  2. Open a QSHELL command window...

    STRQSH

  3. Run the utility...

    WC_installdir/bin/stagingcopy.sh (parameters . . .)

 

Parameter values

-dbtype

  • AIX|Linux|Solaris|Windows: Specify DB2.

    This is the default database type and you can omit the dbtype parameter from the command.

  • I5/OS...

    DB2/OS400 When using the native i5/OS JDBC driver.
    DB2/OS400ToolBox When using the IBM Toolbox for Java JDBC driver.

  • (Oracle) Specify Oracle.

-scope

The level of scope for the copy to the staging or authoring server. Specify one of the following levels:

_all_

Copies both records related to the site and to all merchants. Records are copied in the following order:

  1. Site records are copied from STGSITTAB
  2. Site records are copied from STGMRSTTAB
  3. Merchant records are copied from STGMERTAB
  4. Merchant records are copied from STGMRSTTAB

_site_

Copies 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. This data comes from the STGSITTAB table.

_merchant_

Copies 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 copy all data for all merchants, not just data for one individual merchant. This data comes from the STGMERTAB table.

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 cascade delete. You should clean the merchant data followed by the site data then copy the site data followed by the merchant data.

-dbtable

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.

For example...

$ nohup ./stagingcopy.sh -scope _merchant_ \
                         -dbtable catentdesc \
                         -sourcedb sourcedb \
                         -destdb destdb \
                         -dbtype DB2 \
                         -sourcedb_user wasuser \
                         -sourcedb_passwd wasuser1 \
                         -destdb_user wasuser \
                         -destdb_passwd wasuser1 &

-sourcedb

The name of the database on the production server.

I5/OS|Review the following information:

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

-sourcedb_user

The logon ID of the database administrator who has created the source database schema. If not specified, the ID of the user currently invoking the utility is used.

I5/OS|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

The name of the database on the staging or authoring server.

I5/OS|Review the following information:

  • If the -dbtype parameter is DB2/OS400, specify the name of the database on the staging or authoring 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 or authoring database resides.

-destdb_user

(Required) The logon ID of the database administrator who has created the staging or authoring database schema. If not specified, the ID of the user invoking the utility is used. This parameter is mandatory when using a remote database.

I5/OS|The user profile associated with the commerce instance. This is the same as the staging or authoring database schema.

-destdb_passwd

The password of the logon ID that is specified by the destdb_user parameter. If not specified, the system prompts you to enter the password. This parameter is mandatory when using a remote database.

-cleanup_stage_db

Specify if the staging tables should be cleaned before copying data or not. If you do not specify this parameter, staging tables are automatically cleaned before copying data. Specify one of the following values:

yes

Clean the staging tables before copying data. Merchant data can be deleted because of the cascade delete.

no

Do not clean the staging tables before copying data. 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.

only

Cleans the staging tables but no data is copied from the production database.

If you specify the -scope parameter, you should clean and copy the merchant data after you clean and copy the site data.

AIX|Linux|Solaris|Windows:

(DB2) -script_file

  • The name of the SQL script file generated by the stagingcopy utility when using export and import to copy the production database to the production-ready data on the specified scope. The script file also generates the delete statements to clean the production-ready data if you use the default value or specify -cleanup_stage_db _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 stagingcopy utility directory where you invoke the stagingcopy utility.

    Issue the following command to run the script file:

    • db2 -vtd# -f script_file_name

-log

The path and name of the file in which the stagingcopy 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:

Syntax


Related concepts

Staging server

Authoring server

The stagingcopy utility and the production database

Related tasks

Copy data to the staging database