ITPub博客

首页 > 数据库 > Oracle > RMAN恢复案例:丢失全部数据文件恢复

RMAN恢复案例:丢失全部数据文件恢复

原创 Oracle 作者:blue_prince 时间:2005-01-06 15:40:10 0 删除 编辑

               RMAN恢复案例:丢失全部数据文件恢复

1、模拟数据文件丢失:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> host rm /u01/oracle/oradata/XUE/*.dbf
控制文件、日志文件必须存在。
SQL> host ls /u01/oracle/oradata/XUE/
archive  control01.ctl  control02.ctl  control03.ctl  redo01.log  redo02.log

[@more@]

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
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/oracle/oradata/XUE/system01.dbf'

3、查看恢复文件状态:
SQL> select * from v$recover_file;

     FILE# ONLINE  ONLINE_
---------- ------- -------
ERROR                                                                CHANGE#
----------------------------------------------------------------- ----------
TIME
---------
         1 ONLINE  ONLINE
FILE NOT FOUND                                                             0


         2 ONLINE  ONLINE
FILE NOT FOUND                                                             0


     FILE# ONLINE  ONLINE_
---------- ------- -------
ERROR                                                                CHANGE#
----------------------------------------------------------------- ----------
TIME
---------

         3 ONLINE  ONLINE
FILE NOT FOUND                                                             0


         4 ONLINE  ONLINE
FILE NOT FOUND                                                             0

     FILE# ONLINE  ONLINE_
---------- ------- -------
ERROR                                                                CHANGE#
----------------------------------------------------------------- ----------
TIME
---------


SQL> host 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 (DBID=285819149)
4、从有效备份中恢复:

RMAN> run {
2> allocate channel c1 type disk;
3> restore database;
4> recover database;
5> sql 'alter database open';
6> release channel c1 ;
7> }

using target database controlfile instead of recovery catalog
allocated channel: c1
channel c1: sid=14 devtype=DISK

Starting restore at 05-JAN-05

channel c1: starting datafile backupset restore
channel c1: 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 c1: restored backup piece 1
piece handle=/opt/rman_backup/df_546708956_8_1 tag=TAG20050104T153556 params=NULL
channel c1: restore complete
channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/oracle/oradata/XUE/system01.dbf
channel c1: restored backup piece 1
piece handle=/opt/rman_backup/0ag9c7q1_1_1 tag=TAG20050104T154153 params=NULL
channel c1: restore complete
Finished restore at 05-JAN-05

Starting recover at 05-JAN-05

starting media recovery

archive log thread 1 sequence 66 is already on disk as file /u01/oracle/oradata/XUE/archive/66.arc
archive log thread 1 sequence 67 is already on disk as file /u01/oracle/oradata/XUE/archive/67.arc
archive log thread 1 sequence 68 is already on disk as file /u01/oracle/oradata/XUE/archive/68.arc
archive log thread 1 sequence 69 is already on disk as file /u01/oracle/oradata/XUE/archive/69.arc
archive log thread 1 sequence 70 is already on disk as file /u01/oracle/oradata/XUE/archive/70.arc
archive log thread 1 sequence 71 is already on disk as file /u01/oracle/oradata/XUE/archive/71.arc
archive log thread 1 sequence 72 is already on disk as file /u01/oracle/oradata/XUE/archive/72.arc
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
media recovery complete
Finished recover at 05-JAN-05

sql statement: alter database open

released channel: c1

RMAN> exit


Recovery Manager complete.
5、验证恢复:

SQL> select count(*) from t;

  COUNT(*)
----------
      6143

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

请登录后发表评论 登录
全部评论

注册时间:2007-12-23

  • 博文量
    92
  • 访问量
    2216583