As a new feature of Oracle 11g, rat aims to evaluate data performance. When we upgrade or modify some configurations for the database, we can compare the performance before and after the changes when changing the database server, so that the performance of the two can be comparable and practical. You need to first capture all operations in a certain time period in the production environment. Then replay them in the test environment.
1. Capture steps
Create a system directory, such as D: \ capture
Create an oracle Directory: create directory dir1 as 'd: \ capture'
Start Capture: dbms_workload_capture.start_capture (name => 'test', Dir => 'dir1'); (dir1 must be capitalized here)
Perform some operations in the database
End Capture: dbms_workload_capture.finish_capture;2. Preparations for Replay
- Copy the capture files on the target server to the tested server. Assume that a target D: \ capture is created on the tested server.
- Create an oracle Directory: create directory dir1 as 'd: \ capture'
Process workload:Dbms_workload_replay.process_capture(Capture_dir => 'dir1 ′));
Dbms_workload_replay.initialize_replay(Replay_name => 'play1 ′,Replay_dir => 'dir1 ′);
Dbms_workload_replay.prepare_replay(Synchronization => false);Iii. Replay officially started:Copy the capture files to the local device. Assume that the files are also copied to D: \ capture. open cmd. run the command: WRC Arwen/Arwen @ ora11r2 mode = calibrate replaydir = 'd: \ capture; then run WRC Arwen/Arwen @ ora11r2 mode = replay replaydir = 'd: \ capture open another CMD and connect to the DB with sqlplus and then run exec dbms_workload_replay.start_replay. in the previous cmd, a message is displayed: replay started: Time replay finished: report generated after time REPLAY: declarel_cap_idnumber; l_rep_idnumber; v_rep_rptclob; reportfile utl_file.file_type; beginl_cap_id: =
Dbms_workload_replay.get_replay_info(Dir
=> 'Dir1'); selectmax
(ID) into l_rep_id
From dba_workload_replayswhere capture_id = l_cap_id; v_rep_rpt: =
Dbms_workload_replay.report(Replay_id => l_rep_id, format => 'html'); reportfile: = utl_file.fopen ('dir1', 'Report. HTML ', 'w', 32767); utl_file.put_line (reportfile, v_rep_rpt,
True); utl_file.fclose (reportfile); end ).