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
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