Example: Replaying a Consolidated Workload with APIs

This section assumes a scenario where workloads from three separate production systems running different versions of Oracle Database on various operating systems are being consolidated.

This scenario uses the following assumptions:

  • The first workload to be consolidated is captured from the CRM system, which is running Oracle Database 10g Release 2 (release 10.2.0.4) on a Solaris server.

  • The second workload to be consolidated is captured from the ERP system, which is running Oracle Database 10g Release 2 (release 10.2.0.5) on a Linux server.

  • The third workload to be consolidated is captured from the SCM system, which is running Oracle Database 11g Release 2 (release 11.2.0.2) on a Solaris server.

  • The test system is set up as a multitenant container database (CDB) running Oracle Database 12c Release 1 (release 12.1.0.1).

  • The CDB contains three PDBs created from the CRM, ERP, and SCM systems.

  • Each PDB contained within the CDB is restored to the same application data state as the CRM, ERP, and SCM systems at the capture start time.

Figure 15-3 illustrates this scenario.

Figure 15-3 Scenario for Consolidating Three Workloads

Description of
Description of "Figure 15-3 Scenario for Consolidating Three Workloads"

To consolidate the workloads and replay the consolidated workload in this scenario:

  1. On the test system, preprocess the individual workload captures into separate directories:

    • For the CRM workload:

      1. Create a directory object:

        CREATE OR REPLACE DIRECTORY crm AS '/u01/test/cap_crm';
        
      2. Ensure that the captured workload from the CRM system is stored in this directory.

      3. Preprocess the workload:

        EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('CRM');
        
    • For the ERP workload:

      1. Create a directory object:

        CREATE OR REPLACE DIRECTORY erp AS '/u01/test/cap_erp';
        
      2. Ensure that the captured workload from the ERP system is stored in this directory.

      3. Preprocess the workload:

        EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('ERP');
        
    • For the SCM workload:

      1. Create a directory object:

        CREATE OR REPLACE DIRECTORY scm AS '/u01/test/cap_scm';
        
      2. Ensure that the captured workload from the SCM system is stored in this directory.

      3. Preprocess the workload:

        EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('SCM');
        
  2. Create a root directory to store the preprocessed workloads:

    mkdir '/u01/test/cons_dir';
    CREATE OR REPLACE DIRECTORY cons_workload AS '/u01/test/cons_dir';
    
  3. Copy each preprocessed workload directory into the root directory:

    cp -r /u01/test/cap_crm /u01/test/cons_dir
    cp -r /u01/test/cap_erp /u01/test/cons_dir
    cp -r /u01/test/cap_scm /u01/test/cons_dir
    
  4. For each workload, create a directory object using the new operating system directory path:

    CREATE OR REPLACE DIRECTORY crm AS '/u01/test/cons_dir/cap_crm';
    CREATE OR REPLACE DIRECTORY erp AS '/u01/test/cons_dir/cap_erp';
    CREATE OR REPLACE DIRECTORY scm AS '/u01/test/cons_dir/cap_scm';
    
  5. Set the replay directory to the root directory previously created in Step 2:

    EXEC DBMS_WORKLOAD_REPLAY.SET_REPLAY_DIRECTORY ('CONS_WORKLOAD');
    
  6. Create a replay schedule and add the workload captures:

    EXEC DBMS_WORKLOAD_REPLAY.BEGIN_REPLAY_SCHEDULE ('CONS_SCHEDULE');
    SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('CRM') FROM dual;
    SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('ERP') FROM dual;
    SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('SCM') FROM dual;
    EXEC DBMS_WORKLOAD_REPLAY.END_REPLAY_SCHEDULE;
    
  7. Initialize the consolidated replay:

    EXEC DBMS_WORKLOAD_REPLAY.INITIALIZE_CONSOLIDATED_REPLAY ('CONS_REPLAY',
         'CONS_SCHEDULE');
    
  8. Remap connections:

    1. Query the DBA_WORKLOAD_CONNECTION_MAP view for the connection mapping information:

      SELECT schedule_cap_id, conn_id, capture_conn, replay_conn
        FROM dba_workload_connection_map;
      
    2. Remap the connections:

      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 1,
           conn_id => 1, replay_connection => 'CRM');
      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 2,
           conn_id => 1, replay_connection => 'ERP');
      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 3,
           conn_id => 1, replay_connection => 'SCM');
      

      The replay_connection parameter represents the services that are defined on the test system.

    3. Verify the connection remappings:

      SELECT schedule_cap_id, conn_id, capture_conn, replay_conn
        FROM dba_workload_connection_map;
      
  9. Prepare the consolidated replay:

    EXEC DBMS_WORKLOAD_REPLAY.PREPARE_CONSOLIDATED_REPLAY (
         synchronization => 'OBJECT_ID');
    
  10. Start replay clients:

    1. Estimate the number of replay clients that are required:

      wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_crm
      wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_erp
      wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_scm
      
    2. Add the output to determine the number of replay clients required.

      You will need to start at least one replay client per workload capture contained in the consolidated workload.

    3. Start the required number of replay clients by repeating this command:

      wrc username/password mode=replay replaydir=/u01/test/cons_dir
      

      The replaydir parameter is set to the root directory in which the workload captures are stored.

  11. Start the consolidated replay:

    EXEC DBMS_WORKLOAD_REPLAY.START_CONSOLIDATED_REPLAY;
    

See Also: