当控制文件的备份丢失时,怎么restore database?
来源于:
How to restore database when controlfile backup missing (文档 ID 1438776.1)
适用于:
Oracle Database - Enterprise Edition - Version 9.2.0.1 to 11.2.0.3 [Release 9.2 to 11.2]
Information in this document applies to any platform.
***Checked for relevance on 23-Sep-2013***
目标:
本文对如下的情况有帮助:除了控制文件备份不存在,其他的备份都存在,该情况下的database restore.
解决方案:
给出一个例子。
1. 查看当前数据库结构:
RMAN> report schema; using target database control file instead of recovery catalog Report of database schema List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 510 SYSTEM *** +DATA/ora102/datafile/system.257.775126603 2 595 UNDOTBS1 *** +DATA/ora102/datafile/undotbs1.256.775126561 3 250 SYSAUX *** +DATA/ora102/datafile/sysaux.258.775126637 4 28 USERS *** +DATA/ora102/datafile/users.259.775126653 5 50 USERS *** +DATA/ora102/datafile/users.262.776000421 List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- -------------------- ----------- -------------------- 1 29 TEMP 32767 /u01/app/oracle/oradata/ora102/ORA102/datafile/o1_mf_temp_7lqq1qko_.tmp RMAN> exit Recovery Manager complete
2.Create a dummy instance/ can use existing database to extract datafile 1 from backup piece and restore datafile 1 from backup piece
SQL> DECLARE devtype varchar2(256); done boolean; BEGIN devtype := dbms_backup_restore.DeviceAllocate(type=>null, ident=>'d1'); dbms_backup_restore.RestoreSetDatafile; dbms_backup_restore.RestoreDatafileTo(dfnumber => 1,toname => '/u03/datafile1.dbf'); dbms_backup_restore.RestoreBackupPiece(done => done,handle =>'/u03/backup/2cn5blrn_1_1', params => null); dbms_backup_restore.DeviceDeallocate; END; /
3.在包括datafile 1的情况下建立控制文件:
SQL>!cat /u03/1.ctl CREATE CONTROLFILE REUSE DATABASE "ORA102" NORESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/u01/app/oracle/oradata/ora102/ORA102/onlinelog/o1_mf_1_7lqq1m62_.log' SIZE 50M, GROUP 2 '/u01/app/oracle/oradata/ora102/ORA102/onlinelog/o1_mf_2_7lqq1myr_.log' SIZE 50M, GROUP 3 '/u01/app/oracle/oradata/ora102/ORA102/onlinelog/o1_mf_3_7lqq1nr0_.log' SIZE 50M DATAFILE '/u03/datafile1.dbf' CHARACTER SET WE8ISO8859P1 ; SQL> @/u03/1.ctl Control file created. SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /u03/datafile1.dbf SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
4.catalog 所有的backuppiece
[oracle@oel57 ~]$ rman target / Recovery Manager: Release 10.2.0.5.0 - Production on Thu Mar 8 11:55:58 2012 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: ORA102 (DBID=396070408, not open) RMAN> catalog start with '/u03/backup/' noprompt; using target database control file instead of recovery catalog searching for all files that match the pattern /u03/backup/ List of Files Unknown to the Database ===================================== File Name: /u03/backup/28n5bki6_1_1 File Name: /u03/ba