Skip to content

Commit cd98d73

Browse files
committed
Show the redo log switching in the database, two different ways to display the information
1 parent bd2f88c commit cd98d73

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

redo_log_switches.sql

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
REM Script Name : redo_log_switches.sql
2+
REM Author : Craig Richards
3+
REM Created : 30 November 2012
4+
REM Last Modified :
5+
REM Version : 1.0
6+
REM
7+
REM Modifications :
8+
REM
9+
REM Description : Show the redo log switching in the database, two different ways to display the information
10+
11+
COLUMN c1 FORMAT A10 HEADING "Month"
12+
COLUMN c2 FORMAT A25 HEADING "Archive Date"
13+
COLUMN c3 FORMAT 999 HEADING "Switches"
14+
15+
COMPUTE AVG of C ON A
16+
COMPUTE AVG of C ON REPORT
17+
18+
BREAK ON A SKIP 1 ON REPORT SKIP 1
19+
20+
SELECT TO_CHAR(TRUNC(first_time), 'Month') c1, TO_CHAR(TRUNC(first_time), 'Day : DD-MON-YYYY') c2, COUNT(*) c3
21+
FROM v$log_history
22+
WHERE TRUNC(first_time) > last_day(SYSDATE-30) +1
23+
GROUP BY trunc(first_time);
24+
25+
-- Daily Count and Size of Redo Log Space (Single Instance)
26+
27+
SELECT A.*, ROUND(A.COUNT#*B.AVG#/1024/1024) Daily_Avg_Mb
28+
FROM (SELECT TO_CHAR(First_Time,'YYYY-MM-DD') DAY, COUNT(1) COUNT#, MIN(RECID) MIN#, MAX(RECID) MAX#
29+
FROM v$log_history
30+
GROUP BY TO_CHAR(First_Time,'YYYY-MM-DD')
31+
ORDER BY 1) A,
32+
(
33+
SELECT AVG(BYTES) AVG#, COUNT(1) COUNT#, MAX(BYTES) Max_Bytes, MIN(BYTES) Min_Bytes
34+
FROM v$log) B;

0 commit comments

Comments
 (0)