ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 恢复丢失的控制文件

恢复丢失的控制文件

原创 Linux操作系统 作者:jichengjie 时间:2013-10-22 09:54:16 0 删除 编辑
1.删除所有控制文件
-bash-3.2$ cd
-bash-3.2$ cd oradata
-bash-3.2$ ls
mydb
-bash-3.2$ cd mydb
-bash-3.2$ ls
cat01.dbf  control01.ctl  redo01.log  redo02.log  redo03.log  sysaux01.dbf  system01.dbf  temp01.dbf  test01.dbf  undotbs01.dbf  users01.dbf
-bash-3.2$ rm control*
-bash-3.2$ ls
cat01.dbf  redo01.log  redo02.log  redo03.log  sysaux01.dbf  system01.dbf  temp01.dbf  test01.dbf  undotbs01.dbf  users01.dbf
-bash-3.2$
-bash-3.2$ cd fast_recovery_area/
-bash-3.2$ ls
mydb
-bash-3.2$ cd mydb
-bash-3.2$ ls
control02.ctl
-bash-3.2$ mv control02.ctl /opt/oracle/control01.ctl
-bash-3.2$ ls
-bash-3.2$ sqlplus /nolog
SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 21 16:53:48 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
mydb
SQL> shutdown immediate;
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/opt/oracle/oradata/mydb/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  627732480 bytes
Fixed Size                  1346756 bytes
Variable Size             415236924 bytes
Database Buffers          201326592 bytes
Redo Buffers                9822208 bytes
ORA-00205: error in identifying control file, check alert log for more info
2.恢复过程
-bash-3.2$ rman
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Oct 21 16:55:10 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
RMAN> connect target /
connected to target database: mydb (not mounted)
RMAN> restore controlfile from autobackup;
Starting restore at 21-OCT-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
recovery area destination: /opt/oracle/fast_recovery_area
database name (or database unique name) used for search: mydb
channel ORA_DISK_1: AUTOBACKUP /opt/oracle/fast_recovery_area/mydb/autobackup/2013_10_21/o1_mf_s_829409774_969pcgrx_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /opt/oracle/fast_recovery_area/mydb/autobackup/2013_10_21/o1_mf_s_829409774_969pcgrx_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/opt/oracle/oradata/mydb/control01.ctl
output file name=/opt/oracle/fast_recovery_area/mydb/control02.ctl
Finished restore at 21-OCT-13
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> alter database open resetlogs;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 10/21/2013 16:56:55
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/oradata/mydb/system01.dbf'
RMAN> recover database;
Starting recover at 21-OCT-13
Starting implicit crosscheck backup at 21-OCT-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
Crosschecked 9 objects
Finished implicit crosscheck backup at 21-OCT-13
Starting implicit crosscheck copy at 21-OCT-13
using channel ORA_DISK_1
Crosschecked 1 objects
Finished implicit crosscheck copy at 21-OCT-13
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /opt/oracle/fast_recovery_area/mydb/autobackup/2013_10_21/o1_mf_s_829409774_969pcgrx_.bkp
using channel ORA_DISK_1
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=12 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: WARNING: Oracle Test Disk API
starting media recovery
archived log for thread 1 with sequence 20 is already on disk as file /opt/oracle/oradata/mydb/redo02.log
archived log file name=/opt/oracle/oradata/mydb/redo02.log thread=1 sequence=20
media recovery complete, elapsed time: 00:00:01
Finished recover at 21-OCT-13
RMAN> alter database open resetlogs;
database opened
RMAN> backup database;
Starting backup at 21-OCT-13
released channel: ORA_SBT_TAPE_1
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/opt/oracle/oradata/mydb/system01.dbf
input datafile file number=00002 name=/opt/oracle/oradata/mydb/sysaux01.dbf
input datafile file number=00005 name=/opt/oracle/oradata/mydb/cat01.dbf
input datafile file number=00003 name=/opt/oracle/oradata/mydb/undotbs01.dbf
input datafile file number=00006 name=/opt/oracle/oradata/mydb/test01.dbf
input datafile file number=00004 name=/opt/oracle/oradata/mydb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 21-OCT-13
channel ORA_DISK_1: finished piece 1 at 21-OCT-13
piece handle=/opt/oracle/fast_recovery_area/mydb/backupset/2013_10_21/o1_mf_nnndf_TAG20131021T165748_969v4djs_.bkp tag=TAG20131021T165748 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 21-OCT-13
Starting Control File and SPFILE Autobackup at 21-OCT-13
piece handle=/opt/oracle/fast_recovery_area/mydb/autobackup/2013_10_21/o1_mf_s_829414693_969v55wl_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 21-OCT-13
RMAN> delete noprompt obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
using channel ORA_DISK_1
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=12 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: WARNING: Oracle Test Disk API
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           6      16-OCT-13        
  Backup Piece       6      16-OCT-13          07omie6a_1_1
Backup Set           7      16-OCT-13        
  Backup Piece       7      16-OCT-13          c-599395733-20131016-02
RMAN-06207: WARNING: 2 objects could not be deleted for SBT_TAPE channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212:   Object Type   Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Backup Piece    07omie6a_1_1
RMAN-06214: Backup Piece    c-599395733-20131016-02
RMAN> crosscheck backupset;
using channel ORA_DISK_1
using channel ORA_SBT_TAPE_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/oracle/backup/mydb_09omus2q_1_1.dbf RECID=8 STAMP=829386842
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/oracle/fast_recovery_area/mydb/autobackup/2013_10_21/o1_mf_s_829414653_969v3xg9_.bkp RECID=12 STAMP=829414653
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/oracle/fast_recovery_area/mydb/backupset/2013_10_21/o1_mf_nnndf_TAG20131021T165748_969v4djs_.bkp RECID=13 STAMP=829414668
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/oracle/fast_recovery_area/mydb/autobackup/2013_10_21/o1_mf_s_829414693_969v55wl_.bkp RECID=14 STAMP=829414693
Crosschecked 4 objects
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=07omie6a_1_1 RECID=6 STAMP=828979402
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=c-599395733-20131016-02 RECID=7 STAMP=828979403
Crosschecked 2 objects

RMAN> delete noprompt obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
using channel ORA_DISK_1
using channel ORA_SBT_TAPE_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           6      16-OCT-13        
  Backup Piece       6      16-OCT-13          07omie6a_1_1
Backup Set           7      16-OCT-13        
  Backup Piece       7      16-OCT-13          c-599395733-20131016-02
deleted backup piece
backup piece handle=07omie6a_1_1 RECID=6 STAMP=828979402
deleted backup piece
backup piece handle=c-599395733-20131016-02 RECID=7 STAMP=828979403
Deleted 2 objects

RMAN> exit

Recovery Manager complete.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26870952/viewspace-774770/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 块冲突的恢复
请登录后发表评论 登录
全部评论
成为全能!

注册时间:2012-04-10

  • 博文量
    161
  • 访问量
    435833