| Lesson 8 | Data dictionary views |
| Objective | Describe some of the V$ data dictionary views for backup and recovery. |
Oracle AI Database 26ai provides SQL views that help a database administrator inspect archived redo, RMAN backup records, job results, and current recovery conditions. These views support the reports and lists introduced in the preceding lessons. They let you build focused operational reports, investigate an unexpected backup result, and explain which database files a backup contains. A useful report answers a specific question: which jobs finished, where their pieces reside, which redo belongs to a recovery interval, or whether the fast recovery area is approaching its quota.
The lesson uses the familiar expression data dictionary views, but the names beginning with V$ are dynamic performance views. Some expose backup metadata recorded in the target database control file; others describe runtime activity or current storage conditions. They do not all share the same source or history. Recovery catalog views beginning with RC_ provide another reporting surface in the separate catalog database. Choose the source according to the question and the database identity you need to report.
All SQL and RMAN examples below are illustrative. They have been checked against Oracle 26ai documentation, but are not results from an executed backup or recovery. Run them through an appropriately authorized account in your own environment and interpret the actual returned rows.
Connect to the intended target database when querying its V$ views. For reports covering an entire container database, use an authorized connection to the CDB root. A connection to a pluggable database does not automatically expose all root or other PDB records. Where a view supplies CON_ID, interpret it using that view's documentation: zero can represent the entire CDB, one represents the root, and other values identify individual containers. Do not discard zero-valued rows just because your application runs in a PDB.
Access to dynamic performance views requires suitable privileges. Use the established monitoring account and approved grants rather than granting broad administrative privileges merely to run a report. Record the connection context with exported reports, especially when similarly named databases exist in development and production. A report without database identity, observation time, and query criteria can be misleading even when its SQL is correct.
Prefer explicit columns and a purposeful filter to SELECT *. A seven-day job report and a two-day archived-log report below are convenient examples, not retention requirements. Adjust these intervals to the investigation. Older rows may have aged out of the repository, and a short reporting interval can hide backups needed for recovery. Dates are database DATE values in these examples; format them consistently when exporting evidence.
V$ARCHIVED_LOG reports archived redo log information recorded in the control file. Useful columns include the redo thread and sequence, incarnation information, first and next change numbers, first and next times, destination, filename, and recorded status. These describe the log and its repository record. They do not constitute a fresh inspection of every file named in the output.
Archived redo supplies changes needed to advance restored datafiles toward a recovery target. A query helps locate candidate logs and investigate missing records. RMAN uses the backup repository and recovery requirements to select the actual restore and recovery inputs. A row in this view is evidence of recorded redo metadata, rather than a guarantee that the complete recovery chain can be retrieved.
SELECT resetlogs_change#, thread#, sequence#, dest_id,
first_time, next_time, status, backup_count, name
FROM v$archived_log
WHERE first_time >= SYSDATE - 2
ORDER BY resetlogs_change#, thread#, sequence#, dest_id;
This query shows logs whose starting time falls within the example interval. It does not find every log overlapping a particular recovery target, because a required log can start before that interval. Use the relevant SCN boundaries and RMAN recovery planning when assessing coverage, rather than treating this convenience filter as a recovery algorithm.
SEQUENCE# alone is not a unique identity across the database's history. Different redo threads can use the same sequence number, and opening with RESETLOGS establishes a new incarnation. Keep RESETLOGS_CHANGE#, THREAD#, and SEQUENCE# together when interpreting the example report. V$DATABASE_INCARNATION provides the related incarnation history when you need to explain a resetlogs boundary.
Several records can describe the same redo identity. A log can be archived to more than one destination, restored, or copied. Their filenames and destination details can differ. Do not delete duplicate-looking rows from an exported report without understanding why they exist. Separate a report about logical redo coverage from a report about physical archived-log copies; each needs different grouping.
The recorded STATUS values include available, deleted, unavailable, and expired. They describe repository state, which can lag behind storage changes made outside RMAN. A file can have disappeared since its record was written. Investigate recorded status alongside appropriately scoped RMAN crosschecks and the destination's actual accessibility.
For Data Guard reporting, APPLIED has a specific interpretation. Oracle documents it as meaningful for physical standby records registered by RFS; local archived-log destinations normally show NO. A local NO therefore does not establish standby lag. The value IN-MEMORY must not be treated as fully applied when making deletion decisions. Report the database role and registrar with application status when investigating standby behavior.
BACKUP_COUNT is the recorded number of times a log has been backed up; its documented count is capped at 15. It does not count currently usable backup copies. A positive value cannot establish that the media is accessible, the backup is intact, or the required logs for every thread are present. Use it to identify records worth examining, then inspect the relevant RMAN backups and recovery requirements.
For example, an administrator investigating a recovery failure might locate a sequence in this report and then find its backup-set membership through V$BACKUP_REDOLOG. The next question concerns the pieces holding that set and their recorded status. Finally, restore validation and a recovery rehearsal provide evidence that goes beyond these metadata queries. Each step answers a different question; none should be silently substituted for the others.
The following views describe backup and recovery metadata[1] or current operational conditions. Several views describe different parts of the same backup. A backup set is a logical container, a piece is a physical output, and a datafile or archived-log entry identifies content within the set.
| View | What it helps explain |
|---|---|
V$ARCHIVED_LOG | Archived redo records, thread and sequence identity, destinations, times, and recorded status. |
V$BACKUP_SET | Completed backup-set metadata, including type, incremental level, piece count, and timing. |
V$BACKUP_PIECE | Physical backup pieces, handles, device types, tags, recorded status, and bytes. |
V$BACKUP_DATAFILE | Datafiles and control files included in backup sets; FILE# = 0 identifies a control file. |
V$BACKUP_REDOLOG | Archived redo contained in backup sets, rather than only archived-log filenames on disk. |
V$DATAFILE_COPY | Repository records for datafile image copies. |
V$BACKUP_CORRUPTION | Corrupt block ranges recorded for datafile backups. |
V$COPY_CORRUPTION | Corrupt block ranges recorded for datafile copies. |
V$BACKUP_DEVICE | Information about supported backup devices, rather than an inventory of successful backup jobs. |
V$RMAN_BACKUP_JOB_DETAILS | Backup-job input types, status, timing, and performance information. |
V$SESSION_LONGOPS | Progress information for qualifying long operations, including RMAN operations. |
V$DATABASE_INCARNATION | Database incarnations and resetlogs history relevant to recovery identity. |
V$RECOVER_FILE | Information about files needing media recovery, subject to the control file's ability to describe the recovery state. |
V$RECOVERY_FILE_DEST | Fast recovery area quota, space used, reclaimable space, and file count. |
V$BACKUP | User-managed datafile backup-mode state; an active state is not an RMAN job-success indicator. |
The legacy table listed V$BACKUP_DATAFILE twice, once for control files and once for datafiles. Both describe valid uses of that view, so they are consolidated here. Additional specialized views include V$BACKUP_SPFILE for server parameter file backups, V$BACKUP_CONTROLFILE_DETAILS for control-file backup details, and V$CONTROLFILE_COPY for control-file copies. A backup-set record and an image-copy record describe different storage forms.
Begin a daily review with a bounded job query. It gives a quick account of RMAN backup activity and distinguishes input types such as database and archived-log backups. Examine warnings and failures, and compare the times with the expected schedule. An absent row needs investigation: the scheduler may not have started RMAN, the connection may be to another database, or the required history may no longer be present.
SELECT session_key, input_type, status, start_time, end_time
FROM v$rman_backup_job_details
WHERE start_time >= SYSDATE - 7
ORDER BY start_time DESC;
A completed job is useful evidence that the backup operation finished, but it does not prove every recovery objective is satisfied. A successful archived-log backup is not a replacement for an appropriate datafile backup. Review the job's purpose and the corresponding RMAN log, then inspect content and retention through the repository. Preserve the distinction between successful execution and the ability to restore to a chosen point.
Use V$BACKUP_SET with V$BACKUP_PIECE to report logical sets and physical outputs together. Join on both SET_STAMP and SET_COUNT. The set and piece views have their own record identifiers; joining their RECID values would not express this relationship.
SELECT s.set_stamp, s.set_count, s.backup_type,
s.incremental_level, p.piece#, p.copy#,
p.device_type, p.status, p.bytes,
p.completion_time, p.handle
FROM v$backup_set s
JOIN v$backup_piece p
ON p.set_stamp = s.set_stamp
AND p.set_count = s.set_count
WHERE p.completion_time >= SYSDATE - 7
ORDER BY p.completion_time DESC, p.piece#;
BACKUP_TYPE distinguishes archived logs (L), full datafile backups (D), and incremental backups (I). Read INCREMENTAL_LEVEL alongside it. Piece STATUS and BYTES come from V$BACKUP_PIECE, not V$BACKUP_SET. The handle identifies the piece for restore; a media-manager handle need not be an ordinary filesystem pathname.
This query returns piece rows, including distinct copy numbers where applicable. If you later join datafile-content rows, one piece can appear repeatedly because the set contains several files. Summing piece bytes after that join can inflate a storage total. Aggregate pieces separately before combining summaries with set contents, and decide whether duplexed copies should count separately in the report.
During an operation, V$SESSION_LONGOPS can help monitor qualifying work. Select relevant RMAN operations and interpret SOFAR, TOTALWORK, and UNITS together. A percentage describes that reported operation, not necessarily the complete backup job. RMAN can perform several phases and concurrent tasks, so a progress row reaching its total is not the same evidence as final job completion.
Storage reporting answers another question. The fast recovery area can contain archived redo and other recovery-related files competing for a configured quota. The following query makes the quota and current accounting visible without attempting to delete anything:
SELECT name, space_limit, space_used, space_reclaimable,
number_of_files
FROM v$recovery_file_dest;
The space values are bytes. SPACE_RECLAIMABLE represents space Oracle identifies as reclaimable under its rules; it is not permission to remove arbitrary files through operating-system commands. SPACE_USED includes files created in current and previous fast recovery areas, so changing the destination does not reset this accounting to zero. Review RMAN policies and recovery requirements when diagnosing pressure.
V$RECOVER_FILE helps investigate files that need media recovery. Interpret it with the control-file state and RMAN diagnostics, particularly when a restored or recreated control file cannot supply a complete picture. Corruption views also report recorded findings, rather than certifying that every unlisted block has been checked. Relate findings in V$BACKUP_CORRUPTION, V$COPY_CORRUPTION, and V$DATABASE_BLOCK_CORRUPTION to the actual validation or backup operation that discovered them.
Finally, V$BACKUP concerns user-managed backup mode. Seeing ACTIVE is a reason to investigate that mode and the associated procedure; it does not mean an RMAN backup is running successfully. Using the wrong view for a dashboard can turn an abnormal operational condition into a false success signal.
RMAN can perform many backup and recovery operations using the target control file without a recovery catalog. The catalog adds a separate repository that can store metadata for multiple registered databases and support a longer reporting history. Query catalog views such as RC_BACKUP_SET and RC_BACKUP_REDOLOG through the authorized catalog connection when the question spans registered databases or exceeds the target's available history.
The control file does not have a fixed one-year backup-history limit. CONTROL_FILE_RECORD_KEEP_TIME specifies the minimum age before circularly reusable records can be reused. Oracle 26ai documents a default of seven days and a range of zero through 365 days. This parameter controls metadata reuse behavior; it is separate from the RMAN backup retention policy. It does not tell you how long physical backups must be kept or guarantee that a particular report has complete historical coverage.
A recovery catalog does not automatically preserve perfect history forever. Resynchronization transfers metadata, and catalog maintenance, access, and protection remain operational responsibilities. Once required records have been lost from the target repository, a later resynchronization cannot simply reconstruct that missing history. Plan synchronization and catalog backups alongside the database backup strategy.
Catalog records use database and incarnation keys appropriate to a multi-database repository. Do not assume that a target view's record number equals a catalog primary key. Include database identity and incarnation when joining or exporting catalog information. In a shared catalog, use the approved virtual private catalog arrangement when users should see only authorized databases. Reporting convenience does not justify exposing other tenants' backup metadata.
A practical review starts by confirming the database and observation time, checking recent jobs, locating backup pieces and contents, and examining the redo needed for the recovery objective. RMAN LIST provides repository inventories, while REPORT evaluates questions such as backup need or obsolescence. These commands complement SQL reports with RMAN's own interpretation of its repository and policies.
Use an appropriately scoped CROSSCHECK when you need to reconcile recorded availability with accessible storage; it updates repository status and is not a full block-reading validation. Plan RESTORE ... VALIDATE for the relevant restore inputs when stronger evidence is required. A recovery rehearsal in an isolated environment tests the broader process, including access, required files, and the selected target. Keep the report, RMAN output, and rehearsal result together so their limits remain clear.
The purpose of these views is to make backup and recovery decisions traceable. A good report shows which repository was queried, what the rows mean, and which subsequent check supports a claim of recoverability. Avoid deletion rules based solely on a positive backup count, a completed job, or an empty corruption view. Use the established RMAN policies and verified recovery requirements to guide operational action.
[1] Metadata: Information describing database files, backup objects, jobs, and other database structures or operations.