This section describes how to use time shifting with Consolidated Database Replay, and assumes a scenario where you want to use time shifting to align the peaks of workloads captured from three applications and replay them simultaneously. The scenario demonstrates how to use time shifting for stress testing. For more information about time shifting, see "About Time Shifting".
This scenario uses the following assumptions:
The first workload is captured from the Sales application.
The second workload is captured from the CRM application and its peak time occurs 1 hour before that of the Sales workload.
The third workload is captured from the DW application and its peak time occurs 30 minutes before that of the Sales workload.
To align the peaks of these workloads, time shifting is performed by adding a delay of one hour to the CRM workload and a delay of 30 minutes to the DW workload during replay.
To perform time shifting in this scenario:
On the replay system which will undergo stress testing, create a directory object for the root directory where the captured workloads are stored:
CREATE [OR REPLACE] DIRECTORY cons_dir AS '/u01/test/cons_dir';
Preprocess the individual workload captures into separate directories:
For the Sales workload:
Create a directory object:
CREATE OR REPLACE DIRECTORY sales AS '/u01/test/cons_dir/cap_sales';
Ensure that the captured workload from the Sales application is stored in this directory.
Preprocess the workload:
EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('SALES');
For the CRM workload:
Create a directory object:
CREATE OR REPLACE DIRECTORY crm AS '/u01/test/cons_dir/cap_crm';
Ensure that the captured workload from the CRM application is stored in this directory.
Preprocess the workload:
EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('CRM');
For the DW workload:
Create a directory object:
CREATE OR REPLACE DIRECTORY DW AS '/u01/test/cons_dir/cap_dw';
Ensure that the captured workload from the DW application is stored in this directory.
Preprocess the workload:
EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('DW');
Set the replay directory to the root directory:
EXEC DBMS_WORKLOAD_REPLAY.SET_REPLAY_DIRECTORY ('CONS_DIR');
Create a replay schedule and add the workload captures:
EXEC DBMS_WORKLOAD_REPLAY.BEGIN_REPLAY_SCHEDULE ('align_peaks_schedule'); SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('SALES') FROM dual; SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('CRM', 3600) FROM dual; SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('DW', 1800) FROM dual; EXEC DBMS_WORKLOAD_REPLAY.END_REPLAY_SCHEDULE;
Note that a delay of 3,600 seconds (or 1 hour) is added to the CRM workload, and a delay of 1,800 seconds (or 30 minutes) is added to the DW workload.
Initialize the consolidated replay:
EXEC DBMS_WORKLOAD_REPLAY.INITIALIZE_CONSOLIDATED_REPLAY ('align_peaks_replay', 'align_peaks_schedule');
Remap connections:
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;
Remap the connections:
EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 1, conn_id => 1, replay_connection => 'inst1'); EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 1, conn_id => 2, replay_connection => 'inst1'); EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 2, conn_id => 1, replay_connection => 'inst2'); EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 2, conn_id => 2, replay_connection => 'inst2'); EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 3, conn_id => 1, replay_connection => 'inst3'); EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 3, conn_id => 2, replay_connection => 'inst3');
The replay_connection
parameter represents the services that are defined on the test system.
Verify the connection remappings:
SELECT schedule_cap_id, conn_id, capture_conn, replay_conn FROM dba_workload_connection_map;
Prepare the consolidated replay:
EXEC DBMS_WORKLOAD_REPLAY.PREPARE_CONSOLIDATED_REPLAY;
Start replay clients:
Estimate the number of replay clients that are required:
wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_sales wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_crm wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_dw
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.
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.
Start the consolidated replay:
EXEC DBMS_WORKLOAD_REPLAY.START_CONSOLIDATED_REPLAY;