Examples of copying data to the production-ready database
The following examples illustrate how you can copy tables from the production database to the production-ready data. It is important to remember that you cannot use the stagingcopy utility if requests for quotes (RFQs) are on your production system.
Example 1
After you clean the production-ready data, copy the production database to the production-ready data with the scope set to all:
Set the PATH environment variables.
Configure the database.
Change to the directory to which you want log files written.
The log files will default to the following directory:
- WC_userdir/instances/stagingcopy_{sourcedb_user} _{destdb_user}_{timestamp}.log)
- Type the following command:
.stagingcopy.sh -scope _all_ -sourcedb production_database_name -destdb staging_database_name -sourcedb_user user -destdb_user user
stagingcopy -scope _all_ -sourcedb production_database_name -destdb staging_database_name
.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.
.stagingcopy.sh -scope _all_ -sourcedb production_database_name -destdb staging_database_name -log log_file_name -sourcedb_user user -destdb_user user
stagingcopy -scope _all_ -sourcedb production_database_name -destdb staging_database_name -log log_file_name
.stagingcopy.sh -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
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 thesourcedb_user
,
sourcedb_passwd
,
destdb_user
, and
destdb_passwd
options.
Example 2
After you clean the merchant tables from production-ready data, copy the merchant-related tables from the production database to production-ready data:
- Set the PATH environment variables.
- Configure the database.
- Change to the directory to which you want log files written.
- Type the following command:
stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -sourcedb_user user -destdb_user user
stagingcopy -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name
stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -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 -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.
-cleanup_stage_db
parameter: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.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 -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
-cleanup_stage_db no
parameter:stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -cleanup_stage_db no -sourcedb_user user -destdb_user user
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 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 3
- Set the PATH environment variables.
- Configure the database.
- Change to the directory to which you want log files written.
- Type the following command:
stagingcopy.sh -scope _site_ -sourcedb production_database_name -destdb staging_database_name -sourcedb_user user -destdb_user user
stagingcopy -scope _site_ -sourcedb production_database_name -destdb staging_database_name
stagingcopy.sh -scope _site_ -sourcedb production_database_name -destdb staging_database_name - 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 -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.
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 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 command:
stagingcopy.sh -scope _all_ -sourcedb production_database_name -destdb staging_database_name -script_file stage_copy.sql -sourcedb_user user -destdb_user user
stagingcopy -scope _all_ -sourcedb production_database_name -destdb staging_database_name -script_file stage_copy.sql
stagingcopy.sh -scope _all_ -sourcedb production_database_name -destdb staging_database_name -script_file stage_copy.sql 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 -script_file stage_copy.sql -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.
The stagingcopy utility generates the stage_copy.sql script to clean and copy the database.

Log on as the database administrator.
Enter
su - WC_non_root_user
, whereWC_non_root_user is the non-root user under which WebSphere Commerce runs. The value of WC_non_root_user is typicallywasuser
.- Open a DB2 command window and enter:
db2 -vtd# -f stage_copy.sql

- Logon.
Log on as the database administrator.
Enter
su - WC_non_root_user
, where WC_non_root_user is the non-root user under which WebSphere Commerce runs. The value of WC_non_root_user is typicallywasuser
.
- Open an SQLPlus window.
- Connect as DBA and enter:
@stage_copy.sql