Copy marketing statistics from the production environment

Typically, statistics regarding how customers are using the site are captured on the production environment. A system administrator can transfer that data from the production environment to the development or staging environment for analysis by running a series of commands, whenever the information is required. Attention: Instead of following the procedure in this topic, we can use the DownloadStatistics scheduled job to transfer your marketing and search rule statistical data from the production environment to your staging environment. See Scheduling the DownloadStatistics job to copy marketing and search statistics.


Procedure

  1. Enter the Utility server Docker container on the production environment.

  2. Run the ExportStats command:

      ./ExportStats.sh -Ddatabase_type -Ndatabase_name -Udatabase_user_id 
            -Pdatabase_password -Foutput_file_name -Ttable_name

    where:

      database_type
      The type of database we are using, DB2.

      database_name

      • (DB2) Enter the simple name of the database.

      • (Oracle) Identify the database using the following format: hostname:port:sid identifying the host name of the database server, the port number of the server, and the system ID.

      database_user_id
      The user ID of the database owner.

      database_password
      The password for the database owner ID.

      output_file_name
      The path and name of the output file with an .xml extension (if no path is specified, the default is the current directory).

      table_name
      The name of the database table to export. The table to export depends on your requirements from among the following choices:

    This creates an XML file.

  3. Transfer the XML file to the runtime development or staging environment Utility server Docker container.

    • /opt/CommerceServer90/bin

  4. Run the ImportStats command by entering the following:

      ./ImportStats.sh -Ddatabase_type -Ndatabase_name -Udatabase_user_id 
            -Pdatabase_password -Finput_file_name

    Where

      database_type
      The type of database we are using, DB2.

      database_name
      (DB2) The name of the database. DB2 users enter the simple name of their database.

      (Oracle) Identify the database using the following format: hostname:port:sid identifying the hostname of the database server, the port number of the server, and the system ID.

      database_user_id
      The user ID of the database owner.

      database_password
      The password for the database owner ID.

      input_file_name
      The path and name of the output file that is created with the ExportStats utility in step 2 (if no path is specified, the default is the current directory).


Results

This deletes any statistical information in the development or staging environment database, and imports the statistics.


Related concepts
Marketing statistics: storage and update frequency


Related tasks
Enable the collection of marketing statistics in Management Center
Enable the collection of statistics for search rule experiments
Scheduling the DownloadStatistics job to copy marketing and search statistics
Disable marketing statistics