控制文件的不同状况下的恢复之数据库存在有效的备份

(2)数据库存在有效的备份
*****************************************备份数据库****************************************
RMAN> list backup;
using target database control file instead of recovery catalog
specification does not match any backup in the repository
RMAN> show all;
RMAN configuration parameters for database with db_unique_name ORA11 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/oracle11/product/11.2/dbs/snapcf_ora11.f'; # default
RMAN> backup database;
Starting backup at 26-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 device type=DISK
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=/u01/oracle/oracle11/oradata/ora11/system01.dbf
input datafile file number=00002 name=/u01/oracle/oracle11/oradata/ora11/sysaux01.dbf
input datafile file number=00005 name=/u01/oracle/oracle11/oradata/ora11/example01.dbf
input datafile file number=00003 name=/u01/oracle/oracle11/oradata/ora11/undotbs01.dbf
input datafile file number=00004 name=/u01/oracle/oracle11/oradata/ora11/users01.dbf
channel ORA_DISK_1: starting piece 1 at 26-JAN-12
channel ORA_DISK_1: finished piece 1 at 26-JAN-12
piece handle=/u01/oracle/oracle11/flash_recovery_area/ORA11/backupset/2012_01_26/o1_mf_nnndf_TAG20120126T161906_7l3jtcj6_.bkp tag=TAG20120126T161906 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:17
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 26-JAN-12
channel ORA_DISK_1: finished piece 1 at 26-JAN-12
piece handle=/u01/oracle/oracle11/flash_recovery_area/ORA11/backupset/2012_01_26/o1_mf_ncsnf_TAG20120126T161906_7l3k0mo2_.bkp tag=TAG20120126T161906 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-JAN-12
RMAN>
RMAN>
RMAN>
*****************************************查看相关备份信息****************************************
RMAN> list backup of database;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    1.02G      DISK        00:03:11     26-JAN-12
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20120126T161906
        Piece Name: /u01/oracle/oracle11/flash_recovery_area/ORA11/backupset/2012_01_26/o1_mf_nnndf_TAG20120126T161906_7l3jtcj6_.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 890582     26-JAN-12 /u01/oracle/oracle11/oradata/ora11/system01.dbf
  2       Full 890582     26-JAN-12 /u01/oracle/oracle11/oradata/ora11/sysaux01.dbf
  3       Full 890582     26-JAN-12 /u01/oracle/oracle11/oradata/ora11/undotbs01.dbf
  4       Full 890582     26-JAN-12 /u01/oracle/oracle11/oradata/ora11/users01.dbf
  5       Full 890582     26-JAN-12 /u01/oracle/oracle11/oradata/ora11/example01.dbf
RMAN> list backup of controlfile;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.67M      DISK        00:00:04     26-JAN-12
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20120126T161906
        Piece Name: /u01/oracle/oracle11/flash_recovery_area/ORA11/backupset/2012_01_26/o1_mf_ncsnf_TAG20120126T161906_7l3k0mo2_.bkp
  Control File Included: Ckp SCN: 890666       Ckp time: 26-JAN-12
RMAN> list backup of spfile
2> ;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.67M      DISK        00:00:04     26-JAN-12
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20120126T161906
        Piece Name: /u01/oracle/oracle11/flash_recovery_area/ORA11/backupset/2012_01_26/o1_mf_ncsnf_TAG20120126T161906_7l3k0mo2_.bkp
  SPFILE Included: Modification time: 26-JAN-12
  SPFILE db_unique_name: ORA11
RMAN> exit

Recovery Manager complete.
 
*****************************************模拟控制文件损坏****************************************
SQL> show parameter control
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      /u01/oracle/oracle11/oradata/o
                                                 ra11/control01.ctl, /u01/oracl
                                                 e/oracle11/flash_recovery_area
                                                 /ora11/control02.ctl
control_management_pack_access       string      DIAGNOSTIC+TUNING
SQL>
SQL> ! rm /u01/oracle/oracle11/oradata/ora11/control01.ctl
SQL> ! rm /u01/oracle/oracle11/flash_recovery_area/ora11/control02.ctl
SQL> !
*****************************************报错了,这也是我们实验想看到的****************************************
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  497995776 bytes
Fixed Size                  1337464 bytes
Variable Size             360712072 bytes
Database Buffers          130023424 bytes
Redo Buffers                5922816 bytes
ORA-00205: error in identifying control file, check alert log for more info

SQL> shutdown abort;
ORACLE instance shut down.
SQL>
*****************************************从备份restore控制文件****************************************
RMAN> restore controlfile;
Starting restore at 26-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/26/2012 16:34:16
RMAN-06563: control file or SPFILE must be restored using FROM AUTOBACKUP
RMAN> restore controlfile from '/u01/oracle/oracle11/flash_recovery_area/ORA11/backupset/2012_01_26/o1_mf_ncsnf_TAG20120126T161906_7l3k0mo2_.bkp';
Starting restore at 26-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output file name=/u01/oracle/oracle11/oradata/ora11/control01.ctl
output file name=/u01/oracle/oracle11/flash_recovery_area/ora11/control02.ctl
Finished restore at 26-JAN-12
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
*****************************************尝试打开数据库****************************************
RMAN> alter database open;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 01/26/2012 16:36:12
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
RMAN> recover database;
Starting recover at 26-JAN-12
Starting implicit crosscheck backup at 26-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 26-JAN-12
Starting implicit crosscheck copy at 26-JAN-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 26-JAN-12
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /u01/oracle/oracle11/flash_recovery_area/ORA11/backupset/2012_01_26/o1_mf_ncsnf_TAG20120126T161906_7l3k0mo2_.bkp
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 7 is already on disk as file /u01/oracle/oracle11/oradata/ora11/redo01.log
archived log file name=/u01/oracle/oracle11/oradata/ora11/redo01.log thread=1 sequence=7
media recovery complete, elapsed time: 00:00:03
Finished recover at 26-JAN-12
RMAN> alter database open resetlogs;------------------------&gtok.恢复完毕
database opened
RMAN>
 

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

转载于:http://blog.itpub.net/28278387/viewspace-746674/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值