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:
- Open the Utility server Docker container.
- Type the following command:
./stagingcopy.sh -scope _all_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2
./stagingcopy.sh -scope _all_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle
- 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 -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2 -log log_file_name
./stagingcopy.sh -scope _all_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle -log log_file_name
If the sourcedb_passwd
and destdb_passwd
options are not
provided, the user will be prompted for them on the command line.
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:
- Open the Utility server Docker container.
- Type the following command:
./stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2
./stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle
- 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 _all_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2 -cleanup_stage_db only
./stagingcopy.sh -scope _all_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle -cleanup_stage_db only
-cleanup_stage_db no
parameter:./stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2 -cleanup_stage_db only ./stagingcopy.sh -scope _site_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2 -cleanup_stage_db only ./stagingcopy.sh -scope _site_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2 -cleanup_stage_db no ./stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2 -cleanup_stage_db no
./stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle -cleanup_stage_db only ./stagingcopy.sh -scope _site_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle -cleanup_stage_db only ./stagingcopy.sh -scope _site_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle -cleanup_stage_db no ./stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle -cleanup_stage_db no
Example 3
- Open the Utility server Docker container.
- Type the following command:
./stagingcopy.sh -scope _site_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2
./stagingcopy.sh -scope _site_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle
- 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.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


Example 4
Generate the following script to clean and copy the production database to the stage database with scope all.
- Open the Utility server Docker container.
- Type the following command:
./stagingcopy.sh -scope _all_ -sourcedb production_database_name -sourcedb_user user -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype db2 -script_file stage_copy.sql
./stagingcopy.sh -scope _all_ -sourcedb production_database_name -sourcedb_user user -script_file stage_copy.sql -sourcedb_passwd password -destdb staging_database_name -destdb_user user -destdb_passwd password -dbtype oracle -script_file stage_copy.sql
- 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.
- stage_copy.sql
- utilities_root/schema/9.0.0.0/dbtype/wcs.stage.trigger.sql
- utilities_root/schema/9.0.0.0/dbtype/wcs.droptrigger.sql

Enter
su - WC_non_root_user
, where WC_non_root_user is the non-root user under which HCL Commerce runs. The value of WC_non_root_user is typically wasuser.- Open a DB2 command window and enter:
db2 -vtd# -f wcs.droptrigger.sql
db2 -vtd# -f stage_copy.sql
db2 -vtd# -f wcs.stage.trigger.sql

- Logon.
- Open an SQLPlus window.
- Connect as DBA and enter:
- @wcs.droptrigger.sql
- @stage_copy.sql
- @wcs.stage.trigger.sql