Examples of copying data to the production-ready data

+

Search Tips   |   Advanced Search

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 RFQs are on your production system.

 

Example 1

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

  1. AIX|Linux|Solaris|Windows:

    Set the PATH environment variables..

  2. AIX|Linux|Solaris|Windows:

    Configure the database.

  3. AIX|Linux|Solaris|Windows:

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

  4. I5/OS|The log files will default to the following directory
    WC_userdir/instances/stagingcopy_{sourcedb_user}
    _{destdb_user}_{timestamp}.log)
    
    
    

  5. Type the following:

    • (DB2)

        . stagingcopy.sh -scope _all_ -sourcedb production_database_name -destdb staging_database_name -sourcedb_user user -destdb_user user

      • Windows: stagingcopy -scope _all_ -sourcedb production_database_name -destdb staging_database_name

    • (Oracle)

        . 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

      • Windows: 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

  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:

If you are using DB2 and are not logged on as the Database Administrator, provide values for the -sourcedb_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:

    • (DB2)

        stagingcopy.sh -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name -sourcedb_user user -destdb_user user

      • Windows: stagingcopy -scope _merchant_ -sourcedb production_database_name -destdb staging_database_name

    • (Oracle)

        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

    • Windows: 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

  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:

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 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:

    • (DB2)

        stagingcopy.sh -scope _site_ -sourcedb production_database_name -destdb staging_database_name -sourcedb_user user -destdb_user user

      • Windows: stagingcopy -scope _site_ -sourcedb production_database_name -destdb staging_database_name

    • (Oracle)

        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

    • Windows: 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

  5. 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 cascade delete restriction. Clean the merchant data first, followed by the site data, and then copy the data:

Windows:


AIX|Linux|Solaris|Windows:

 

Example 4

Generate the following script to clean and copy the production database to the stage database with scope all.

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

    • (DB2)

      • AIX|Linux|Solaris: stagingcopy.sh -scope _all_ -sourcedb production_database_name -destdb staging_database_name -script_file stage_copy.sql -sourcedb_user user -destdb_user user

      • Windows: stagingcopy -scope _all_ -sourcedb production_database_name -destdb staging_database_name -script_file stage_copy.sql

    • (Oracle)

        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

    • Windows: 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

  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.

(DB2) Run the following script:

  1. Windows: Logon as the Database Administrator (DBA).

  2. AIX|Linux|Solaris: 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 usually wasuser.

  3. Open a DB2 command window.

  4. Type: db2 -vtd# -f stage_copy.sql


(Oracle) Run the following script:

  1. Logon.

    • Windows: 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 usually wasuser.

  2. Open an SQLPlus window.

  3. Connect as dba.

  4. Type: @stage_copy.sql

 

Related Concepts


Staging server