Skip to content

Commit 476d169

Browse files
authored
Merge pull request #1163 from oracle-devrel/uschwinn-dbreplaydebug
Uschwinn dbreplaydebug
2 parents 9159dd7 + 6c1eec3 commit 476d169

File tree

7 files changed

+204
-2
lines changed

7 files changed

+204
-2
lines changed

data-platform/core-converged-db/real-application-testing/db-replay/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ For more details on the usage in ADB refer to the [documentation](https://docs.o
2323
- [Testing Guide](https://docs.oracle.com/en/database/oracle/oracle-database/19/ratug/database-replay.html#GUID-C5CAF3E6-0F1C-4BD6-BC03-F71744AD600E)
2424
- [PL/SQL Packages and Types Reference - DBMS_WORKLOAD_CAPTURE](https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/DBMS_WORKLOAD_CAPTURE.html#GUID-77C6507C-3DE6-4FB4-B180-530BEB840BE8)
2525
- [PL/SQL Packages and Types Reference - DBMS_WORKLOAD_REPLAY](https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/DBMS_WORKLOAD_REPLAY.html#GUID-FE03A123-2257-41FF-BA90-AD0114DC1A4F)
26+
- [Database Replay monitor report (dbms_wrr_report) (Doc ID 2696765.1)](https://support.oracle.com/epmos/faces/SearchDocDisplay?_adf.ctrl-state=1dcdrnc7m4_53&_afrLoop=462946945372255)
27+
- [Scripts to Debug Slow Replay (Doc ID 760402.1)](https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=462075676937267&id=760402.1&_adf.ctrl-state=1dcdrnc7m4_53)
2628
- [Test Workloads with Oracle Real Application Testing - Autonomous Database](https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-real-application-testing.html#GUID-EB8F065E-5FBB-480D-BAF6-5A0446740073)
2729
- [PL/SQL Packages and Types Reference for Autonomous Database - DBMS_CLOUD_ADMIN](https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/dbms-cloud-admin.html#GUID-D76B229E-781E-45C0-9F14-CAF30F9E6E3B)
2830

data-platform/core-converged-db/real-application-testing/db-replay/files/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,14 @@ Start WRCs in the background on the replay machine or a separate machine (e.g. $
5959
- Replay report: replayreport.sql
6060
- Import capture AWRs: importAWR.sql
6161
- ComparePeriod report: comparereplayreport.sql
62-
63-
(Note: it may be useful to generate an additional AWR spanning the replay period.)
62+
(Note: it may be useful to generate an additional AWR spanning the replay period.)
63+
64+
### 5) Debug Database Replay (optional, only in the case you discover slow replays)
65+
- debug slow replay in dba_alert_history: debug_slow_replay_alert.sql
66+
- debug WRC sessions with gv$workload_replay_thread and gv$session: debug_wrc_sessions.sql
67+
- debug wrc waits with gv$workload_replay_thread: debug_wrc_wait.sql
68+
- debug slow replay info report: debug_slow_replay_info.sql
69+
- monitoring report using dbms_wrr_report (see also Doc ID 2696765.1): monitor_with_dbms_wrr_report.sql
6470

6571
# License
6672

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- debug slow replay in alert
2+
3+
set linesize 9999
4+
col object_name format a20
5+
col reason format a100
6+
col creation_time format a20
7+
8+
select object_name, reason, to_char(creation_time,'MM-DD-YYYY HH24:MM:SS') as creation_time
9+
from dba_alert_history
10+
where reason_id between 160 and 165
11+
order by creation_time
12+
/
13+
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
rem Script displays some informations that may be helpfull to analyze slow running RAT-Replays
2+
rem See also MOS-Note 760402.1
3+
4+
set echo on
5+
set verify off
6+
set pagesize 200
7+
8+
set lines 500 trimspool on pages 60
9+
spool debug_replay.txt
10+
11+
col filter_set_name format a30
12+
col default_action format a20
13+
col synchronization format a10
14+
col connect_time_scale format 99999 heading "CONNECT|TIME|SCALE"
15+
col think_time_scale format 999999 heading "THINK|TIME|SCALE"
16+
col think_time_auto_correct format a8 heading " THINK| TIME| AUTO|CORRECT"
17+
col scale_up_multiplier format 99999 heading "SCALE|UP|MULTIPLIER"
18+
col start_time format a18
19+
col end_time format a18
20+
21+
REM Replay Parameter
22+
23+
select id repl, to_char(start_time,'DD-Mon HH24:MI:SS') start_time, to_char( end_time,'DD-Mon HH24:MI:SS') end_time,
24+
duration_secs, filter_set_namE, default_action, synchronization,
25+
connect_time_scale, think_time_scale, think_time_auto_correct, scale_up_multiplier
26+
-- , think_time, elapsed_time_diff
27+
from dba_workload_replays
28+
where id = (select max(id)
29+
from dba_workload_replays)
30+
/
31+
32+
col capture_id format 9999
33+
col replay_id format 9999
34+
col start_time format a21
35+
col end_time format a21
36+
col current_time format a21
37+
col directory_path format a38
38+
col "% replayed" format 990.00
39+
col status format a15
40+
col r_dbtime_sec format 999G999G990D00
41+
col c_dbtime_sec format 999G999G990D00
42+
col repl_user_calls format 999G999G999G999
43+
col capt_user_calls format 999G999G999G999
44+
col capt_calls_total format 999G999G999G999
45+
col c_unreplayable format 999G999G999G999
46+
col repl_id format 99999
47+
col capt_id format 99999
48+
col begin_snap format 999999 heading "BEGIN|SNAP"
49+
col end_snap format 999999 heading "END|SNAP"
50+
col status format a15
51+
col "#Clients" format 99999999
52+
col Real_Time_Repl_Capture format a17 heading "Real-Time Repl/Capt"
53+
col DB_Time_Repl_Capture format 999G999D00 heading "% DB-Time Repl/Capt"
54+
col "%Calls repl'd" format 9990D00 Heading "%Calls|repl'd"
55+
col "% Replaytime" format 99G990D00 heading "% Replay|time"
56+
col "% Divergences" format 990D00
57+
col "User Calls" format 999G999G999G999G999
58+
col "Replay Divergences" format 999G999G999G999G999
59+
col max_repl_id new_value max_repl_id heading id
60+
col id format 9999
61+
col repl format 9999REM Replay Progress
62+
63+
select r.id repl, r.capture_id capt,
64+
r.status,
65+
-- r.name,
66+
r.awr_begin_snap begin_snap, r.awr_end_snap end_snap, r.num_clients "#Clients" ,
67+
lpad(trunc((nvl(r.end_time,sysdate) - r.start_time) * (24 * 60 * 60)/3600),2,'0') ||':'|| lpad(trunc(mod((nvl(r.end_time,sysdate) - r.start_time) * (24 * 60 * 60),3600) / 60 ),2,'0') ||':'||lpad(mod((nvl(r.end_time,sysdate) - r.start_time) * (24 * 60 * 60),60),2,'0')
68+
|| '/' ||
69+
lpad(trunc((nvl(c.end_time,sysdate) - c.start_time) * (24 * 60 * 60)/3600),2,'0') ||':'|| lpad(trunc(mod((nvl(c.end_time,sysdate) - c.start_time) * (24 * 60 * 60),3600) / 60 ),2,'0') ||':'||lpad(mod((nvl(c.end_time,sysdate) - c.start_time) * (24 * 60 * 60),60),2,'0') "Real_Time_Repl_Capt" ,
70+
round(r.user_calls / (c.user_calls) * 100,2) "%Calls repl'd",
71+
round( (nvl(r.end_time,sysdate) - r.start_time) /
72+
(nvl(c.end_time,sysdate) - c.start_time )* 100,3) "% Replaytime",
73+
r.USER_CALLS repL_user_calls, c.user_calls capt_user_calls,
74+
c.user_calls_total capt_calls_total,
75+
c.user_calls_unreplayable c_unreplayable,
76+
round((r.dbtime / c.dbtime * 100),2) "DB_Time_Repl_Capture"
77+
--, elapsed_time_diff, elapsed_time_diff / (1000 * 1000) ela_diff_sec
78+
from dba_workload_replays r , dba_workload_captures c
79+
where c.id = r.capture_id
80+
and r.id = (select max(id) from dba_workload_replays)
81+
/
82+
83+
REM Query to Obtain Information on Blocking Sessions with gv$workload_replay_thread
84+
85+
col inst_id format 99999
86+
col sid format 99999
87+
col spid format a6
88+
col blocking_session_status format a15 heading 'BS'
89+
col blocking_instance format 99 heading 'BI'
90+
col blocking_session format 99999 heading 'BLKSID'
91+
col session_type format a11
92+
col event format a31
93+
col file_name format a21
94+
col file_id format 9999999999999999999
95+
col call_counter format 9999999
96+
col wait_for_scn format 99999999999999 heading 'WAITING FOR'
97+
col wfscn format 99999999999999 heading 'WFSCN'
98+
col commit_wait_scn format 99999999999999 heading 'CWSCN'
99+
col post_commit_scn format 99999999999999 heading 'PCSCN'
100+
col clock format 99999999999999999999 heading 'CLOCK'
101+
col next_ticker format 999999999999999999999 heading 'NEXT TICKER'
102+
103+
select wrt.inst_id, wrt.sid, wrt.serial#, wrt.spid,
104+
s.BLOCKING_SESSION_STATUS, s.BLOCKING_INSTANCE,
105+
s.blocking_session,
106+
wrt.session_type, wrt.event,
107+
wrt.file_name, wrt.file_id, wrt.call_counter,
108+
wrt.wait_for_scn,
109+
greatest(wrt.dependent_scn, wrt.statement_scn) as wfscn,
110+
wrt.commit_wait_scn, wrt.post_commit_scn,
111+
wrt.clock, wrt.next_ticker
112+
from gv$workload_replay_thread wrt, gv$session s
113+
where wrt.sid = s.sid
114+
and wrt.serial# = s.serial#
115+
order by inst_id, sid
116+
/
117+
spool off
118+
119+
col repl_id format 9999999
120+
col capt format 9999
121+
col "Real_Time_Repl_Capt" format a20
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
-- debug WRC sessions
2+
3+
set linesize 500 pagesize 200
4+
5+
col inst_id format 99999
6+
col sid format 99999
7+
col spid format a6
8+
col blocking_session_status format a15 heading 'BLOCKING'
9+
col blocking_instance format 99 heading 'BI'
10+
col blocking_session format 99999 heading 'BLKSID'
11+
col session_type format a11
12+
col event format a31
13+
col file_name format a21
14+
col file_id format 9999999999999999999
15+
col call_counter format 9999999
16+
col wait_for_scn format 99999999999999 heading 'WAITING FOR'
17+
col wfscn format 99999999999999 heading 'WFSCN'
18+
col commit_wait_scn format 99999999999999 heading 'CWSCN'
19+
col post_commit_scn format 99999999999999 heading 'PCSCN'
20+
col clock format 99999999999999999999 heading 'CLOCK'
21+
col next_ticker format 999999999999999999999 heading 'NEXT TICKER'
22+
23+
select wrt.inst_id, wrt.sid, wrt.serial#, wrt.spid,
24+
s.BLOCKING_SESSION_STATUS, s.BLOCKING_INSTANCE,
25+
s.blocking_session,
26+
wrt.session_type, wrt.event,
27+
wrt.file_name, wrt.file_id, wrt.call_counter,
28+
wrt.wait_for_scn,
29+
greatest(wrt.dependent_scn, wrt.statement_scn) as wfscn,
30+
wrt.commit_wait_scn, wrt.post_commit_scn,
31+
wrt.clock, wrt.next_ticker
32+
from gv$workload_replay_thread wrt, gv$session s
33+
where wrt.sid = s.sid
34+
and wrt.serial# = s.serial#
35+
order by inst_id, sid
36+
;
37+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- debug WRC waits
2+
3+
column event format a40
4+
select event, count(*), min(wait_for_scn)
5+
from gv$workload_replay_thread
6+
where session_type = 'REPLAY'
7+
group by event;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* Database Replay monitor report (dbms_wrr_report) (Doc ID 2696765.1)
2+
3+
Identify percentage progress of replay,
4+
the slowest streams or sessions in the replay,
5+
waiter and blocker in the replay,
6+
and highest Database Wait Event during the replay
7+
Refer to Doc ID 2696765.1 for more information*/
8+
9+
-- Step 1: Identify replay id from dba_workload_replays
10+
11+
select id from dba_workload_replays where status = 'IN PROGRESS';
12+
13+
-- step 2: Run procedure dbms_wrr_report.replay
14+
15+
set serveroutput on
16+
exec dbms_wrr_report.replay(&replayid);

0 commit comments

Comments
 (0)