How to restore and recover a database from an RMAN backup_881395.1
In this Document
Goal |
Fix |
Applies to:
Oracle Server - Enterprise Edition - Version 10.1.0.2 to 11.2.0.2 [Release 10.1 to 11.2]Information in this document applies to any platform.
Goal
The following note will guide a DBA through the process of restoring and recovering a database from an RMAN backup.
The following note will assist in a complete database restore. If you are only required to restore and recover a partial database ( ie datafiles/tablespace) please refer to note (coming soon)
Assumption
- A valid backup of the database is accessible.
- Required archive logs* to recover the database are available and accessible.
* Archive logs required are those generated from the start time of the backup until the completion of the backup if an online backup was performed.
Fix
How to restore a complete database from an RMAN backup
This note assumes an RMAN catalog is not available. The use of a catalog is optional in this scenario as the backup information is available in the controlfile.
In this example we will assume all files are required to be restored:
* Datafiles
* Controlfiles
* Archivelogs (In order to perform recovery)
Online redo logs and temp files are recreated automatically by RMAN when a resetlogs is issued. Online redo logs and temp files are not backed up by RMAN
Step 1 (Locate the controlfile to restore)
Note: If you do not need to restore a controlfile proceed to step 3.
* Locate the RMAN backup you wish to restore.
* These files should be located in the directory where they were backed up to.
* If you have the RMAN backup log available this will also be of assistance.
Within the RMAN backup log you will see the controlfile is backed up last the the piece handle is shown.
....
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2009/01/01 12:00:00
channel ORA_DISK_1: finished piece 1 at 2009/01/01 12:00:02
piece handle=/recovery_area/V11/backupset/2009_05_0 /o1_mf_ncsnf_TAG20090506T11_501tr0h7_.bkp tag=TAG20090506T11 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
If you do not have an RMAN backup log simply locate the last file RMAN backed up. This should contain the controlfile backup.
Step 2 (Restore the controlfile)
2a) If you DO NOT have a spfile.
If you do have an spfile or init.ora move to Step 2b
% rman target /
RMAN> startup nomount force;
You will see this message:
..
starting Oracle instance without parameter file for retrieval of spfile
..
At this point you can restore the spfile:
RMAN> restore spfile from '/recovery_area/V11/backupset/2009_05_05/o1_mf_ncsnf_TAG20_501tr0h7_.bkp';
RMAN> shutdown immediate;
Once the spfile has been successfully restored proceed to Step 2b.
2b)
Following the successful nomount of the instance you are ready to restore the
controlfile;
NOTE: The controlfile will be restored to the following location:
SQL> show parameter control_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /oradata/V11/control01.ctl
% rman target /
You will see the message:
connected to target database: V11 (not mounted)
RMAN> restore controlfile from '/recovery_area/V11/backupset/2009_05_06/o1_mf_ncsnf_TAG20090506T113947_501tr0h7_.bkp';
Starting restore at 2009/05/11 11:01:26
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=151 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oradata/V11/control01.ctl
Finished restore at 2009/05/11 11:01:27
In this example the controlfile has been restored to '/oradata/V11/control01.ctl'
Step 3 (Restore the Database)
Mount the database now that the controlfile has been restored:
Now you have two options for recovery.
1) Full/Complete recovery.
2) Point In Time Recovery (PIT)
In both examples it is assumed that all archivelogs are available to perform the recovery.
==========
To Perform a full restore and recovery.
run{
restore database;
recover database;
alter database open resetlogs;
}
If you performed a complete recovery with current controlfile and online redologs in place, you might get below error when opening the database with resetlogs:
ORA-01139: RESET LOGS option only valid after an incomplete database recovery
At this point simply open the database without resetlogs option.
===========
Point-In-Time Recovery (PITR) would be used if you have decided to restore a database to a particular point in time. This may be warranted for a hardware fault or if you are aware of a database corruption that occured at a certain date/time.
run{
set until time "to_date('Aug 16 2012 10:30:00','Mon DD YYYY HH24:MI:SS')";
restore database;
recover database;
sql 'alter database open resetlogs';
}
NOTE: The above scripts may be altered to allocate more channels. Good practice would be to review the backup log and identify how many channels where allocate during the backup and repeat this channel allocation for your restore/recovery.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-1063088/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN restore validate database報ORA-19693RESTDatabase
- HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another NoRESTDatabase
- Converting Oracle Database from Linux to Windows using RMANOracleDatabaseLinuxWindows
- 【12c】12c RMAN新特性之通過網路遠端恢復資料庫(RESTORE/Recover from Service)資料庫REST
- guarantee restore points-Flashback after RMAN restoreREST
- Oracle 19c透過recover standby database from service修復GAP案例OracleDatabase
- recover database using backup controlfile理解Database
- Crunchy PostgreSQL database restore via pgo commandSQLDatabaseRESTGo
- rman 還原歸檔日誌(restore archivelogRESTHive
- 12c RMAN新特性之Recover Table
- ORA-279 signalled during: alter database recover logfileDatabase
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- How to solve of ORA-04063 and RMAN-06429
- ORA-16649: possible failover to another database prevents this database from beiAIDatabase
- SQLSERVER 2012從2000還原失敗:Restore of database failedSQLServerRESTDatabaseAI
- how to move a MediaWiki wiki from one server to anotherServer
- How to prevent your jar packages from being decompiled?JARPackageCompile
- How To Copy Any Text To Clipboard From Terminal In UbuntuUbuntu
- How to Collect Diagnostics for Database Hanging Issues (Doc ID 452358.1)Database
- PL/SQL package SYS.DBMS_BACKUP_RESTORE version 19.16.00.00 in TARGET database isSQLPackageRESTDatabase
- Oracle database 升級(文件)to 10.2.0.4 from 10.2.0.1OracleDatabase
- 使用RMAN複製資料庫 active database資料庫Database
- RMAN restore fails with ORA-01180: can not create datafile 1 (文件 ID 1265151.1)RESTAI
- Oracle 12c系列(八)|RMAN (FROM SERVICE)Oracle
- 理解RMAN backup database plus archivelog delete all input命令DatabaseHivedelete
- [20221222]How to Enable and Disable Database Options in oracle 11g.txtDatabaseOracle
- How to redirect to a specific web page after sign out from Entra IDWeb
- How To Replicate Data from Oracle to Postgres Using GoldenGate (Doc ID 1544137.1OracleGo
- [20201110]How to get the Data Guard broker configuration from a SQL query.txtSQL
- 透過RMAN備份standby database成功恢復還原Database
- 【12c】12c RMAN新特性之recover table(表級別恢復)
- canvas restore()CanvasREST
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid不同UXDatabaseOracle
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid相同UXDatabaseOracle
- cron with recover
- canvas save()和restore()CanvasREST
- DOCKER特性 - LIVE RESTOREDockerREST
- Will attempt to recover by breaking constraintAI
- 【譯】defer-panic-and-recover