vi dbply.sql
connect client_player/oracle_123
declare n number;
begin
for i in 1..100000 loop
select count(1) into n from t1 where object_id=1;
end loop;
end;
/
(4)使用sys用户终止捕获并处理捕获结果
exec dbms_workload_capture.finish_capture;
exec dbms_workload_replay.process_capture('DBPLY_DIR');
另外开启一个窗口,进入DBPLY_DIR会看到捕获到的负载被解析成各种文件
cd /home/oracle/dbply_dir
total 116
drwxr-xr-x 12 oracle dba 4096 Jul 25 07:36 inst1
-rw-r--r-- 1 oracle dba 3648 Jul 25 07:42 wcr_calibrate.xml
-rw-r----- 1 oracle dba 12288 Jul 25 07:42 wcr_conn_data.extb
-rw-r--r-- 1 oracle dba 36222 Jul 25 07:42 wcr_cr.html
-rw-r--r-- 1 oracle dba 17366 Jul 25 07:42 wcr_cr.text
-rw-r--r-- 1 oracle dba 173 Jul 25 07:42 wcr_fcapture.wmd
-rw-r--r-- 1 oracle dba 532 Jul 25 07:42 wcr_login.pp
-rw-r--r-- 1 oracle dba 35 Jul 25 07:42 wcr_process.wmd
-rw-r--r-- 1 oracle dba 97 Jul 25 07:36 wcr_scapture.wmd
-rw-r----- 1 oracle dba 12288 Jul 25 07:42 wcr_scn_order.extb
-rw-r----- 1 oracle dba 12288 Jul 25 07:42 wcr_seq_data.extb
Replay finished (07:52:24)
(6) 检索重放报告,需要指定ID号
ID CAPTURE_ID DIRECTORY START_TIM END_TIME
---------- ---------- ------------------------------ --------- ---------
13 89 DBPLY_DIR 25-JUL-15 25-JUL-15
12 81 DB_REPLAY 24-JUL-15 24-JUL-15
set long 100000
select dbms_workload_replay.report(13,'TEXT') from dual;
Replay Statistics
---------------------------------------------------------------
| Statistic | Replay | Capture |
---------------------------------------------------------------
| DB Time | 195.004 seconds | 199.362 seconds |
---------------------------------------------------------------
| Average Active Sessions | .66 | .67 |
Replay finished (08:07:32)
ID CAPTURE_ID DIRECTORY START_TIM END_TIME
---------- ---------- ------------------------------ --------- ---------
15 89 DBPLY_DIR 25-JUL-15 25-JUL-15
13 89 DBPLY_DIR 25-JUL-15 25-JUL-15
12 81 DB_REPLAY 24-JUL-15 24-JUL-15
set long 100000
Replay Statistics
---------------------------------------------------------------
| Statistic | Replay | Capture |
---------------------------------------------------------------
| DB Time | 1.362 seconds | 199.362 seconds |
---------------------------------------------------------------
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29047826/viewspace-1751582/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29047826/viewspace-1751582/