| Lesson 11 | Looking at redo log information |
| Objective | Find and interpret key information about Oracle online redo logs and their history. |
V$LOG, V$LOGFILE, V$LOG_HISTORY, V$ARCHIVED_LOG, and V$ARCHIVE_DEST.
One row per group; shows size, member count, current/active state, and whether archived:
SELECT l.group#,
l.sequence#,
ROUND(l.bytes/1024/1024) AS size_mb,
l.members,
l.archived, -- YES/NO
l.status -- CURRENT | ACTIVE | INACTIVE
FROM v$log l
ORDER BY l.group#;
List the physical files (members) for each group and their status/path:
SELECT lf.group#,
lf.member, -- full path
lf.type, -- ONLINE | STANDBY
lf.status -- VALID | INVALID | STALE | DELETED
FROM v$logfile lf
ORDER BY lf.group#, lf.member;
Which group is Oracle writing to now?
SELECT group#, sequence#, status
FROM v$log
WHERE status = 'CURRENT';
Archive destinations and any errors (watch FRA fullness & archiver health):
SELECT dest_id, destination, status, error
FROM v$archive_dest
ORDER BY dest_id;
Recent log switches (helps size redo logs for a steady interval, e.g., ~15–30 minutes at peak):
SELECT sequence#, first_time, next_time
FROM v$log_history
ORDER BY first_time DESC
FETCH FIRST 20 ROWS ONLY;
Switches per hour (last 24 hours), useful to spot bursts:
SELECT TO_CHAR(first_time, 'YYYY-MM-DD HH24') AS hour_slot,
COUNT(*) AS switches
FROM v$log_history
WHERE first_time > SYSDATE - 1
GROUP BY TO_CHAR(first_time, 'YYYY-MM-DD HH24')
ORDER BY hour_slot DESC;
GROUP# SEQUENCE# SIZE_MB MEMBERS ARCHIVED STATUS
------ --------- ------- ------- -------- --------
1 10429 2048 2 YES INACTIVE
2 10430 2048 2 YES INACTIVE
3 10431 2048 2 NO CURRENT