Oracle Recovery : Restoring the databaseOracle recovery makes is possible to restore a physical backup and reconstruct it, and make it available to the Oracle server.
To recover a restored datafile is to update it using redo records, i.e., records of changes made to the database after the backup was taken.
If you use Oracle Recovery Manager (RMAN), you can also recover restored datafiles with an incremental backup, which is a backup of a datafile that contain only changed data blocks.
Oracle performs crash recovery and instance recovery automatically after an instance failure.
Instance recovery is an automatic procedure that involves two distinct operations: rolling forward the backup to a more current time by applying online redo records and rolling back all changes made in uncommitted transactions to their original state.
The question is: What are the various methods to perform an Oracle recovery that can be used by the DBA?
There are three basic types of recovery:
Oracle performs the first two types of recovery automatically at instance startup and only media recovery requires you to issue commands.
Instance recovery, which is only possible in an OPS configuration, occurs in an open database when one instance discovers that another instance has crashed.
A surviving instance automatically uses the redo log to recover the committed data in the database buffers that was lost when the instance failed. Further, Oracle undoes any transactions that were in progress on the failed instance when it crashed and then clears any locks held by the crashed instance after the Oracle recovery is complete.
Crash recovery occurs when either single-instance database crashes or all instances of a multi-instance database crash.
In crash recovery, an instance must first open the database and then execute recovery operations. In general, the first instance to open the database after a crash or SHUTDOWN ABORT automatically performs crash recovery.
Unlike crash and instance recovery, media recovery is executed on your command.
In media recovery, you use online and archived redo logs and (if using RMAN) incremental backups to make a restored backup current or to update it to a specific time. It is called media recovery because you usually perform it in response to media failure.
As we know, recovery is the process of applying redo logs to the database to roll it forward. One can roll-forward until a specific point-in-time, which is before the disaster occurred, or roll-forward until the last transaction recorded in the log files, so the basic command used for recovery is:
sql: connect SYS as SYSDBA
The main tool used for Oracle recovery is Recovery Manager, which is a command line interface (CLI) that directs an Oracle server process to back up, restore or recover the database it is connected to.
The Recovery Manager program issues commands to an Oracle server process. The Oracle server process reads the datafile, control file or archived redo log being backed up, or writes the datafile, control file or archived redo log being restored or recovered.
When an Oracle server process reads datafiles, it detects any split blocks and re-reads them to get a consistent block.
Hence, you should not put tablespaces in hot backup mode when using Recovery Manager to perform open backups
Recovery Manager provides a way to:
To use RMAN, a recovery catalog is not necessary. RMAN will always use the control file of the target database to store backup and recovery operations. To use an Oracle recovery catalog, you will first need to create a recovery catalog database and create a schema for it.
The catalog (database objects) will be located in the default tablespace of the schema owner. The owner of the catalog cannot be the SYS user.
The Oracle recovery catalog database should be created on a different host, on different disks, and in a different database from the target database on which the backup is taken.
The first step is to create a database for the Oracle recovery catalog. Before proceeding, the database should have the following files installed:
The DBA will start by creating a database schema usually called rman. Assign an appropriate tablespace to it and grant it the recovery_catalog_owner role. The commands which are used for this procedure are:
Next, log in to rman and create the catalog schema.
rman catalog rman/rman
The DBA will now continue by registering the databases in the catalog:
rman catalog rman/rman target backdba/backdba
Grant the RECOVERY_CATALOG_OWNER role to the schema owner. This role provides the user with privileges to maintain and query the recovery catalog:
SQL: GRANT RECOVERY_CATALOG_OWNER TO rman;
Grant other desired privileges to the RMAN user:
SQL: GRANT CONNECT, RESOURCE TO rman;
After creating the catalog owner, now create the catalog itself by using the CREATE CATALOG command within the RMAN interface.
This command will create the catalog in the default tablespace of the catalog owner.
rman catalog rman/rman@catdb
RMAN: create catalog;
Before letting RMAN use a recovery catalog, register the target database(s) in the recovery catalog.
RMAN will obtain all information it needs to register the target database from the database itself. As long as each target database has a distinct DBID, it is possible to register more than one target database in the same recovery catalog.
Each database registered in a given catalog must have a unique database identifier (DBID), but not necessarily a unique database name.
It is also possible to remove or unregister a target database from the recovery catalog. It can be done by running the following procedure from the while logged into the recovery catalog:
SQL: execute dbms_rcvcat.unregisterdatabase(db_key, db_id)
To unregister a database, do the following:
Free eBookSubscribe to my newsletter and get my ebook on Entity Relationship Modeling Principles as a free gift:
What visitors say...
"I just stumbled accross your site looking for some normalization theory and I have to say it is fantastic.Read more Testimonials
I have been in the database field for 10+ years and I have never before come across such a useful site. Thank you for taking the time to put this site together."
Theory & Practice
SQL Server DBA
Install SQL Server
Database Normalization eBook:
Copyright © www.databasedesign-resource.com / Alf A. Pedersen
All rights reserved.
All information contained on this website is for informational purposes only.
Disclaimer: www.databasedesign-resource.com does not warrant any company, product, service or any content contained herein.
Return to top
The name Oracle is a trademark of Oracle Corporation.