List Backup of Archivelog All: Oracle RMAN Command Guide
List Backup of Archivelog All: Oracle RMAN Command Guide
Purpose
Which archived redo logs does RMAN know how to restore? The LIST BACKUP OF ARCHIVELOG ALL command answers that question. It reads the RMAN repository and prints every backup that holds archived redo logs, one backup set at a time, with the thread and sequence numbers inside each set. Oracle describes the LIST command as a way to "display backups and information about other objects recorded in the RMAN repository."
Run it before a restore to see which log sequences have a backup. Run it after a backup job to check that the logs were captured. Run it when you plan to clean up old backups, because it shows exactly which records a CROSSCHECK or DELETE command would act on. The words "recorded in the repository" matter: the command reports what RMAN has on record, not what it has just checked on disk or tape.
Code
1list backup of archivelog all;
Code Breakdown
The command has three parts:
- LIST BACKUP: Displays backups recorded in the RMAN repository.
- OF ARCHIVELOG: Limits the output to backups that contain archived redo logs.
- ALL: Oracle's syntax reference says
ALL"specifies all available archived logs." It places no sequence or time limit on the listing.
Key Points
- The listing comes from the RMAN repository. It shows what is recorded, and a record is not proof that the file is still present.
- Each backup piece carries a status of AVAILABLE, UNAVAILABLE or EXPIRED. Expired and unavailable records are still listed, so read the status before you trust a backup.
- RMAN must be connected to a target database, or connected to a recovery catalog with
SET DBIDalready run. - With no device type given, the listing is not limited to one device, so disk and tape (SBT) backups can appear together.
SUMMARYgives a one-line summary for each backup.- In a Data Guard environment,
LISTdisplays the files that are accessible to the connected target database.
Command Variations
Each variation below uses clauses from Oracle's archived log range syntax:
1-- One line per backup
2list backup of archivelog all summary;
3
4-- A single sequence number
5list backup of archivelog sequence 192;
6
7-- A range of sequence numbers
8list backup of archivelog sequence between 186 and 192;
9
10-- Everything up to a sequence number
11list backup of archivelog until sequence 192;
12
13-- Everything from a sequence number onward
14list backup of archivelog from sequence 186;
15
16-- Logs from a point in time onward
17list backup of archivelog from time 'sysdate-7';
18
19-- Logs inside a time window
20list backup of archivelog time between 'sysdate-7' and 'sysdate-1';
What the range options mean, according to the Oracle syntax reference:
SEQUENCE integerspecifies a single log sequence number.SEQUENCE BETWEEN integer AND integerspecifies a range, and is equivalent toFROM SEQUENCE integer1 UNTIL SEQUENCE integer2.FROM TIMEandUNTIL TIMEgive the beginning and end of a time range.TIME BETWEENis equivalent to using both.THREAD integernames the thread. Oracle says it is "only necessary if the database is in an Oracle RAC configuration." If you do not give a thread, it defaults to 1.
A log sequence always implies a thread. A sequence number alone is therefore enough on a single instance, but on RAC you should name the thread so that you do not list the wrong one.
Insights and Best Practices
Understanding the Output
A long listing is made of several tables. These are the columns that matter most for archived log backups, with the meaning given in Oracle's reference for LIST:
- BS Key: A unique key that identifies the backup set. With a recovery catalog it is the primary key of the backup set in the catalog, and it corresponds to
BS_KEYin theRC_BACKUP_SETview. In the defaultNOCATALOGmode it shows theRECIDfromV$BACKUP_SET. - Device Type: The type of device on which the backup was made, for example DISK or sbt.
- Status: The backup piece status. The values are AVAILABLE, UNAVAILABLE and EXPIRED.
- Piece Name/Handle: The file name or handle of the backup piece. For a piece on SBT, the media ID is shown with the name.
- Thrd: The thread number of the redo log.
- Seq: The log sequence number of the archived log.
- Low Time: The time when the database switched into the redo log that has this sequence number.
- Next SCN and Next Time: The low SCN and low time of the next archived log sequence. The span between a log's Low Time and its Next Time is the period that log covers.
The archived log section of a backup set listing looks like this in Oracle's examples:
1List of Archived Logs in backup set 227
2Thrd Seq Low SCN Low Time Next SCN Next Time
3---- ------- ---------- --------- ---------- ---------
41 5 389156 15-FEB-13 411006 15-FEB-13
51 6 411006 15-FEB-13 412972 15-FEB-13
Read the table from top to bottom. Each row is one archived log. The Next SCN of one row equals the Low SCN of the next row, which shows that the two logs follow each other with no gap. If a row's Low SCN does not match the previous row's Next SCN, a sequence is missing from this backup set and you should look in other backup sets for it.
What the Status Means
The status column is the part of the output that people most often skip. Oracle defines the one-letter backup set codes as A (available), U (unavailable) and X (all backup pieces in the set expired). For copies, X means expired.
An expired record is not a deleted record. Oracle describes LIST EXPIRED as displaying backup sets, proxy copies and image copies "marked in the repository as EXPIRED, which means they were not found." RMAN only learns this when it runs a check: "When you use a CROSSCHECK command, RMAN searches disk and tape for backups and copies recorded in the repository. If it does not find them, then it updates their repository records to status EXPIRED."
Two things follow from this:
- A plain
LIST BACKUP OF ARCHIVELOG ALLis not a promise that every file in the output can be read today. Before a restore, run a crosscheck so the statuses are current. - A backup that was never crosschecked can still show AVAILABLE even if someone removed the file by hand.
To see only the problem records, use LIST EXPIRED with the same object type after a crosscheck.
Best Practices
- Run the listing after every archived log backup job, and compare the highest sequence number with the one in
V$ARCHIVED_LOG. - Use
SUMMARYfor a quick overview and the full listing when you need piece names or sequence ranges. - Use the sequence or time range options on a busy system. A full listing on a database with months of backups can be very long.
- Crosscheck first, then list, so that the Status column reflects what is on the media now.
- When RMAN backs up archived redo logs it includes a single copy of each log, so a sequence normally appears once in a given backup set.
- When a backup piece is on tape, the media ID in the output tells the tape operator which volume is needed.
Recovery Catalog vs Control File
RMAN keeps its repository in the control file of each target database. A recovery catalog is a second copy of that metadata in a separate database schema. Oracle describes the catalog this way: "A recovery catalog is a database schema used by RMAN to store metadata about one or more Oracle databases."
- Control file: Reusable records stay for at least
CONTROL_FILE_RECORD_KEEP_TIMEdays. The default is 7 and the range is 0 to 365. Oracle adds that if a new record must be added and the oldest has not aged enough, "the record section expands." - Recovery catalog: Oracle lists these benefits. It "creates redundancy for the RMAN repository stored in the control file," it "centralizes metadata for all your target databases," and it "can store metadata history much longer than the control file." It can also hold stored scripts, which are named sequences of RMAN commands that any RMAN client connected to the catalog can use.
The LIST documentation does not say that the command stops reading the control file once a catalog is connected. It says that LIST reads the RMAN repository. What does change is the key numbers. Oracle notes that "the values for KEY in the recovery catalog and the control file are different," so do not compare backup set keys between the two modes.
When to Run This
- Backup verification: After a backup job ends, list the archived log backups and confirm that the newest sequence numbers are present.
- Recovery planning: Before a restore, find which sequences have a backup and which have none. A gap in the sequence numbers is the first thing to look for.
- Cleanup planning: Before you delete old backups, list them first. Oracle notes that
LISTdisplays the backups and copies against which you can runCROSSCHECKandDELETE. - Audit and reporting: The listing gives a dated record of which logs were covered by which backup set.
Troubleshooting Common Issues
- The command returns no rows: Confirm that RMAN is connected to the right target. If you use a catalog, check that the database is registered and that
SET DBIDwas run when the target is not connected. A narrow sequence or time range can also exclude everything. - Backups show EXPIRED: RMAN did not find the files during the last crosscheck. Check the storage path or the tape library. If the files are gone for good, remove the records with the
DELETEcommand, which Oracle documents alongsideCROSSCHECK. - Old backups are missing in NOCATALOG mode: Records may have aged out of the control file. Look at the
CONTROL_FILE_RECORD_KEEP_TIMEsetting, and consider a recovery catalog if you need a longer history. - A sequence is missing: Look at the Next SCN and Low SCN values to find the gap, then list the surrounding sequences with
sequence betweento see which backup set should hold the log. - Wrong thread on RAC: Name the thread in the range clause. The default is thread 1.
References
- LIST - Oracle Database 19c Backup and Recovery Reference - Defines LIST, its prerequisites, the SUMMARY option, the status values and every output column quoted above.
- archivelogRecordSpecifier - Oracle Database 19c Backup and Recovery Reference - Defines ALL, SEQUENCE, FROM/UNTIL SEQUENCE, TIME BETWEEN and THREAD for archived log ranges.
- Managing a Recovery Catalog - Oracle Database 23ai Backup and Recovery User's Guide - States what a recovery catalog stores and its benefits over the control file alone.
- CONTROL_FILE_RECORD_KEEP_TIME - Oracle Database 19c Reference - Gives the default of 7 days, the range of 0 to 365 and how the record section expands.
- RMAN Enhancements in Oracle Database 11g Release 1 - ORACLE-BASE - Explains that RMAN backs up a single copy of each archived redo log.
Posts in this series
- How to Create Oracle RMAN Recovery Catalog Step by Step
- How to Register an Oracle Database with RMAN Catalog
- Oracle RMAN Unregister Database from Recovery Catalog
- Oracle RMAN Reset Database After RESETLOGS Recovery
- Oracle RMAN CROSSCHECK BACKUP Command Explained
- Oracle RMAN Resync Catalog Command Guide
- Oracle RMAN: Delete Backup Pieces with Manual Channel
- Oracle RMAN Database Backup Commands Guide
- Oracle RMAN Database Restore and Recovery Guide
- Delete Archive Log Older Than 5 Days in Oracle RMAN
- Oracle RMAN Crosscheck Archivelog - Fix RMAN-06059 Error
- Oracle RMAN List Backupset Command Guide
- Oracle RMAN List Backup of Database Command
- List Backup of Archivelog All: Oracle RMAN Command Guide
- Oracle RMAN Report Obsolete Command Guide
- Oracle RMAN Report Obsolete Redundancy Command Guide
- Oracle RMAN Delete Obsolete - Remove Unneeded Backups
- Oracle RMAN RESTORE DATABASE VALIDATE Backup Check
- Oracle RMAN REPORT SCHEMA Command: Display Database Files
- Oracle RMAN Delete Expired Backup: Repository Cleanup
- LIST BACKUPSET OF DATABASE: Oracle RMAN Command Guide
- Oracle RMAN Delete Obsolete Backups with Maintenance Channel
- Find Oracle Archive Logs Older Than N Days with find -mtime
- Audit RMAN Backup Job History with V$RMAN_BACKUP_JOB_DETAILS