rman还原归档日志(restore archivelog)(三)

2014-11-24 15:06:41 · 作者: · 浏览: 1
u01/database/sybo3/oradata/users01.dbf'
SQL> select * from v$recover_file;
select * from v$recover_file
*
ERROR at line 1:
ORA-01135: file 4 accessed for DML/query is offline
ORA-01110: data file 4: '/u01/database/sybo3/oradata/users01.dbf'
c、还原与恢复受损的数据文件
SQL> select TABLESPACE_NAME,STATUS from dba_tablespaces where tablespace_name='USERS'; --->tablespace 依旧是Online
TABLESPACE_NAME STATUS
------------------------------ ---------
USERS ONLINE
SQL> alter tablespace users offline immediate; --->offline受损的tablespace
Tablespace altered.
SQL> select tablespace_name,status from dba_tablespaces where tablespace_name='USERS'; --->此时状态为offline
TABLESPACE_NAME STATUS
------------------------------ ---------
USERS OFFLINE
RMAN> restore datafile 4; --->此时使用restore datafile 方式提示失败
Starting restore at 2013/07/26 20:30:20
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/26/2013 20:30:20
ORA-01135: file 4 accessed for DML/query is offline
ORA-01110: data file 4: '/u01/database/sybo3/oradata/users01.dbf'
RMAN-06010: error while looking up datafile: 4
RMAN> restore tablespace users; --->此时使用restore tablespace 方式提示失败,看来,对于copy方式的备份,必须要copy回去
--->后来看了一下语法,restore (datafile 4) FROM DATAFILECOPY方式可以搞定,括号不能省略
Starting restore at 2013/07/26 20:31:12
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/26/2013 20:31:12
ORA-01135: file 4 accessed for DML/query is offline
ORA-01110: data file 4: '/u01/database/sybo3/oradata/users01.dbf'
RMAN-06019: could not translate tablespace name "USERS"
-->下面直接使用copy方式进行还原
SQL> ho cp /u01/database/sybo3/fra/SYBO3/backupset/2013_07_26/users01.dbf /u01/database/sybo3/oradata/users01.dbf
-->接下来我们还原归档日志,制定了from sequence子句,实际上,如果我们没有指定restore archivelog,在recover时也会自动完成还原归档日志
RMAN> restore archivelog from sequence 27;
Starting restore at 2013/07/26 20:36:55
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log restore to default destination --->这个地方是关键提示,还原到缺省位置
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=27
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=28
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=29
channel ORA_DISK_1: reading from backup piece /u01/database/sybo3/fra/SYBO3/backupset/2013_07_26/o1_mf_annnn_TAG20130726T201640_8z4t58tn_.bkp
channel ORA_DISK_1: piece handle=/u01/database/sybo3/fra/SYBO3/backupset/2013_07_26/o1_mf_annnn_TAG20130726T201640_8z4t58tn_.bkp tag=TAG