当前控制文件损坏_不完全恢复_用控制文件二进制备份_数据不丢_不需备份

当前控制文件损坏_不完全恢复_用控制文件二进制备份_数据不丢_不需备份
---------------当前控制文件损坏_不完全恢复_用控制文件二进制备份_数据不丢_不需备份----------------
[oracle@station ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 8 12:33:28 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> create table hr.strom (a number) tablespace users;
Table created.
SQL> alter system switch logfile;
System altered.
SQL> insert into hr.strom values(1);
1 row created.
SQL> alter system switch logfile;
System altered.
SQL> commit;
Commit complete.
SQL> insert into hr.strom values(2);
1 row created.
SQL> alter system switch logfile;
System altered.
SQL> commit;
Commit complete.
SQL> insert into hr.strom values(3);
1 row created.
SQL> commit;
Commit complete.
RMAN> backup current controlfile;                                        -----备份控制文件
Starting backup at 08-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 08-JUN-12
channel ORA_DISK_1: finished piece 1 at 08-JUN-12
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_06_08/o1_mf_ncnnf_TAG20120608T123941_7x4bpgks_.bkp tag=TAG20120608T123941 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-JUN-12
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 8 12:44:36 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  281018368 bytes
Fixed Size                  2020192 bytes
Variable Size             130026656 bytes
Database Buffers          146800640 bytes
Redo Buffers                2170880 bytes
ORA-00205: error in identifying control file, check alert log for more info                          -----表示控制文件丢失
通过RMAN备份的控制文件进行恢复,但是rman要进入mount的状态下才能进行恢复,我们可以在backupset文件下找到控制文件的备份片进行恢复,
我这里只有一个文件在生产环境中有很多备份片,可以看它的大小一般控制文件都是6-7MB以内。
[oracle@station 2012_06_08]$ cd /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_06_08/
[oracle@station 2012_06_08]$ ls -l
total 6956
-rw-r----- 1 oracle oinstall 7110656 Jun  8 12:39 o1_mf_ncnnf_TAG20120608T123941_7x4bpgks_.bkp
[oracle@station 2012_06_08]$ du -h *
6.8M    o1_mf_ncnnf_TAG20120608T123941_7x4bpgks_.bkp
[oracle@station ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jun 8 12:57:22 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: orcl (not mounted)
RMAN> list backup of controlfile;                                          在nomount查看不到备份的内容
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 06/08/2012 12:58:41
ORA-01507: database not mounted                                           
RMAN> quit
找到备份片现在通过RMAN进行恢复控制文件。
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jun 8 13:00:55 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: orcl (not mounted)
RMAN> restore controlfile from '/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_06_08/o1_mf_ncnnf_TAG20120608T123941_7x4bpgks_.bkp';
Starting restore at 08-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
output filename=/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_7x4d0ssc_.ctl
output filename=/u01/app/oracle/flash_recovery_area/ORCL/controlfile/o1_mf_7x4d0t9h_.ctl
Finished restore at 08-JUN-12
RMAN> run { alter database mount;                            ----这里用run语法进行恢复
2> recover database;
3> }
database mounted
released channel: ORA_DISK_1
Starting recover at 08-JUN-12
Starting implicit crosscheck backup at 08-JUN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
Finished implicit crosscheck backup at 08-JUN-12
Starting implicit crosscheck copy at 08-JUN-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 08-JUN-12
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_06_08/o1_mf_ncnnf_TAG20120608T123941_7x4bpgks_.bkp
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 22 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_3_7wntksjg_.log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_3_7wntksjg_.log thread=1 sequence=22
media recovery complete, elapsed time: 00:00:00
Finished recover at 08-JUN-12
RMAN> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@station 2012_06_08]$ conn /as sysdba
bash: conn: command not found
[oracle@station 2012_06_08]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 8 13:08:35 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> alter database open;                                                                  ---注意:在上面只启动到mount的状态。
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> select * from hr.strom;
         A
----------
         1
         2
         3
---------------当前控制文件损坏_不完全恢复_用控制文件二进制备份_数据不丢_不需备份----------------

本文出自 “strom的博客” 博客,谢绝转载!

你可能感兴趣的:(二进制,2012,Copyright)