Oracle RMAN恢复带有OFFLINE数据文件的数据库

本文详细介绍了如何使用Oracle Recovery Manager (RMAN) 恢复包含离线数据文件的数据库。内容涵盖了解决此类问题的关键步骤和策略,帮助数据库管理员在遇到数据文件脱机情况时,能够有效地恢复数据库到正常运行状态。
摘要由CSDN通过智能技术生成
1、创建测试表空间及测试数据文件
SQL> create tablespace test datafile '/u01/app/oracle/oradata/qlotcdb/test.dbf' size 1M;
SQL> create user test identified by test default tablespace test;
User created.

SQL> alter system switch logfile;
System altered.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/qlotcdb/system01.dbf
/u01/app/oracle/oradata/qlotcdb/sysaux01.dbf
/u01/app/oracle/oradata/qlotcdb/undotbs01.dbf
/u01/app/oracle/oradata/qlotcdb/users01.dbf
/u01/app/oracle/oradata/qlotcdb/test.dbf

2、将测试数据文件OFFLINE
SQL> alter database datafile '/u01/app/oracle/oradata/qlotcdb/test.dbf' offline;
Database altered.

3、删除全部归档日志
[oracle@db ~]$ cd /u01/app/oracle/product/11.2.0/db_1/dbs/arch
[oracle@db arch]$ ls
1_12_911428282.dbf  1_14_911428282.dbf  1_16_911428282.dbf  1_18_911428282.dbf  1_49_917365262.dbf
1_13_911428282.dbf  1_15_911428282.dbf  1_17_911428282.dbf  1_48_917365262.dbf  redo.log
[oracle@db arch]$ rm -rf *

4、尝试ONLINE测试数据文件失败
SQL> alter database datafile 5 online;
alter database datafile 5 online
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '/u01/app/oracle/oradata/qlotcdb/test.dbf'

5、recover OFFLINE数据文件失败
SQL> recover datafile 5;
ORA-00279: change 2036178 generated at 09/18/2016 16:51:38 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_48_917365262.dbf
ORA-00280: change 2036178 for thread 1 is in sequence #48

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_48_917365262.dbf
ORA-00308: cannot open archived log
'/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_48_917365262.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00308: cannot open archived log
'/u01/app/oracle/product/11.2.0/db_1/dbs/arch/1_48_917365262.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

6、RMAN全备数据库进行异机恢复
RMAN> backup database format  '/home/oracle/db_%d_%s_%p_%t_%T';
Starting backup at 18-SEP-16
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=/u01/app/oracle/oradata/qlotcdb/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/qlotcdb/sysaux01.dbf
i
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值