/u01/database/sybo3/fra/SYBO3/archivelog/2013_07_26/o1_mf_1_27_8z4sy5ft_.arc 27 A 20130726 20:12:53
/u01/database/sybo3/fra/SYBO3/archivelog/2013_07_26/o1_mf_1_28_8z4t1q0s_.arc 28 A 20130726 20:14:47
-->下面备份归档日志并删除已备份的归当日志
RMAN> backup archivelog all delete input;
Starting backup at 2013/07/26 20:16:39
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set --->备份集里包含的归档日志
input archived log thread=1 sequence=27 RECID=23 STAMP=821823173
input archived log thread=1 sequence=28 RECID=24 STAMP=821823287
input archived log thread=1 sequence=29 RECID=25 STAMP=821823400
channel ORA_DISK_1: starting piece 1 at 2013/07/26 20:16:40
channel ORA_DISK_1: finished piece 1 at 2013/07/26 20:16:41
piece handle=/u01/database/sybo3/fra/SYBO3/backupset/2013_07_26/o1_mf_annnn_TAG20130726T201640_8z4t58tn_.bkp tag=TAG20130726T201640 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s) --->这里提示删除
archived log file name=/u01/database/sybo3/fra/SYBO3/archivelog/2013_07_26/o1_mf_1_27_8z4sy5ft_.arc RECID=23 STAMP=821823173
archived log file name=/u01/database/sybo3/fra/SYBO3/archivelog/2013_07_26/o1_mf_1_28_8z4t1q0s_.arc RECID=24 STAMP=821823287
archived log file name=/u01/database/sybo3/fra/SYBO3/archivelog/2013_07_26/o1_mf_1_29_8z4t585k_.arc RECID=25 STAMP=821823400
Finished backup at 2013/07/26 20:16:41
b、模拟破坏数据文件
SQL> insert into t1 select 'Last','End of test' from dual;
SQL> commit;
SQL> ho cat /dev/null>/u01/database/sybo3/oradata/users01.dbf --->破坏数据文件
SQL> select * from t1; --->此时buffer cache依旧可以查询到数据
SEQ WHO
---------- --------------------
First Robin
Second Robinson
Last End of test
SQL> alter system checkpoint; --->实施检查点进程
System altered.
SQL> select * from t1; --->此时数据文件不可访问
select * from t1
*
ERROR at line 1:
ORA-00376: file 4 cannot be read at this time
ORA-01110: data file 4: '/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-