Reporting "backup sets" and "datafile copies" in Oracle 12c is an essential task for any Oracle DBA to ensure data integrity and successful recovery operations. Here's the process to report these elements:
- Use RMAN (Recovery Manager) for Reporting:
Oracle's Recovery Manager (RMAN) is the primary tool for managing backup and recovery operations. To report on backup sets and datafile copies, you will utilize RMAN's reporting capabilities.
- Connecting to RMAN: First, connect to the target database and, if necessary, the recovery catalog database using RMAN. This can be done via the command line:
$ rman TARGET / CATALOG rman/rman@rcat
Replace `/` with appropriate credentials if needed.
- Reporting Backup Sets:
To report on backup sets, use the `LIST BACKUP` command. This command provides details about backup sets, including their contents and status. For instance:
RMAN> LIST BACKUP;
This command lists all backup sets. To refine your search, you can use additional options like `BY FILE`, `SUMMARY`, `of database`, etc.
- Reporting Datafile Copies: For reporting on datafile copies, use the `LIST COPY` command:
RMAN> LIST COPY;
This command lists all datafile copies. You can refine the output by specifying particular datafiles or using options like `TAG`, `LEVEL`, etc.
- Using REPORT Command: The `REPORT` command in RMAN is also useful for reporting on various aspects of backups and datafile copies. For example:
RMAN> REPORT NEED BACKUP;
This command reports which files need backup based on your retention policy.
- Check for Obsolete Backups: Regularly use the `REPORT OBSOLETE` command to identify backups that are no longer needed based on the retention policy:
RMAN> REPORT OBSOLETE;
- Output and Logging: The output of these commands can be viewed on the screen or redirected to a log file for record-keeping. To direct output to a log file, start RMAN with the `LOG` option:
$ rman TARGET / LOG /tmp/rman.log
- Custom Scripts and Automation:For regular reporting, consider developing custom scripts that encapsulate these RMAN commands. Automation can be set up using cron jobs or other scheduling tools.
- Reviewing and Analyzing Reports: Regularly review the reports generated by these commands. Ensure that all required datafiles and backup sets are present and accounted for.
- Staying Updated with Oracle Documentation: Always refer to the latest Oracle documentation for any updates or changes in command syntax or features, as Oracle periodically updates its software.
Following these steps will ensure thorough reporting of backup sets and datafile copies, contributing significantly to the database's integrity and availability in Oracle 12c environments.
You can report backup sets, backup pieces and datafile copies that are obsolete, those which are not needed to meet a specified retention policy, by specifying the OBSOLETE keyword. To report obsolete backups:
- Start RMAN and connect to a target database and recovery catalog (if used).
- Execute the CROSSCHECK command to update the status of backups in the repository compared to their status on disk.
In the simplest case, you could crosscheck all backups on disk, tape or both, using any one of the following commands:
CROSSCHECK BACKUP DEVICE TYPE DISK;
CROSSCHECK BACKUP DEVICE TYPE sbt;
CROSSCHECK BACKUP;
#crosshecks all backups on all devices
- Run REPORT OBSOLETE to identify which backups are obsolete because they are no longer needed for recovery.
If you do not specify any other options, then REPORT OBSOLETE displays the backups that are obsolete according to the current retention policy, as shown in the following example: