當前控制文件損壞_不完全恢復_用控制文件二進制備份_數據不丟_不需備份

當前控制文件損壞_不完全恢復_用控制文件二進制備份_數據不丟_不需備份
---------------當前控制文件損壞_不完全恢復_用控制文件二進制備份_數據不丟_不需備份----------------
[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
---------------當前控制文件損壞_不完全恢復_用控制文件二進制備份_數據不丟_不需備份----------------
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章