Oracle8i Recovery Manager User's Guide and Reference Release 2 (8.1.6) Part Number A76990-01 |
|
This chapter describes how to manage the RMAN repository. Depending on how you implement RMAN, you can store this data either in the recovery catalog or exclusively in the control file. The chapter includes the following topics:
To use a recovery catalog, you need to set up the schema. Oracle suggests you put the recovery catalog schema in its own tablespace; however, you can put it in the SYSTEM tablespace if necessary. Note that SYS cannot be the owner of the recovery catalog.
Install the recovery catalog schema in a different database from the target database you will be backing up. If you do not, the benefits of using a recovery catalog are lost if you lose the database and need to restore.
Assume the following for the examples below:
catalog.sql
and catproc.sql
have successfully run.
"Connecting to RMAN" to learn how to connect to RMAN, and "Deciding Whether to Use a Recovery Catalog" to learn about the advantages and disadvantages of maintaining a recovery catalog.
See Also:
SQL> CONNECT sys/change_on_install@rcat
SQL> SPOOL create_rman.log
SQL> CREATE USER rman IDENTIFIED BY rman 2> TEMPORARY TABLESPACE temp 3> DEFAULT TABLESPACE cattbs 4> QUOTA UNLIMITED ON cattbs;
SQL> GRANT recovery_catalog_owner TO rman;
SQL> GRANT connect, resource TO rman;
create_rman.log
file for any errors before continuing. For example, a UNIX user can issue:
SQL> host % vi create_rman.log
% rman catalog rman/rman@rcat
You can also connect from the RMAN prompt:
% rman RMAN> connect catalog rman/rman@rcat
RMAN> create catalog tablespace cattbs;
Note that the creation of the catalog can take several minutes.
create_rman.log
file for any errors before continuing. For example, a UNIX user can issue:
RMAN> host; % vi create_rman.log
SQL> SELECT table_name FROM user_tables;
See Also:
Oracle8i SQL Reference for the SQL syntax for the GRANT and CREATE USER statements, and "createCatalog" for create catalog command syntax. |
For RMAN to function effectively, the RMAN executable and recovery catalog versions must be compatible. Compatibility between RMAN and the recovery catalog is determined by two factors:
The compatible parameter specifies the minimum acceptable release of the RMAN executable that can function with the catalog. For example, if the recovery catalog compatibility is set to 8.1.4, then only an RMAN executable of release 8.1.4 or later can connect to the catalog.
You cannot set the compatible parameter to a version that is not supported by the currently-installed DBMS_RCVMAN or DBMS_RCVCAT packages. If you try to set compatibility to a version that is not supported by one of the packages, then you receive an error message that indicates the lowest and highest value you can set, as in the following example:
RMAN> configure compatible = 8.0.1; RMAN-03022: compiling command: configure RMAN-03026: error recovery releasing channel resources RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure during compilation of command RMAN-03013: command type: configure RMAN-06455: illegal compatible value 8.0.1: must be between 08.00.04 and 08.01.06
The compatibility level of the catalog affects the way that repository records are updated and deleted, as explained in the following table:
The following table illustrates possible catalog creation and upgrade scenarios for a release 8.1.6 RMAN executable:
You can manually increase (but not decrease) the compatibility level of the catalog. For example, if you upgrade the catalog so that compatibility is automatically set to 8.0.4, then you can manually increase compatibility to 8.1.5.
The following table illustrates scenarios involving manual increase of compatibility levels in a release 8.1.6 recovery catalog:
If you set catalog compatibility to | Then you cannot use an RMAN executable of release |
---|---|
8.1.6 |
8.1.5 or lower |
8.1.5 |
8.1.4 or lower |
8.0.6 |
8.0.5 or lower |
SQL> connect rman/rman@rcat
SQL> SELECT value FROM config WHERE name='compatible'; VALUE -------------------------------------------------------------------------------- 080106
This procedure assumes that you have the use of both an 8.1.6 and pre-8.1.6 RMAN executable. The method employed it to use a pre-8.1.6 RMAN executable to create the recovery catalog, and a release 8.1.6 RMAN executable to upgrade it. The compatibility level is automatically set to 8.0.4, which has the implications described in Table 3-1.
% rman catalog rman/rman@rcat Recovery Manager: Release 8.1.5.0.0 RMAN-06008: connected to recovery catalog database
RMAN> create catalog; RMAN> exit
% rman catalog rman/rman@rcat Recovery Manager: Release 8.1.6.0.0 RMAN-06008: connected to recovery catalog database
RMAN> upgrade catalog; RMAN> exit
The compatibility level of the recovery catalog is now automatically set to 8.0.4.
This procedure assumes that you have an 8.1.6 recovery catalog that can function with a pre-8.1.6 RMAN executable. This procedure increases the compatibility level of the recovery catalog:
SQL> connect rman/rman@rcat SQL> SELECT value FROM config WHERE name='compatible'; VALUE -------------------------------------------------------------------------------- 080004
% rman target / catalog rman/rman@rcat Recovery Manager: Release 8.1.6.0.0 RMAN-06005: connected to target database: RMAN (DBID=1237603294) RMAN-06008: connected to recovery catalog database
RMAN> configure compatible = 8.1.5;
SQL> connect rman/rman@rcat SQL> SELECT value FROM config WHERE name='compatible'; VALUE -------------------------------------------------------------------------------- 080105
The recovery catalog will not work with an RMAN executable from a release below the value specified with the configure compatible command.
This section describes how to manage the RMAN information repository. It assumes that you are using a recovery catalog. If you use a control file as the exclusive repository for RMAN metadata, then most RMAN maintenance commands continue to work.
See Also:
"Understanding Catalog-Only Command Restrictions" for a list of commands that are unavailable when you use the control file as the sole repository. |
This section includes the following topics:
Before using RMAN with a target database, register the target database in the recovery catalog. If you do not, RMAN cannot use the recovery catalog to store information about the target database. RMAN obtains all information it needs to register the target database from the database itself. You can register more than one target database in the same recovery catalog, but you can register a database only once in the same catalog.
% rman target / catalog rman/rman@rcat
startup mount;
register database;
'/os_backup/df1.b'
by issuing the following command:
catalog datafilecopy '/os_backup/df1.b';
For an Oracle7 backup to be usable for recovery in database of a later version, it must have been part of a tablespace that was offline normal or read-only when the database was migrated. See "Cataloging Operating System Backups".
log1
etc. refers to the fully specified filename for an archived log):
catalog archivelog 'log1', 'log2', 'log3', ... 'logN';
See Also:
"register" for register command syntax, and Oracle8i Migration for issues relating to database migration. |
Oracle uses an internal, uniquely generated number called the db identifier to distinguish one database from another. Oracle generates this number when you create the database.
Typically, each database has a unique identifier; however, an exception occurs with databases that you create by copying files from an existing database instead of using a CREATE DATABASE statement or duplicate command. In such cases, RMAN detects the duplicate database identifiers and the register database command fails. Avoid this problem by using the duplicate command, which copies the database from backups and generates a new database identifier.
If a failure occurs because of duplicate database identifiers, you can create a second recovery catalog in another user's schema by re-executing the create catalog command using a different Oracle userid. Then, you can register the database with a duplicate database identifier into the newly created recovery catalog in the new schema.
See Also:
|
RMAN allows you to unregister a database as well as register it. Make sure this procedure is what you intend, because afterwards RMAN can longer recover all the backups for the unregistered database.
DBID
value that is displayed when you use RMAN to connect to your target database. For example, enter:
% rman target sys/change_on_install@prod1 nocatalog
RMAN-06005: connected to target database: RMAN (DBID=1231209694)
RMAN> list backup of database; RMAN-03022: compiling command: list List of Backup Sets Key Recid Stamp LV Set Stamp Set Count Completion Time ------- ---------- ---------- -- ---------- ---------- ---------------------- 989 1 368895909 0 368895908 1 23-JUN-99 List of Backup Pieces Key Pc# Cp# Status Completion Time Piece Name ------- --- --- ----------- ---------------------- ------------------------ 990 1 1 AVAILABLE 23-JUN-99 /vobs/oracle/dbs/01avppt4_1_1 List of Datafiles Included File Name LV Type Ckp SCN Ckp Time ---- ------------------------------------- -- ---- ---------- ------------- 2 /vobs/oracle/dbs/tbs_02.f 0 Full 34968 23-JUN-99
allocate channel for maintenance type disk; change backupset 989 delete; RMAN-03022: compiling command: change RMAN-08073: deleted backup piece RMAN-08517: backup piece handle=/vobs/oracle/dbs/01avppt4_1_1 recid=1 stamp=368895908 RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete
list backup; RMAN-03022: compiling command: list
SQL> SELECT db_key, db_id FROM db WHERE db_id = 1231209694;
This query should return exactly one row.
DB_KEY DB_ID ---------- ---------- 1 1237603294 1 row selected.
SQL> EXECUTE dbms_rcvcat.unregisterdatabase(db_key, db_id)
For example, enter:
SQL> EXECUTE dbms_rcvcat.unregisterdatabase(1 , 1237603294)
Before you can use RMAN again with a target database that you have opened with the RESETLOGS option, notify RMAN that you have reset the database incarnation. The reset database command directs RMAN to create a new database incarnation record in the recovery catalog. This new incarnation record indicates the current incarnation. RMAN associates all subsequent backups and log archiving done by the target database with the new database incarnation.
If you issue the ALTER DATABASE OPEN RESETLOGS statement but do not reset the database, then RMAN cannot access the recovery catalog because it cannot distinguish between a RESETLOGS command and an accidental restore of an old control file. By resetting the database, you inform RMAN that the database has been opened with the RESETLOGS option.
In the rare situation in which you wish to undo the effects of opening with the RESETLOGS option by restoring backups of a prior incarnation of the database, use the reset database to incarnation key command to change the current incarnation to an older incarnation.
list incarnation;
List of Database Incarnations DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time ------- ------- ------- ------ --- ---------- ---------- 1 2 PROD1 1224038686 NO 1 02-JUL-98 1 582 PROD1 1224038686 YES 59727 10-JUL-98
reset database to incarnation 2;
run { allocate channel ch1 type disk; restore database; recover database; alter database open resetlogs; }
The unavailable option provides for cases when a backup or copy cannot be found or has migrated offsite. A file that is marked UNAVAILABLE is not used in a restore or recover command. If the file is later found or returns to the main site, then you can mark it available again by using the available operand. Note that you do not need to allocate a channel of type maintenance for this operation.
change datafilecopy '/oracle/backup/cf_c.f' unavailable; change backupset 12 unavailable;
change datafilecopy '/oracle/backup/cf_c.f' available; change backupset 12 available;
Because backups and copies can disappear from disk or tape or become corrupted, the RMAN metadata repository can contain outdated information. 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.
Use either the change ... crosscheck or crosscheck backup command to check the specified files. Note that these commands do not delete operating system files or remove repository records; you must use separate commands for those operations.
The following table explains the difference between the crosscheck commands:
See Also:
"Deleting Backups and Copies and Updating Their Status in the RMAN Repository" to learn how to delete files and update repository records, and "crosscheck" for crosscheck command syntax. |
Use the crosscheck feature to check the status of a backup on disk or tape. If the backup is on disk, the change backupset ... crosscheck and crosscheck backup commands determine whether the header of the backup piece is valid; if on tape, the commands simply check that the backups exist.
If a backup piece is unreadable or absent, then RMAN marks the backup piece EXPIRED in the output of the list command and the recovery catalog views. If it was marked EXPIRED but is now available, RMAN marks the backup piece as AVAILABLE in the output of the list command and the recovery catalog views.
Use change backupset ... crosscheck when you want to provide a list of backup sets or pieces to check; use crosscheck backup when you wish to restrict the crosscheck to a specified device type, object type, or date range and let RMAN generate the list of backup sets or pieces.
allocate channel for maintenance type 'sbt_tape';
list backup;
RMAN> change backupset 1338, 1339, 1340 crosscheck;
RMAN-03022: compiling command: change RMAN-08074: crosschecked backup piece: found to be 'EXPIRED' RMAN-08517: backup piece handle=/oracle/dbs/2eafnuj3_1_1 recid=77 stamp=352057957 RMAN-08074: crosschecked backup piece: found to be 'AVAILABLE' RMAN-08517: backup piece handle=/oracle/dbs/2dafnuj2_1_1 recid=78 stamp=352057957 RMAN-08074: crosschecked backup piece: found to be 'AVAILABLE' RMAN-08517: backup piece handle=/oracle/dbs/2fafnuj3_1_1 recid=79 stamp=352057960
If a backup set is no longer available, RMAN marks it as EXPIRED. If it was marked EXPIRED and is now available, RMAN marks it AVAILABLE.
release channel;
allocate channel for maintenance type 'sbt_tape';
For example, check all backups of datafile tbs_8.f
over the last six months:
crosscheck backup of datafile "/oracle/dbs/tbs_8.f" completed after 'SYSDATE-180';
If a backup set is no longer available, RMAN marks it as EXPIRED. If it was marked EXPIRED and is now available, RMAN marks it AVAILABLE.
release channel;
Use the change ... crosscheck command to determine whether image copies of datafiles, control files, or archived redo logs on disk or tape are valid. If RMAN is unable to find the specified image copy or archived redo log, it updates its status to DELETED.
See Also:
Chapter 11, "Recovery Catalog Views" for information about recovery catalog views that you can query for copies and logs with DELETED status. |
RMAN considers archived redo logs as image copies. If for some reason one or more archived redo logs becomes unavailable, issue a change archivelog all crosscheck command so that RMAN updates the STATUS column of the absent logs to DELETED. You do not need to use a recovery catalog to execute this command.
% rman target / nocatalog % rman target / catalog rman/rman@rcat
list copy of database archivelog all;
List of Datafile Copies Key File S Completion time Ckp SCN Ckp time Name ------- ---- - --------------- ---------- ---------- ------ 1262 1 A 18-AUG-98 219859 14-AUG-98 /oracle/dbs/copy/tbs_01.fList of Archived Log Copies Key Thrd Seq S Completion time Name ------- ---- ------- - --------------- ------------------------------------ 789 1 1 A 14-JUL-98 /oracle/work/arc_dest/arcr_1_1.arc 790 1 2 A 11-AUG-98 /oracle/work/arc_dest/arcr_1_2.arc 791 1 3 A 12-AUG-98 /oracle/work/arc_dest/arcr_1_3.arc
change datafilecopy 1262 crosscheck;
RMAN-03022: compiling command: change RMAN-06154: validation succeeded for datafile copy RMAN-08513: datafile copy filename=/oracle/dbs/copy/tbs_01.f recid=1 stamp=351194732
If RMAN is unable to validate the copy, you will see:
RMAN-06153: validation failed for datafile copy
% rman target / nocatalog % rman target / catalog rman/rman@rcat
change archivelog all crosscheck;
See Also:
|
You can use RMAN to delete backups, copies, and archived logs and update their status in the repository to DELETED status or remove the records entirely.
Table 3-2 describes the functionality of the maintenance commands and scripts:
Command or Script | Need Cat? | Purpose |
---|---|---|
change ... uncatalog |
Yes |
To remove the record of a specified backup or copy from the recovery catalog. This command does not delete physical backups or copies: it only removes their records. |
|
Yes |
To remove all records of backups or copies with status DELETED from the catalog at one time. The script does not delete physical backups or copies: it only removes their records. |
delete expired backup |
Yes |
To remove backup set repository records with status EXPIRED. RMAN also physically deletes any expired backups if they still exist. Typically, you issue this command after performing a crosscheck. A crosscheck marks inaccessible backups as EXPIRED. |
change ... delete |
No |
To delete physical backups and image copies and remove their records from the repository. If you use a recovery catalog, and the catalog compatibility level is below 8.1.6, this command deletes archived logs and updates their repository records to status DELETED. If the compatibility level is 8.1.6 or higher, this command deletes archived redo logs and removes their repository records. Unlike the delete expired command, change ... delete operates on any backup or copy--not just those marked EXPIRED. See Also: "Setting Recovery Catalog Compatibility". |
backup archivelog ... delete input |
No |
If the catalog compatibility level is below 8.1.6, this command deletes archived logs and marks their repository records to status DELETED. If the recovery catalog compatibility is 8.1.6 or higher, this command deletes archived redo logs and removes their repository records. See Also: "Setting Recovery Catalog Compatibility". |
|
No |
To delete obsolete physical backup sets, image copies, or archived redo logs and either remove their records or update their repository records to status DELETED. See Also: change ... delete for a description of the affect of the script on the repository. Note: This script works only on UNIX systems. |
See Also:
|
allocate channel for maintenance type disk;
datafile 1
from the repository:
change controlfilecopy '/oracle/backup/cf_c.f' uncatalog; change datafilecopy '/oracle/backup/df_1_c.f' uncatalog;
release channel;
This procedure does not require the use of a recovery catalog.
The behavior of change ... delete differs depending on what you are deleting. If you are deleting backups and image copies (but not archived logs), then change ... delete deletes the physical files and removes the records for these files from the repository.
If you are deleting archived redo logs and you use a catalog, then the outcome of the following procedure depends on the compatibility setting of the recovery catalog (see "Setting Recovery Catalog Compatibility"), as explained in the following table:
list backup of database archivelog all; # lists backups of database files and logs list copy;
allocate channel for delete type disk;
This example deletes the backup piece with key 101, the control file copy with key 63, and all archived logs through log sequence 300 from disk:
change backuppiece 101 delete; change controlfilecopy 63 delete; change archivelog until logseq = 300 delete; # effect on catalog records for these # logs depends on compatibility setting
release channel;
This procedure does not require the use of a recovery catalog. The script below works only on UNIX systems.
$ORACLE_HOME/rdbms/demo
directory and edit the following shell script as needed:
% vi rman1.sh
% rman1.sh
deleted.log
to see the command output.
This procedure requires the use of a recovery catalog.
allocate channel for delete type disk;
delete expired backup;
If the expired pieces exist, RMAN removes them from the operating system.
release channel;
This procedure requires the use of a recovery catalog.
list copy;
This example removes records of copies of the control file and of the datafile copy with the primary key 4833:
change controlfilecopy '/oracle/backup/cf_c.f' uncatalog; change datafilecopy 4833 uncatalog;
Note that change ... uncatalog does not remove files from the operating system; it only removes recovery catalog records.
SQL> SELECT cdf_key, status FROM rc_datafile_copy WHERE cdf_key = 4833; CDF_KEY S ---------- - 0 rows selected.
To remove all copy and backup records from the recovery catalog:
You can remove all recovery catalog records of deleted backups and copies at once using the $ORACLE_HOME/rdbms/prgrmanc.sql
script. Only perform this operation if you do not want a historical record of what you have backed up.
allocate channel for maintenance type 'sbt_tape';
change backupset 100, 101, 102, 103 delete;
release channel;
% sqlplus rman/rman@rcat
prgrmanc.sql
script, which is stored in the $ORACLE_HOME/rdbms/admin
directory:
SQL> @prgrmanc.sql
RMAN removes all records with status DELETED from the recovery catalog.
allocate channel for maintenance type 'sbt_tape';
change backupset 100, 101, 102, 103 delete;
release channel;
% sqlplus rman/rman@rcat
SQL> SELECT * FROM rc_database_incarnation;
key_value
is the value of DBINC_KEY:
SQL> DELETE FROM dbinc WHERE dbinc_key=key_value;
RMAN will remove the specified incarnation records from the recovery catalog.
See Also:
"RC_DATABASE_INCARNATION" for more information about the RC_DATABASE_INCARNATION recovery catalog view. |
A restore validation executes a restore test run without actually restoring the files. Test the restore of the entire database or individual tablespaces, datafiles, or control files. The restore ... validate and validate backupset commands test whether you can restore backups or copies. You should use:
SQL> SELECT status FROM v$instance;
STATUS ------- OPEN 1 row selected. SQL> STARTUP FORCE MOUNT;
% rman target / catalog rman/rman@rcat
list backupset; list copy;
run { allocate channel ch1 type disk; allocate channel ch2 type tape; restore controlfile validate; restore tablespace 'system' validate; restore archivelog all validate; }
RMAN-06026: some targets not found - aborting restore
If you see an error message stack and output similar to the following, for example, then there is a problem with the restore of the specified file:
RMAN-03002: failure during compilation of command RMAN-03013: command type: restore RMAN-03007: retryable error occurred during execution of command: IRESTORE RMAN-07004: unhandled exception during command execution on channel c1 RMAN-10035: exception raised in RPC: ORA-19505: failed to identify file "oracle/dbs/1fafv9gl_1_1" ORA-27037: unable to obtain file status SVR4 Error: 2: No such file or directory Additional information: 3 RMAN-10031: ORA-19624 occurred during call to DBMS_BACKUP_RESTORE.RESTOREBACKUPPIECE
If you do not see an error stack, then RMAN successfully validated the files.
% rman target / catalog rman/rman@rcat
list backup of database archivelog all;
run { allocate channel ch1 type disk; validate backupset 1121; }
RMAN-08024
message then RMAN successfully validated the restore of the specified backup set.
RMAN-03022: compiling command: allocate RMAN-03023: executing command: allocate RMAN-08030: allocated channel: ch1 RMAN-08500: channel ch1: sid=10 devtype=DISK RMAN-03022: compiling command: validate RMAN-03023: executing command: validate RMAN-08016: channel ch1: starting datafile backupset restore RMAN-08502: set_count=47 set_stamp=346169465 creation_time=08-OCT-98 RMAN-08023: channel ch1: restored backup piece 1 RMAN-08511: piece handle=/vobs/oracle/dbs/1faa483p_1_1 params=NULL RMAN-08024: channel ch1: restore complete RMAN-08031: released channel: ch1
A stored script is a sequence of RMAN commands stored within the recovery catalog. It provides a common repository of frequently executed collections of RMAN commands.
For example, you can collect the RMAN commands needed to perform nightly backups into a single script called nightly_bkup
. Storing the script in the recovery catalog instead of in an operating system text file has the advantage that it is accessible to any DBA using RMAN, regardless of which machine RMAN is executed on.
RMAN allows you to:
% rman catalog rman/rman@rcat
create script b_whole{
allocate channel ch1 type disk;
allocate channel ch2 type disk;
backup database;
sql 'ALTER SYSTEM ARCHIVE LOG ALL';
backup archivelog all;
}
RMAN-08085
, then the script was successfully created and stored in the recovery catalog:
RMAN-03022: compiling command: create script RMAN-03023: executing command: create script RMAN-08085: created script b_whole
% rman target / catalog rman/rman@rcat
run { execute script b_whole; }
% rman target / catalog rman/rman@rcat
b_whole
with the following:
replace script b_whole { allocate channel ch1 type 'sbt_tape'; backup database; }
% rman catalog rman/rman@rcat
delete script 'b_whole';
rman_log
:
% rman target / catalog rman/rman@rcat log rman_log
print script b_whole;
RMAN> host; % vi rman_log
% sqlplus rman/rman@rcat
SQL> SELECT script_name FROM rc_stored_script; SCRIPT_NAME -------------------------------------------------------------------------------- backupdb binc binc1 3 rows selected.
When RMAN performs a resynchronization, it compares the recovery catalog to either the current control file of the target database or a backup control file and updates it with information that is missing or changed.
Resynchronizations can be full or partial. In a partial resynchronization, RMAN reads the current control file to update changed information, but does not resynchronize metadata about the database physical schema: datafiles, tablespaces, redo threads, rollback segments (only if the database is open), and online redo logs. In a full resynchronization, RMAN updates all changed records, including those for the database schema.
When resynchronizing, RMAN does the following:
RMAN performs partial or full resynchronizations automatically as needed when you execute certain commands (see "resync" for more information). To ensure a full resynchronization, issue a resync catalog command.
This section contains the following topics:
Table 3-3 describes the types of records that RMAN resynchronizes.
RMAN automatically performs full or partial resynchronizations as needed in certain situations. Execution of the following commands performs a full or partial resynchronization (depending on whether the schema metadata has changed) automatically when the target database control file is mounted and the recovery catalog database is available when the command is executed:
For example, if you execute a backup command you see partial resynchronization messages after the backup completes:
RMAN-08525: backup set complete, elapsed time: 00:00:02 RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete RMAN-08031: released channel: c1
Perform manual resynchronizations in the following scenarios.
If the recovery catalog is unavailable when you issue backup or copy commands, then open the catalog database later and resynchronize it manually using the resync catalog command.
If you are running in ARCHIVELOG mode, resynchronize the recovery catalog regularly because the recovery catalog is not updated automatically when a redo log switch occurs or when a redo log is archived. Instead, Oracle stores information about log switches and archived redo logs in the control file. You must propagate this information periodically into the recovery catalog.
How frequently you resynchronize the recovery catalog depends on the rate at which Oracle archives redo logs. The cost of the operation is proportional to the number of records in the control file that have been inserted or changed since the previous resynchronization. If no records have been inserted or changed, then the cost of resynchronization is very low. Thus, you can perform this operation frequently--for example, hourly--without incurring undue costs.
Resynchronize the recovery catalog after making any change to the physical structure of the target database. As with redo log archive operations, the recovery catalog is not updated automatically when a physical schema change is made.
A physical schema change occurs when you:
When resynchronizing from the current control file, RMAN automatically detects the records in the control file that have been updated and resynchronizes only those records. If the target database is open, then RMAN also updates information about rollback segments in the recovery catalog (this information is used for TSPITR).
When resynchronizing from a backup control file, RMAN does not verify that the backup pieces or file copies actually exist. Thus, you may need to use the change ... crosscheck and crosscheck commands to remove records for files that no longer exist.
Issue the resync catalog command to force a full resynchronization of the recovery catalog.
SQL> STARTUP pfile=initRCAT.ora
% rman target sys/change_on_install@prod1 catalog rman/rman@rcat
startup mount;
resync catalog;
RMAN-03022: compiling command: resync RMAN-03023: executing command: resync RMAN-08002: starting full resync of recovery catalog RMAN-08004: full resync complete
The recovery catalog is dependent on the target database control file for information. Consequently, the currency of the information in the control file determines the effectiveness of the recovery catalog.
The size of the target database's control file grows depending on the number of:
You can use the CONTROL_FILE_RECORD_KEEP_TIME parameter to specify the minimum number of days that Oracle keeps this information in the control file. Entries older than the number of days specified are candidates for overwrites by newer information. The larger the CONTROL_FILE_RECORD_KEEP_TIME setting, the larger the control file.
At a minimum, resynchronize your recovery catalog at intervals less than the CONTROL_FILE_RECORD_KEEP_TIME setting, because after the number of days specified in this parameter, Oracle overwrites the information in the control file with the most recently created information. If you have not resynchronized the recovery catalog, and Oracle has overwritten the information, then this information cannot be propagated to the recovery catalog.
See Also:
|
You can make RMAN aware of the existence of file copies that are created through means other than RMAN. This section contains the following topics:
If you do not make backups or image copies by using RMAN commands, then the recovery catalog has no record of them. You must manually notify RMAN when you make backups with an operating system utility. Use the RMAN catalog command to:
Catalog backups whenever:
Whenever you make a cold operating system backup, for example, by using the UNIX cp
command to copy a datafile, make sure to catalog it. Oracle8i supports the ALTER TABLESPACE ... BEGIN/END BACKUP command, which allows open database operating system backups. Although RMAN does not create such backups, you can add them to the recovery catalog so that RMAN is aware of them.
For a backup to be cataloged, it must be:
For example, if you store datafiles on mirrored disk drives, you can create an operating system copy by breaking the mirror. In this scenario, use the catalog command to notify RMAN of the existence of the operating system copy after breaking the mirror. Before reforming the mirror, issue a change ... uncatalog command to notify RMAN that the file copy is being deleted.
RMAN cannot catalog Oracle7 files, except in the following special circumstances. During the migration from Oracle7 to Oracle8i, you shut down your Oracle7 database cleanly prior to running the migration utility. At this time, you can take operating system backups of your Oracle7 datafiles and catalog the backups with RMAN: Oracle accepts them because no redo from the old database is required to recover them. RMAN can then restore those backups in your Oracle8i database if no other backups exist.
Following is a scenario that generates an Oracle7 backup that you can catalog with RMAN:
The pre-migration backups are identical to the backups that would be taken prior to migration, and may also be cataloged with RMAN.
Use the catalog command to propagate information about operating system backups to the recovery catalog.
% cp $ORACLE_HOME/dbs/sales.f $ORACLE_HOME/backup/sales.bak';
% rman target change_on_install@prod1 catalog rman/rman@rcat
catalog datafilecopy '$ORACLE_HOME/backup/sales.bak'; RMAN-03022: compiling command: catalog RMAN-03023: executing command: catalog RMAN-08050: cataloged datafile copy RMAN-08513: datafile copy filename=/oracle/backup/sales.bak recid=121 stamp=342972501 RMAN-03023: executing command: partial resync RMAN-08003: starting partial resync of recovery catalog RMAN-08005: partial resync complete
Include the recovery catalog in your backup and recovery strategy. If you do not back up your recover catalog and a disk crash occurs, you may lose some or all of your data. Avoid this unpleasant scenario by deciding how to back up and recover the recovery catalog.
This section contains the following topics:
When developing a strategy for backing up the recovery catalog, follow these guidelines:
Back up the recovery catalog with the same frequency that you back up your target database. For example, if you make a weekly whole database backup of your target database, then back up your recovery catalog immediately after each target database backup. The backed up catalog will have a record of the target backup preceding it, so if you are forced to restore the catalog you will also be able to use it to restore the target database backup.
When backing up the recovery catalog, you have a choice of making operating system or RMAN backups. The advantage of making operating system backups is that you can restore them using operating system methods without relying on RMAN or a recovery catalog. For operating system backup procedures, see Oracle8i Backup and Recovery Guide.
If you use RMAN to back up the recovery catalog database, consider how you will restore the recovery catalog in case of failure. For example, you can:
See Also:
Oracle8i Backup and Recovery Guide to learn how to back up the control file using SQL statements. |
Never store a recovery catalog containing the RMAN repository for a database in the same database as your target database. For example, do not store the catalog for database PROD1 in PROD1. A recovery catalog for PROD1 is only effective if it is separated from the data that it is designed to protect. If PROD1 suffers a total media failure, and the recovery catalog data for PROD1 is also stored in PROD1, then you have no catalog to aid in recovery.
This rule is especially important when you want to back up a recovery catalog database. Take a case in which database RCAT contains the recovery catalog repository for target database PROD1. You decide to use a recovery catalog to back up RCAT, but are not sure where to store this catalog. If you store the catalog containing the repository for RCAT in database RCAT itself, then if you lose RCAT because of a media failure you will have difficulty restoring RCAT and will leave PROD1 unprotected.
Use the Export utility to make convenient backups of your recovery catalog data. An export of the catalog allows the most flexibility when the recovery catalog must be restored, because it can be restored to any existing Oracle8i database.
For example, if the owner of the catalog in database PROD1 is RMAN, you can issue the following at the UNIX command line to export the catalog to file cat.dmp
:
% exp rman/rman@prod1 file=cat.dmp owner=rman
Export terminated successfully without warnings.
See Also:
Oracle8i Utilities to learn how to use the Export utility, and Oracle8i Backup and Recovery Guide to learn how to make operating system backups. |
The method you use to recover the catalog depends on the method you use to back it up. You have these options:
If you backed up the recovery catalog using operating system commands, then restore the backup of the catalog using operating system commands and issue SQL*Plus commands to recover it. The method you use depends on whether you are recovering the entire recovery catalog database or only the tablespace in which the recovery catalog is stored. For procedures, see Oracle8i Backup and Recovery Guide.
If you use RMAN to recover the catalog, then see Chapter 6, "Restoring and Recovering with Recovery Manager" for the relevant procedures.
If you used Export to make a logical backup of the recovery catalog, then use Import to recover it. If a media failure damages your recovery catalog database, do the following:
For example, assume the following:
If the recovery catalog database is lost or damaged, and recovery of the recovery catalog database through the normal Oracle recovery mechanisms is not possible, then you must re-create the catalog.
You have two options for partially re-creating the contents of the old catalog:
You can re-create information about backup sets only by using the resync catalog from controlfilecopy command, because the catalog command does not support re-cataloging of backup pieces or backup sets. RMAN does not verify that the files being re-cataloged still exist, so the resynchronization may add records for files that no longer exist. Remove such records by issuing change ... crosscheck or crosscheck backup commands.
See Also:
"change" for information about the change command, and "crosscheck" for information about the crosscheck command. |
If you use a version of the recovery catalog that is older than that required by the RMAN executable, then you must upgrade it. For example, you must upgrade the catalog if you use an 8.1 version of RMAN with an 8.0 recovery catalog.
You receive an error when issuing upgrade catalog if the recovery catalog is already at a version greater than that required by the RMAN executable. RMAN permits the upgrade catalog command to be run if the recovery catalog is current and does not require upgrading, however, so that you can re-create packages at any time if necessary. Check the message log for error messages generated during the upgrade.
% rman target / catalog rman/rman@rcat
RMAN-06008: connected to recovery catalog database RMAN-06186: PL/SQL package rcat.DBMS_RCVCAT version 08.00.04 in RCVCAT database is too old
RMAN> upgrade catalog
RMAN-06435: recovery catalog owner is rman RMAN-06442: enter UPGRADE CATALOG command again to confirm catalog upgrade
RMAN> upgrade catalog
RMAN-06408: recovery catalog upgraded to version 08.01.05 RMAN-06452: DBMS_RCVMAN package upgraded to version 08.01.05 RMAN-06452: DBMS_RCVCAT package upgraded to version 08.01.03
See Also:
|
If you do not want to maintain a recovery catalog, then you can drop the recovery catalog schema from the tablespace. The drop catalog command deletes all information from the recovery catalog. Hence, if you have no backups of the recovery catalog schema, then all backups of all target databases managed by this catalog become unusable.
The drop catalog command is not appropriate for "unregistering" a single database from a catalog that registers multiple target databases. If you try to delete the information for one target database by dropping the catalog, you delete the information for all target databases.
% rman target / catalog rman/rman@rcat
RMAN> drop catalog
RMAN-06435: recovery catalog owner is rman RMAN-06436: enter DROP CATALOG command again to confirm catalog removal RMAN> drop catalog
See Also:
"dropCatalog" for drop catalog command syntax, and "Unregistering a Database from the Recovery Catalog" to learn how to unregister a database from the catalog. |
RMAN works perfectly well without a recovery catalog. In fact, the recovery catalog receives its information from the control file. If you choose not to use a recovery catalog, however, you must perform the following tasks:
See Also:
If you choose not to use a recovery catalog, you can still use RMAN very effectively. RMAN obtains the information it needs from the control file of the target database. Nevertheless, some commands are not available when you use the control file as the sole repository of RMAN metadata. The following commands are only available when you use a recovery catalog:
To restore and recover your database without using a recovery catalog, Oracle recommends that you:
When you do not use a recovery catalog, the control file is the sole source of information about RMAN backups and copies. As you make backups and copies, Oracle adds new records to the control file. These records are circularly reused, which means that Oracle overwrites older records.
The following initialization parameter determines the minimum age in days of a record before it can be overwritten:
CONTROL_FILE_RECORD_KEEP_TIME = integer
For example, if the parameter value is 14, then any record aged 14 days and older is a candidate for reuse. Any information in an overwritten record is lost.
What happens when Oracle needs to add new records to the control file, but the oldest record is less than the value specified in CONTROL_FILE_RECORD_KEEP_TIME? The following steps occur:
alert.log
.
Assume the following scenario:
You make a backup of the database. Because Oracle cannot expand the control file beyond the operating system file size limit, it begins overwriting records in the control file, starting with those records aged 13 days. For each record that it overwrites, it records an entry in the alert.log
that looks something like the following:
krcpwnc: following controlfile record written over: RECID #72 Recno 72 Record timestamp 07/28/99 22:15:21 Thread=1 Seq#=3460 Backup set key: stamp=372031415, count=17 Low scn: 0x0000.3af33f36 07/27/99 21:00:08 Next scn: 0x0000.3af3871b 07/27/99 23:23:54 Resetlogs scn and time scn: 0x0000.00000001 08/05/98 10:46:44 Block count=102400 Blocksize=512
To guard against this type of scenario, use a recovery catalog. If you cannot use a catalog, then do the following if possible:
alert.log
to make sure that Oracle is not overwriting control file records.
RMAN provides several commands that allow you to check and delete records of backups as well as physically remove backups and copies. "Maintaining the RMAN Repository" provides a complete description of these maintenance procedures. Most of these commands work whether or not you use a recovery catalog.
For a list of the commands that require a catalog, see "Connecting to RMAN". You do not lose much in the way of maintenance functionality when you do not use a recovery catalog, because you can:
If you use the control file as the sole repository of the RMAN metadata, maintain alternate control files through multiplexing or operating system mirroring and back up the control file frequently. If you lose your control file and do not have a backup, you lose all information about RMAN backups and copies contained in the file.
To learn how to multiplex and mirror the control file and to make operating system backups of the control file, see Oracle8i Backup and Recovery Guide.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|