You are on page 1of 2

First create a directory for the capture to save files SQL> Create directory wloadcap as '/opt/oracle/workload'; Optionally we add

a filter to allow the inclusion or exclusion of a user(schema) ,module,action ,program ,service or instance from the capture. Start the capture. SQL> exec dbms_workload_capture.start_capture(name=>'OOW07',dir=>'WLOADCAP',defa ult_action=>'EXCLUDE') SQL> Select id, name, status from dba_workload_captures; Allow work to transpire , then end the capture. SQL> exec dbms_workload_capture.finish_capture; Export the AWR of the id obtained from dba_workload_captures table BEGIN DBMS_WORKLOAD_CAPTURE.EXPORT_AWR (capture_id =><id>); END; / Obtain the start SCN of the capture (This is required to know the exact SCN to w hich you should recover your target or "replay" databased prior to performing re play) SQL> Select name, start_scn from dba_workload_captures; The SCN obtained from the previous step is used to recover your target or replay database prior to performing replay. RMAN >duplicate target database to clonedb from active database until scn <scn> spfile nofilenamecheck Moving the workload is as simple as copying the contents of the capture director y to the testing host $ scp /opt/oracle/workload/* clonedb.host:/opt/oracle/workload/ The next step is to process , initialize and prepare the capture data on replay database SQL> exec dbms_workload_replay.process_capture(capture_dir=>'WLOADCAP') The next step is to set up replay clients and calibrating replay clients.The def ault mode is replay but the first time it has to be run in calibrate mode. $ wrc mode=calibrate replaydir=/opt/oracle/workload SQL> exec dbms_workload_replay.initialize_replay(replay_name=>'OOW07',replay_dir

=>'WLOADCAP') Set workload replay options SQL> exec dbms_workload_replay.prepare_replay(synchronization=>TRUE) On the workload generation host(s), start the Workload replay clients.The worklo ad can be generated from the local database host or separate machines.For most s cenarios, a more realistic load can be produced using separate hosts.Starting these client proces ses does not begin the replay.These processes log into the replay database and monitor the status of the replay job , waiting to start replay until the rep lay is started from the database side. $ wrc userid=system password=tea4two replaydir=/opt/oracle/workload workdir=/tm p The next call from the replay database actually starts the replay SQL> exec dbms_workload_replay.start_replay Exporting AWR data for Workload Replay and to do the export get the replay id SQL> Select id from dba_workload_replays; Export the AWR once you have obtained the id from dba_workload_replays table SQL> Begin dbms_workload_replay.export_awr(replay_id=><id>); End; / The final step in database replay process is to analyze the replay workload by g enerating a workload capture report. DECLARE rep_rpt CLOB; BEGIN rep_id := DBMS_WORKLOAD_REPLAY.GET_REPLAY_INFO(dir => 'WLOADCAP'); rep_rpt := DBMS_WORKLOAD_REPLAY.REPORT(replay_id => rep_id, format => 'TEXT'); dbms_output.put_line(rep_rpt); END; / Important Note A series of changes , modifications or parameter settings may be tested one afte r another if you use Flashback Logging or Flashback Database.After one replay is complete , export any performance statistics you want to analyze for comparis on , then simply make more changes ,flashback ans start all over again. SQL> SQL> SQL> SQL> shutdown immediate; startup mount; flashback database to scn <scn>; alter database open resetlogs;

You might also like