RMAN恢复案例:无恢复目录,丢失全部数据文件、控制文件、日志文件恢复
1、模拟介质损坏:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> host ls /u01/oracle/oradata/XUE
archive control02.ctl indx01.dbf redo02.log undotbs01.dbf
control01.ctl control03.ctl redo01.log system01.dbf users01.dbf
SQL> host rm /u01/oracle/oradata/XUE/*.log
SQL> host rm /u01/oracle/oradata/XUE/*.dbf
SQL> host rm /u01/oracle/oradata/XUE/*ctl
SQL> host ls /u01/oracle/oradata/XUE
archive
2、启动报错:
SQL> startup
ORACLE instance started.
Total System Global Area 64033912 bytes
Fixed Size 451704 bytes
Variable Size 37748736 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
ORA-00205: error in identifying controlfile, check alert log for more info
3、进行控制文件还原:
[oracle@Linux1 rman_backup]$ rman target /
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: XUE (not mounted)
RMAN> set DBID=285819149
RMAN> restore controlfile from '/opt/rman_backup/control.bak';
Starting restore at 05-JAN-05
using channel ORA_DISK_1
channel ORA_DISK_1: copied controlfile copy
replicating controlfile
input filename=/u01/oracle/oradata/XUE/control01.ctl
output filename=/u01/oracle/oradata/XUE/control02.ctl
output filename=/u01/oracle/oradata/XUE/control03.ctl
Finished restore at 05-JAN-05
4、装载数据库:
RMAN> alter database mount;
database mounted
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 200M DISK 00:01:21 24-DEC-04
BP Key: 1 Status: AVAILABLE Tag: TAG20041224T094925
Piece Name: /u01/oracle/oradata/rman_backup/db.dbf
SPFILE Included: Modification time: 24-DEC-04
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 251176 24-DEC-04 /u01/oracle/oradata/XUE/system01.dbf
2 Full 251176 24-DEC-04 /u01/oracle/oradata/XUE/undotbs01.dbf
3 Full 251176 24-DEC-04 /u01/oracle/oradata/XUE/indx01.dbf
4 Full 251176 24-DEC-04 /u01/oracle/oradata/XUE/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 72K DISK 00:00:03 31-DEC-04
BP Key: 2 Status: AVAILABLE Tag: TAG20041231T114559
Piece Name: /u01/oracle/product/9.2.0/dbs/df_546349559_3_1
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 388777 26-DEC-04 /u01/oracle/oradata/XUE/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Full 1M DISK 00:00:01 31-DEC-04
BP Key: 3 Status: AVAILABLE Tag:
Piece Name: /u01/oracle/product/9.2.0/dbs/c-285819149-20041231-00
SPFILE Included: Modification time: 24-DEC-04
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 176K DISK 00:00:12 04-JAN-05
BP Key: 4 Status: AVAILABLE Tag: TAG20050104T152505
Piece Name: /u01/oracle/product/9.2.0/dbs/df_546708305_5_1
List of Datafiles in backup set 4
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
3 Full 419690 04-JAN-05 /u01/oracle/oradata/XUE/indx01.dbf
4 Full 419690 04-JAN-05 /u01/oracle/oradata/XUE/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 74M DISK 00:00:19 04-JAN-05
BP Key: 5 Status: AVAILABLE Tag: TAG20050104T152505
Piece Name: /u01/oracle/product/9.2.0/dbs/df_546708305_6_1
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 419689 04-JAN-05 /u01/oracle/oradata/XUE/undotbs01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 74M DISK 00:00:13 04-JAN-05
BP Key: 6 Status: AVAILABLE Tag: TAG20050104T153556
Piece Name: /opt/rman_backup/df_546708956_8_1
List of Datafiles in backup set 6
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 420191 04-JAN-05 /u01/oracle/oradata/XUE/undotbs01.dbf
3 Full 420191 04-JAN-05 /u01/oracle/oradata/XUE/indx01.dbf
4 Full 420191 04-JAN-05 /u01/oracle/oradata/XUE/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7 Full 128M DISK 00:00:21 04-JAN-05
BP Key: 7 Status: AVAILABLE Tag: TAG20050104T153556
Piece Name: /opt/rman_backup/df_546708971_9_1
SPFILE Included: Modification time: 24-DEC-04
List of Datafiles in backup set 7
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 420214 04-JAN-05 /u01/oracle/oradata/XUE/system01.dbf
5、进行数据库还原及恢复:
RMAN> restore database;
Starting restore at 05-JAN-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u01/oracle/oradata/XUE/undotbs01.dbf
restoring datafile 00003 to /u01/oracle/oradata/XUE/indx01.dbf
restoring datafile 00004 to /u01/oracle/oradata/XUE/users01.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/rman_backup/df_546708956_8_1 tag=TAG20050104T153556 params=NULL
channel ORA_DISK_1: restore complete
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/oracle/oradata/XUE/system01.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/rman_backup/df_546708971_9_1 tag=TAG20050104T153556 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 05-JAN-05
RMAN> recover database;
Starting recover at 05-JAN-05
using channel ORA_DISK_1
starting media recovery
archive log filename=/u01/oracle/oradata/XUE/archive/66.arc thread=1 sequence=66
archive log filename=/u01/oracle/oradata/XUE/archive/67.arc thread=1 sequence=67
archive log filename=/u01/oracle/oradata/XUE/archive/68.arc thread=1 sequence=68
archive log filename=/u01/oracle/oradata/XUE/archive/69.arc thread=1 sequence=69
archive log filename=/u01/oracle/oradata/XUE/archive/70.arc thread=1 sequence=70
archive log filename=/u01/oracle/oradata/XUE/archive/71.arc thread=1 sequence=71
archive log filename=/u01/oracle/oradata/XUE/archive/72.arc thread=1 sequence=72
unable to find archive log
archive log thread=1 sequence=73
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/05/2005 17:18:33
RMAN-06054: media recovery requesting unknown log: thread 1 scn 492279
6、重置日志方式打开数据库,恢复成功:
RMAN> alter database open resetlogs;
database opened
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/60857/viewspace-786321/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/60857/viewspace-786321/