Oracle9i Recovery Manager User's Guide Release 2 (9.2) Part Number A96566-01 |
|
This chapter describes how to manage the RMAN repository. Depending on how you implement RMAN, you can store this data either in a recovery catalog or exclusively in the control file. This chapter contains these topics:
To ensure that data about backup sets and image copies in the recovery catalog or control file is synchronized with corresponding data on disk or in the media management catalog, perform a crosscheck. The CROSSCHECK
command operates only on files that are recorded in the recovery catalog or the control file.
This section contains these topics:
See Also:
"Crosschecks of RMAN Backups and Copies" for a conceptual overview of crosschecks |
Crosschecks can update outdated repository information about backups and copies whose repository records do not match their physical status. For example, someone removes archived logs from disk with an operating system command so that the repository indicates that the logs are on disk when in fact they have deleted.
If the backup or copy is on disk, then the CROSSCHECK
command determines whether the header of the file is valid. If the backup is on tape, then the command simply checks that the backup exists.
The possible status values for backups and copies are AVAILABLE
, UNAVAILABLE
, and EXPIRED
. View the output of the LIST
command or the recovery catalog views to determine the status of backups and copies.
Note: The |
See Also:
"Deleting Backups and Copies" to learn how to delete files and update repository records, and Oracle9i Recovery Manager Reference for |
You can use the LIST
command to obtain a report of the backups and copies that you have made and then use the CROSSCHECK
command to check that these files still exist. You can run the DELETE
EXPIRED
command to delete repository records for copies and backups that fail the crosscheck.
To crosscheck specified backups or copies:
LIST
command. For example, issue:
LIST BACKUP; LIST COPY;
MAINTENANCE
. Otherwise, skip this step. For example, issue:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK; ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
CROSSCHECK BACKUPSET 1338, 1339, 1340; CROSSCHECK BACKUPPIECE TAG = 'nightly_backup'; CROSSCHECK CONTROLFILECOPY '/tmp/control01.ctl'; CROSSCHECK DATAFILECOPY 113, 114, 115; CROSSCHECK PROXY 789;
If the backup or copy is no longer available, then RMAN marks it as EXPIRED
. If it was marked EXPIRED
and is now available, then RMAN marks it AVAILABLE
.
RELEASE CHANNEL;
You can use the LIST
command to determine which database objects that you have backed up or copied, then use the CROSSCHECK
command to check whether these backups and copies exist.
To crosscheck backups or copies of specified files:
MAINTENANCE
. Otherwise, skip this step. For example, issue:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK; ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
?/oradata/trgt/system01.dbf
over the last six months, as well as all logs and server parameter files on tape:
CROSSCHECK BACKUP OF DATAFILE "?/oradata/trgt/system01.dbf" COMPLETED AFTER 'SYSDATE-180'; CROSSCHECK BACKUP OF ARCHIVELOG ALL SPFILE;
RELEASE CHANNEL;
See Also:
Oracle9i Recovery Manager Reference for |
You can use RMAN to delete backups, copies, and archived logs. RMAN deletes the specified files and removes their repository records.
This section contains these topics:
Note: Note that backups and copies with |
See Also:
|
In general, use the DELETE
command to remove backups and copies that you no longer want to retain. This command removes the physical files, deletes the catalog records (if you use a catalog), and updates the records in the target control file to status DELETED
.
To delete backups and copies and remove their repository records:
This procedure does not require the use of a recovery catalog.
LIST
output to obtain primary keys of backups and copies.
LIST BACKUP OF DATABASE ARCHIVELOG ALL; # lists backups of db files and logs LIST COPY;
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
DELETE
command to eliminate the specified physical files and their repository records. You can delete any type of object in the recordSpec
clause, for example:
DELETE BACKUPPIECE 101; DELETE CONTROLFILECOPY '/tmp/control01.ctl'; DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 300;
DELETE
BACKUP
, DELETE
COPY
, or DELETE
ARCHIVELOG
as in these examples:
DELETE BACKUP OF TABLESPACE users DEVICE TYPE sbt; # deletes only tape backups DELETE COPY OF CONTROLFILE LIKE '/tmp/%'; # LIKE specifies name of the copy DELETE NOPROMPT BACKUP OF SPFILE COMPLETED BEFORE 'SYSDATE-7'; DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 3 TIMES TO sbt; # backs up logs only if already backed up 3X to tape
If you run RMAN interactively, then RMAN asks for confirmation before deleting any files. If you specify NOPROMPT
, then RMAN does not ask for confirmation.
RELEASE CHANNEL;
You can use the CROSSCHECK
command to determine whether backups and copies recorded in the repository still exist on disk or tape. If RMAN cannot locate the backups and copies, then it updates their records to EXPIRED
status. You can then use the DELETE
EXPIRED
command to remove these expired records. Note that if for some reason the expired files still exist, then the DELETE
EXPIRED
command aborts with an error message.
To delete expired repository records:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK; ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
CROSSCHECK
command. For example, issue:
CROSSCHECK BACKUP; CROSSCHECK COPY;
DELETE EXPIRED BACKUP; DELETE EXPIRED COPY;
RELEASE CHANNEL;
Use the DELETE
OBSOLETE
command to remove backups and copies that are obsolete, that is, eligible for deletion. You can determine what qualifies a backup or copy for obsolete status in these ways:
CONFIGURE
commandDELETE
OBSOLETE
commandThe DELETE
OBSOLETE
command removes both the physical files, deletes the catalog records (if you use a catalog), and updates the records in the target control file to status DELETED
.
If you specify the DELETE
OBSOLETE
command with no other operands, then RMAN deletes all obsolete backups and copies defined by the retention policy.
To delete backups and copies rendered obsolete by the retention policy:
REPORT
OBSOLETE
command can report on the obsolete status of backups and copies on disk as well as backups on tape. For example, enter:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt; ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
DELETE
OBSOLETE
command without any options to delete the objects defined as obsolete by the retention policy, for example:
DELETE OBSOLETE;
If you run RMAN interactively, then RMAN asks for confirmation before deleting any files. If you specify NOPROMPT
, then RMAN does not ask for confirmation.
RELEASE CHANNEL;
You can run the DELETE
OBSOLETE
REDUNDANCY
or DELETE
OBSOLETE
RECOVERY
WINDOW
commands to delete obsolete backups and copies. The redundancy or recovery window setting on the DELETE
command overrides setting on the CONFIGURE
RETENTION
POLICY
command.
To delete backups made obsolete by the DELETE OBSOLETE command:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
DELETE
OBSOLETE
command with the REDUNDANCY
or RECOVERY
WINDOW
options. These options define what is obsolete during the delete job. For example, enter:
DELETE OBSOLETE REDUNDANCY = 3; DELETE OBSOLETE RECOVERY WINDOW OF 7 DAYS;
RELEASE CHANNEL;
It is possible for the RMAN repository to indicate that an object has one status while the actual status of the object on the media is different. For example, the RMAN repository says that a backup set is AVAILABLE
when it is in fact missing from the media management catalog. If you attempt to delete the object, then you receive a warning such as the following:
RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due RMAN-06208: to mismatched status. Use CROSSCHECK command to fix status List of Mismatched objects ========================== Object Type Filename/Handle --------------- --------------------------------------------------- Backup Piece 0id270ud_1_1
You can force RMAN to delete any object and remove its repository record by specifying the FORCE
keyword. RMAN ignores any I/O errors. For example:
DELETE FORCE NOPROMPT BACKUPSET TAG 'weekly_bkup';
This section contains these topics:
You can configure or manually allocate multiple maintenance channels before issuing CROSSCHECK
or DELETE
commands. RMAN searches for each backup or copy on all channels that have the same device type as the channel used to create the backup. The multichannel feature is designed for use in these scenarios:
When you configure or manually allocate multiple maintenance channels and run a CROSSCHECK
or DELETE
command, RMAN performs the crosscheck or delete on all channels that have the appropriate device type.
For example, assume that you prefer to manually allocate channels rather than use configured channels. You have a media manager configured, but have not yet made backups to tape. You have created only one backup of a database to disk as follows:
RUN { ALLOCATE CHANNEL ch1 DEVICE TYPE DISK CONNECT 'SYS/sys_pwd@node2'; BACKUP DATABASE; }
Assume that you issue the following series of commands at the RMAN prompt:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK CONNECT 'SYS/oracle@node1'; AlLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK CONNECT 'SYS/oracle@node2'; ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt; CROSSCHECK BACKUP OF DATABASE;
RMAN checks the first two channels because they both have the device type of disk and finds the backup on the second channel. However, RMAN does not perform a crosscheck on the third sbt
channel because you have not yet made backups with a media manager.
RMAN can perform crosschecks on more than one media with a single command. Assume that you have an sbt
channel configured as follows:
CONFIGURE DEVICE TYPE sbt PARALLELISM 1; CONFIGURE DEFAULT DEVICE TYPE sbt;
In this case you can run the following command to perform a crosscheck on both DISK
and sbt
:
CROSSCHECK BACKUP OF DATABASE;
RMAN uses both the sbt
channel and the preconfigured DISK
channel to perform the crosscheck. Sample output follows:
allocated channel: ORA_SBT_TAPE_1 channel ORA_SBT_TAPE_1: sid=12 devtype=SBT_TAPE channel ORA_SBT_TAPE_1: WARNING: Oracle Test Disk API using channel ORA_DISK_1 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/oracle/dbs/16c5esv4_1_1 recid=36 stamp=408384484 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/oracle/dbs/c-674966176-20000915-01 recid=37 stamp=408384496 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=12c5erb2_1_1 recid=32 stamp=408382820 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=13c5erba_1_1 recid=33 stamp=408382829 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=14c5erce_1_1 recid=34 stamp=408382863 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=c-674966176-20000915-00 recid=35 stamp=408382869
If you do not have an automatic sbt
channel configured, then can also manually allocate maintenance channels on disk and tape as in the following example:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt; CROSSCHECK BACKUP OF DATABASE;
Note that you do not have to manually allocate a disk channel because RMAN uses the preconfigured disk channel.
This feature is useful in an Oracle Real Application Clusters configuration in which tape backups exist on various nodes in the cluster and are only visible on the nodes where they were created.
When crosschecking on multiple nodes, it is important to allocate channels at every node where backups were created. If you omit a channel for a node, or you set the parallelism to a value less than the number of nodes, then the backups created on that node will be marked EXPIRED
in the repository. For example, you can configure RMAN for use with Oracle Real Application Clusters nodes as follows:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2; CONFIGURE CHANNEL 1 DEVICE TYPE DISK CONNECT 'SYS/oracle@node_1'; CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT 'SYS/oracle@node_2';
Then, crosscheck the cluster nodes with the following command:
CROSSCHECK BACKUP;
You can also perform deletions on all allocated channels. In the following example, you configure an sbt
channel:
CONFIGURE DEVICE TYPE sbt PARALLELISM 1; CONFIGURE DEFAULT DEVICE TYPE TO sbt;
Then, you run a command to delete all backup sets from disk and tape:
DELETE BACKUPSET;
RMAN uses both the sbt
channel and the preconfigured DISK
channel when deleting (sample output follows). Note that RMAN prompts you for confirmation before deleting any files:
using channel ORA_SBT_TAPE_1 using channel ORA_DISK_1 List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 388 387 1 1 AVAILABLE SBT_TAPE 12c5erb2_1_1 397 396 1 1 UNAVAILABLE SBT_TAPE 13c5erba_1_1 424 423 1 1 AVAILABLE SBT_TAPE 14c5erce_1_1 428 427 1 1 AVAILABLE SBT_TAPE c-674966176-20000915-00 433 432 1 1 AVAILABLE DISK /oracle/dbs/16c5esv4_1_1 437 436 1 1 AVAILABLE DISK /oracle/dbs/c-674966176-20000915-01 Do you really want to delete the above objects (enter YES or NO)? y deleted backup piece backup piece handle=/oracle/dbs/16c5esv4_1_1 recid=36 stamp=408384484 deleted backup piece backup piece handle=/oracle/dbs/c-674966176-20000915-01 recid=37 stamp=408384496 deleted backup piece backup piece handle=12c5erb2_1_1 recid=32 stamp=408382820 deleted backup piece backup piece handle=13c5erba_1_1 recid=33 stamp=408382829 deleted backup piece backup piece handle=14c5erce_1_1 recid=34 stamp=408382863 deleted backup piece backup piece handle=c-674966176-20000915-00 recid=35 stamp=408382869
The following example manually allocates DISK
and sbt
maintenance channels and then deletes specific backup sets from both disk and tape:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK; ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt; DELETE BACKUPSET 1,2,3,4,5;
RMAN looks for the specified backup sets on the channels and deletes any it finds. If RMAN does not find a backup on any channel, then RMAN marks the object as deleted in the control file and deletes the recovery catalog record (if you use a recovery catalog).
You can release all allocated maintenance channels by running this command:
RELEASE CHANNEL;
Run the CHANGE
...
UNAVAILABLE
command when a backup or copy cannot be found or has migrated offsite. RMAN does not use files marked UNAVAILABLE
in RESTORE
or RECOVER
commands. If the file is later found or returns to the main site, then you can mark it available again by issuing CHANGE
...
AVAILABLE
.
This section contains these topics:
Run the CHANGE
...
UNAVAILABLE
command to mark a backup or copy as unavailable.
To mark a file's status in the repository as UNAVAILABLE:
LIST
command to determine the availability status of RMAN backups and copies. For example, issue:
LIST BACKUP; LIST COPY;
CHANGE
...
UNAVAILABLE
command to mark a backup or copy as UNAVAILABLE
in the RMAN repository. For example, enter:
CHANGE DATAFILECOPY '/tmp/control01.ctl' UNAVAILABLE; CHANGE COPY OF ARCHIVELOG SEQUENCE BETWEEN 1000 AND 1012 UNAVAILABLE; CHANGE BACKUPSET 12 UNAVAILABLE; CHANGE BACKUP OF CONTROLFILE UNAVAILABLE; CHANGE BACKUP OF SPFILE TAG "TAG20020208T154556" UNAVAILABLE;
Use the CHANGE
...
AVAILABLE
command to mark a backup or copy as available. Note that this command does not check for the existence of the files or validate the file in any way: it merely updates the repository record to AVAILABLE
. You can run CROSSCHECK
to validate the file.
To mark a file's status in the repository as AVAILABLE:
LIST
command to see which the availability status of RMAN backups and copies. For example, issue:
LIST BACKUP; LIST COPY;
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt; ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
CHANGE
...
AVAILABLE
command to mark it as AVAILABLE
in the RMAN repository. For example, enter:
CHANGE DATAFILECOPY '/tmp/system01.dbf' AVAILABLE; CHANGE BACKUPSET 12 AVAILABLE; CHANGE BACKUP OF SPFILE TAG "TAG20020208T154556" AVAILABLE;
See Also:
Oracle9i Recovery Manager Reference for |
The BACKUP
...
KEEP
command can archive a backup, potentially offsite, for longer than the time dictated by the user's retention policy. The backup is still a fully valid backup, however, and can be restored just as any other RMAN backup. This type of backup is called a long-term backup.
Specify KEEP
...
LOGS
to save archived logs for a possible incomplete recovery and KEEP
...
NOLOGS
not to save archived logs for a possible incomplete recovery. Note that NOLOGS
is not valid with an inconsistent backup.
Use the CHANGE
command to alter the KEEP
status of a backup or copy. For example, you may decide that you no longer want to keep a long-term backup. The same options available for BACKUP
...
KEEP
are available with CHANGE
...
KEEP
.
To alter the KEEP status of a backup or copy:
Alter the retention status of the backup or copy. Issue CHANGE
...
KEEP
to make the file exempt from the retention policy, and CHANGE
...
NOKEEP
to make the file conform to the retention policy. This example allows a backup set to be marked obsolete by the retention policy:
CHANGE BACKUPSET 231 NOKEEP;
This example makes a datafile copy exempt from the retention policy for 180 days (6 months):
CHANGE DATAFILECOPY '/tmp/system01.dbf' KEEP UNTIL 'SYSDATE+180';
You can make RMAN aware of the existence of archived logs that are not recorded in the repository as well as file copies that are created through means other than RMAN. This section contains the following topics:
The control file keeps records of all archived logs generated by the target database. If you use a recovery catalog, then RMAN propagates the archived log information from the control file to the catalog. If you have to restore a control file backup, and if you change the archiving destination or format during recovery, then the repository will not have information about archived logs needed for recovery. Hence, you must catalog these logs if you want to use them for recovery.
A different case occurs when you make user-managed copies, that is, copies made with operating system commands. In the case, the repository has no record of them. You must manually notify RMAN when you make copies with an operating system utility such as the UNIX cp
command.
Run the RMAN CATALOG
command when:
Catalog user-managed copies of database files in the following situations:
Whenever you make a user-managed copy, for example, by using the UNIX cp
command to copy a datafile, make sure to catalog it. When making user-managed copies, you can use the ALTER
TABLESPACE
...
BEGIN
/END
BACKUP
statement to make datafile copies off an online tablespace. Although RMAN does not create such datafile copies, you can use the CATALOG
command to add them to the recovery catalog so that RMAN is aware of them.
For a user-managed copy to be cataloged, it must be:
For example, if you store datafiles on mirrored disk drives, then you can create a user-managed copy by breaking the mirror. In this scenario, use the CATALOG
command to notify RMAN of the existence of the user-managed copy after breaking the mirror. Before reforming the mirror, run a CHANGE
...
UNCATALOG
command to notify RMAN that the file copy no longer exists.
RMAN cannot catalog Oracle7 files, except in the following special circumstances:
OFFLINE
NORMAL
or read-only at the time of the backup, and do not bring these tablespaces online or make them read/write again before migration.Oracle accepts these Oracle7 copies because no redo from the Oracle7 database is required to recover them. RMAN can then catalog and restore these copies in the Oracle9i database if no other backups exist.
The following scenario generates an Oracle7 datafile backup that you can catalog with RMAN:
cp
command or Windows COPY
command.The backups made before migration are identical to user-managed copies taken after migration, and so may be cataloged with RMAN.
See Also:
Oracle9i Database Migration to learn how to migrate an Oracle database |
Use the CATALOG
command to propagate information about user-managed copies to the recovery catalog.
To catalog a user-managed copy:
ALTER
TABLESPACE
BEGIN
/END
BACKUP
is necessary if the database is open and the datafiles are online while the backup is in progress. This example backs up an online datafile.
SQL> ALTER TALBESPACE users BEGIN BACKUP; % cp $ORACLE_HOME/oradata/trgt/users01.dbf /tmp/users01.dbf; SQL> ALTER TABLESPACE users END BACKUP;
CATALOG
command. For example, enter:
CATALOG DATAFILECOPY '/tmp/users01.dbf';
See Also:
Oracle9i Recovery Manager Reference for |
This section contains the following topics:
Run the CHANGE
...
UNCATALOG
command to perform the following actions on RMAN repository records:
DELETED
RMAN does not touch the specified physical files: it only alters the repository records for these files.
You can use this command when you have deleted a backup or copy through a means other than RMAN. For example, if you delete archived redo logs using an operating system utility, then remove the record for this log from the repository by issuing CHANGE
ARCHIVELOG
...
UNCATALOG
.
In releases prior to Oracle9i, RMAN sometimes updated the status of records to DELETED
in the recovery catalog rather than removing the records altogether. In Oracle9i, RMAN always removes the catalog record rather than marking it as DELETED
. Hence, catalog records should only be marked with status DELETED
if the catalog has been upgraded or the catalog was resynchronized from a backup control file. You can remove all repository records of backups and copies with status DELETED
using the prgrmanc.sql
script, which is located in an operating system specific location ($ORACLE_HOME/rdbms/admin
on UNIX).
To remove catalog records for files deleted with operating system utilities, use the CHANGE
...
UNCATALOG
command.
To remove the catalog record for a backup or copy deleted with an operating system utility:
CHANGE
...
UNCATALOG
command for the backups or copies that you deleted from the operating system with operating system commands. This example deletes repository references to copies of the control file and datafile 1
:
CHANGE CONTROLFILECOPY '/tmp/control01.ctl' UNCATALOG; CHANGE DATAFILECOPY '/tmp/system01.dbf' UNCATALOG;
RC_DATAFILE_COPY
or RC_CONTROLFILE_COPY
, to confirm that a given record was removed. For example, this query confirms that the record of copy 4833
was removed:
SELECT CDF_KEY, STATUS FROM RC_DATAFILE_COPY WHERE CDF_KEY = 4833; CDF_KEY STATUS ---------- ------ 0 rows selected.
Use the prgrmanc.sql
script to remove recovery catalog records with status DELETED
. In releases prior to Oracle9i, RMAN updated recovery catalog records to DELETED
status after deleting the physical files rather than removing the records.
In Oracle9i and later, RMAN always removes catalog records and never updates them to status DELETED
. However, records with status DELETED
can appear in the recovery catalog when you upgrade a catalog created prior to Oracle9i to the current release. For this special case, you can run the prgrmanc.sql
script.
To remove all copy and backup records with status DELETED:
rcat
as user rman
:
% sqlplus rman/cat@catdb
prgrmanc.sql
script, which is stored in an operating system specific location ($ORACLE_HOME/rdbms/admin
on UNIX):
SQL> @prgrmanc
The scripts removes all records with status DELETED
from the recovery catalog.
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|