Administer > Stage server > Staging server utilities > stagingcopy


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. You cannot use the stagingcopy utility if request for quotes (RFQs) are on the production system.


Example 1

Type the entire utility on a single line. The utilities are shown here, on more than one line, for presentation purposes only.

After cleaning the production-ready data, copy the production database to the production-ready data with the scope set to all:

  1. Set the PATH environment variables..

  2. Configure the database.

  3. Change to the directory to which you want log files written.

  4. The log files will default to the following directory:

    • WC_USER/instances/stagingcopy_{sourcedb_user} _{destdb_user}_{timestamp}.log)

  5. Type the following command:

     stagingcopy.sh -scope _all_ \
                    -sourcedb dbprod \
                    -destdb dbstage \
                    -sourcedb_user user \
                    -destdb_user user 
    
     stagingcopy -scope _all_ \
                    -sourcedb dbprod \
                    -destdb dbstage
    
     stagingcopy.sh -scope _all_ \
                    -sourcedb dbprod \
                    -destdb dbstage dbtype oracle \
                    -sourcedb_user user \
                    -sourcedb_passwd password \
                    -destdb_user user \
                    -destdb_passwd password
    
     stagingcopy -scope _all_ \
                    -sourcedb dbprod \
                    -destdb dbstage\
                    -dbtype oracle \
                    -sourcedb_user user \
                    -sourcedb_passwd password \
                    -destdb_user user \
                    -destdb_passwd password
    

  6. 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.sh -scope _all_ \
                -sourcedb dbprod \
                -destdb dbstage \
                -log log_file_name \
                -sourcedb_user user \
                -destdb_user user 

 stagingcopy -scope _all_ \
                -sourcedb dbprod \
                -destdb dbstage \
                -log log_file_name

 stagingcopy.sh -scope _all_ \
                -sourcedb dbprod \
                -destdb dbstage \
                -log log_file_name dbtype oracle \
                -sourcedb_user user \
                -sourcedb_passwd password \
                -destdb_user user -destdb_passwd password
 stagingcopy -scope _all_ 
             -sourcedb dbprod 
             -destdb dbstage 
             -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, provide values for thesourcedb_user, sourcedb_passwd, destdb_user, and destdb_passwd options.


Example 2

After cleaning the merchant tables from production-ready data, copy the merchant-related tables from the production database to production-ready data:

  1. Set the PATH environment variables.

  2. Configure the database.

  3. Change to the directory to which you want log files written.

  4. Type the following command:

      • stagingcopy.sh -scope _merchant_ -sourcedb dbprod -destdb dbstage -sourcedb_user user -destdb_user user

      • stagingcopy -scope _merchant_ -sourcedb dbprod -destdb dbstage

      • stagingcopy.sh -scope _merchant_ -sourcedb dbprod -destdb dbstage -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password

    • stagingcopy -scope _merchant_ -sourcedb dbprod -destdb dbstage -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password

  5. Examine the stagingcopy_yyyy.mm.dd_hh.mm.ss.zzz.log file to verify that the utility was successful.

To only clean the production-ready data, specify the -cleanup_stage_db parameter:

To only copy data, specify the -cleanup_stage_db no parameter:

Tip: When copying with the scope set to merchant, ensure that you have copied the site scope data first. Otherwise, the copy will fail.


Example 3

After cleaning the site tables from production-ready data, copy the site tables from production database to stage database.

  1. Set the PATH environment variables.

  2. Configure the database.

  3. Change to the directory to which you want log files written.

  4. Type the following command:

      • stagingcopy.sh -scope _site_ -sourcedb dbprod -destdb dbstage -sourcedb_user user -destdb_user user

      • stagingcopy -scope _site_ -sourcedb dbprod -destdb dbstage

      • stagingcopy.sh -scope _site_ -sourcedb dbprod -destdb dbstage - dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password

    • stagingcopy -scope _site_ -sourcedb dbprod -destdb dbstage -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password

  5. Examine the stagingcopy_yyyy.mm.dd_hh.mm.ss.zzz.log file to verify that the utility was successful.

Delete the site tables may impact the merchant tables due to the cascade delete restriction. Clean the merchant data first, followed by the site data, and then copy the data:



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.

  1. Set the PATH environment variables.

  2. Configure the database.

  3. Change to the directory to which you want log files written.

  4. Type the following command:

      • stagingcopy.sh -scope _all_ -sourcedb dbprod -destdb dbstage -script_file stage_copy.sql -sourcedb_user user -destdb_user user

      • stagingcopy -scope _all_ -sourcedb dbprod -destdb dbstage -script_file stage_copy.sql

      • stagingcopy.sh -scope _all_ -sourcedb dbprod -destdb dbstage -script_file stage_copy.sql dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password

    • stagingcopy -scope _all_ -sourcedb dbprod -destdb dbstage -script_file stage_copy.sql -dbtype oracle -sourcedb_user user -sourcedb_passwd password -destdb_user user -destdb_passwd password

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

Run the following script:

  1. Logon as the Database Administrator (DBA).

  2. 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 typically wasuser.

  3. Open a DB2 command window and enter:

    • db2 -vtd# -f stage_copy.sql

Run the following script:

  1. Logon.

    • Logon as the Database Administrator (DBA).

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

  2. Open an SQLPlus window.

  3. Connect as DBA and enter: @stage_copy.sql


+

Search Tips   |   Advanced Search