Resynchronizing the Recovery Catalog
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 the recovery catalog with information that is missing of has changed. When resynchronizing RMAN does the following:
- Creates a snapshot controfile
- Compares the recovery catalog to the snapshot control file
- Updates the recovery catalog with missing or changed information
RMAN performs resynchronization automatically as needed when you execute certain commands, including BACKUP. You can also manually perform a full resynchronization using the RESYNC CATALOG command.
Types of Records Updated When The Recovery Catalog is Resynchronized
- Log History – created when an online redo log switch occurs
- Archived Redo Logs – associated with archived logs that were created by archiving an online log, copying an existing archived redo log, or restoring an archived redo log backup set. RMAN tracks this information so that is knows which archived logs it should expect to find
- Backup History – associated with backup sets, backup pieces, proxy copies and file copies. The RESYNC CATALOG command updates these records when a BACKUP command is executed
- Incarnation History – associated with database incarnations
- Physical schema – associated with datafiles and tablespaces. If the target database is open, then undo segment information is also updated. Physical schema information in the recovery catalog is updated only when the target has the current control file mounted. If the target database has mounted a backup control file, a freshly created control file, or a control file that is less current than a current file that was previously seen, then the physical schema information in the recovery catalog is not updated. Physical schema information is also not updated when you use the RESYNC CATALOG FROM CONTROLFILECOPY command.
Full and Partial Resynchronization
Resynchronization can be full or partial. In a partial resynchronization, RMAN reads the current control file to update changed information about new backups, new archived logs, and so forth. However, RMAN does not synchronize metadata about the database physical schema: datafiles, tablespaces, redo threads, rollback segments (only if the database is open), and offline redo logs. In a full resynchronization, RMAN updates all changed records, including those for the database schema.
Note: Although RMAN performs partial resynchronizations when using a backup control file, it does not perform full resynchronizations. A backup control file may not have correct information about the database physical schema, so a full resynchronization could update the recovery catalog with incorrect information.
When To Resynchronize the Recovery Catalog
RMAN automatically performs a full or partial resynchronization in most situations in which they are needed. Most RMAN commands such as BACKUP, DELETE and so forth perform 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. Thus, you should not need to manually run RESYNC CATALOG very often if ever.
Resynchronizing After the Recovery Catalog is Unavailable
If the recovery catalog is unavailable when you issue RMAN commands that cause a partial resynchronization, then open the catalog database later and resynchronize it manually with the RESYNC CATALOG command.
For example, the target database may be in Dallas, TX while the recovery catalog is in Florida. You may not want to make daily backups of the target database in CATALOG mode, to avoid depending on the availability of a geographically distant database. In such a case you could connect to the catalog as often as feasible (for example, once a week) and run the RESYNC CATALOG command.
Resynchronizing in ARCHIVELOG Mode When You Back Up Infrequently
Assume that you do the following:
- Run the database in ARCHIVELOG mode
- Backup the database infrequently (for example, hundreds of archive logs are archived between database backups)
- Generate a high number of log switches every day (for example, 1000 switches between catalog resynchronizations)
In this case, you may want to manually 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. The database stores information about log switches and archived redo logs only in the control file. You must periodically resynchronize in order to propagate this information into the recovery catalog.
How frequently you need to resynchronize the recovery catalog depends on the rate at which the database 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; if many records have been inserted or changed, then the resynchronization is more time-consuming.
Resynchronizing After Physical Database Change
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 after physical schema changes, such as adding or dropping tablespaces, adding datafiles to a tablespace, or adding or dropping rollback segments.
Forcing a Full Resynchronization of the Recovery Catalog
Use RESYNCT CATALOG to force a full resynchronization of the recovery catalog.
- Connect RMAN to the target and recovery catalog databases, and then mount or open the target database if not already mounted or open:
startup mount;
- Run the RESYNC CATALOG command at the RMAN prompt:
RESYNC CATALOG;
Resynchronizing the Recovery Catalog and CONTROL_FILE_RECORD_KEEP_TIME
If you maintain a recovery catalog, then use the RMAN RESYNC CATALOG command often enough to ensure that the control file records are propagated to the recovery catalog before they are reused.
Make sure that CONTROL_FILE_RECORD_KEEP_TIME is longer than the interval between backups or resynchronizations. Otherwise, control file records could be reused before they are propagated to the recovery catalog. An extra week is a safe margin in most circumstances.
Note: Never set CONTROL_FILE_RECORD_KEEP_TIME to 0. If you do, then backup records may be overwritten in the control file before RMAN is able to add them to the catalog.
Managing the Control File When You Use a Recovery Catalog
The goal is to ensure that the metadata in the recovery catalog is current. Because the recovery catalog obtains its metadata from the target control file, the currency of the data in the catalog depends on the currency of the data in the control file. You need to make sure that the backup metadata in the control file is recorded in the catalog before it is overwritten with new records.
The CONTROL_FILE_RECORD_KEEP_TIME initialization parameter determines the minimum number of days that records are retained in the control file before they are candidates for being overwritten. Hence, you must ensure that you resynchronize the recovery catalog with the control file records before these records are erased. You should perform either of the following actions at intervals less than CONTROL_FILE_RECORD_KEEP_TIME setting:
- Make a backup, thereby, performing an implicit resynchronization of the recovery catalog
- Manually resynchronize the recovery catalog with the RESYNC CATALOG command
So, to ensure the currency of the information in the recovery catalog, the frequency of resynchronizations should be related to the value for the CONTROL_FILE_RECORD_KEEP_TIME initialization parameter.
One problem can arise if the control file becomes too large. The size of the target database control file grows depending on the number of:
- Archived redo logs that the database generates
- Days that this information is stored in the control file
If the control file grows so large that it can no longer expand because it reached either the maximum number of blocks or the maximum number of records, then the database may overwrite the oldest records even if their age is less than the CONTROL_FILE_RECORD_KEEP_TIME setting. In this case, the database writes a message to the alert log. If you discover that this situation occurs frequently, then reducing the value of CONTROL_FILE_RECORD_KEEP_TIME and increase the frequency of resynchronizations will help to prevent that condition.
Note: The maximum size of the control file is port-specific. Typically, the maximum size is 20,000 Oracle blocks.