The following examples illustrate how you can copy tables from the production database to the staging database. It is important to remember that you cannot use the Stage Copy utility if RFQs are on your production system.
Note that you should type the entire utility in a single line. The utilities are shown here on more than one line for presentation purposes only.
Example 1
After cleaning the staging database, copy the production database to the staging database with the scope set to all:
- Set the PATH environment variables.
Not applicable.
- Configure the database.
Not applicable.
- Change to the directory to which you want log files written.
Not applicable. The log files will default to the following directory:
/QIBM/UserData/CommerceServer56/instances/stagingcopy_{sourcedb_user} _{destdb_user}_{timestamp}.log)
- Type the following:
. stagingcopy.sh -scope _all_ -sourcedb production_database_name -destdb staging_database_name dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
stagingcopy -scope _all_ -sourcedb production_database_name -destdb staging_database_name-dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
- Examine the stagingcopy_yyyy.mm.dd_hh.mm.ss.zzz.log file to verify that the utility was successful.
To specify the log file name and path, use the log file parameter:
stagingcopy -scope _all_ -sourcedb production_database_name -destdb staging_database_name -log log_file_name -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
If you are using DB2 and are not logged on as the Database Administrator, you need to provide values for the -sourcedb_user, -sourcedb_passwd, -destdb_user, and -destdb_passwd options.
Example 2
After cleaning the merchant tables from staging database, copy the merchant-related tables from the production database to staging database:
- Set the PATH environment variables.
- Configure the database.
- Change to the directory to which you want log files written.
- Type the following:
- Examine the stagingcopy_yyyy.mm.dd_hh.mm.ss.zzz.log file to verify that the utility was successful.
To only clean the staging database, specify the -cleanup_stage_db parameter:
stagingcopy -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
To only copy data, specify the -cleanup_stage_db no parameter:
stagingcopy -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
Important: When copying with the scope set to merchant, ensure that you have copied the site scope data first. Otherwise, your copy will fail.
Example 3
After cleaning the site tables from staging database, copy the site tables from production database to stage database.
- Set the PATH environment variables.
- Configure the database.
- Change to the directory to which you want log files written.
- Type the following:
- Examine the stagingcopy_yyyy.mm.dd_hh.mm.ss.zzz.log file to verify that the utility was successful.
Deleting the site tables may impact the merchant tables due to the delete cascade restriction. Clean the merchant data first, followed by the site data, and then copy the data:
- stagingcopy.sh -scope _site_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only -sourcedb_user user -destdb_user user
- stagingcopy.sh -scope _site_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no -sourcedb_user user -destdb_user user
- stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no -sourcedb_user user -destdb_user user
- stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only -sourcedb_user user -destdb_user user
- stagingcopy -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only
- stagingcopy -scope _site_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only
- stagingcopy -scope _site_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no
- stagingcopy -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no
- stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
- stagingcopy.sh -scope _site_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
- stagingcopy.sh -scope _site_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
- stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
- stagingcopy -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
- stagingcopy -scope _site_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db only -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
- stagingcopy -scope _site_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
- stagingcopy -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password
Example 4
Generate the following script to clean and copy the production database to the stage database with scope all.
This example does not apply, since the -script option is not supported.
- Set the PATH environment variables.
- Configure the database.
- Change to the directory to which you want log files written.
- Type the following:
- Examine the stagingcopy_yyyy.mm.dd_hh.mm.ss.zzz.log file to verify that the utility was successful.
The Stage Copy utility generates the stage_copy.sql script to clean and copy the database.