模拟损坏环境:
[oracle@gpsdb oradata]$ dd if=/dev/zero of=trsen01.dbf count=1 seek=1 bs=8192 conv=notrunc
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 3.9e-05 seconds, 210 MB/s
alert日志里信息
Wed Jan 13 14:36:13 2016
Beginning global checkpoint up to RBA [0x73.a0.10], SCN: 4229478=====>>>做full checkpoint
Read of datafile ‘/oradata/trsen01.dbf’ (fno 5) header failed with ORA-01210
Hex dump of (file 5, block 1) in trace file /u01/app/oracle/diag/rdbms/trsen/trsen/trace/trsen_ckpt_15829.trc
Corrupt block relative dba: 0x01400001 (file 5, block 1)
Completely zero block found during datafile header read
Rereading datafile 5 header failed with ORA-01210
Hex dump of (file 5, block 1) in trace file /u01/app/oracle/diag/rdbms/trsen/trsen/trace/trsen_ckpt_15829.trc
Corrupt block relative dba: 0x01400001 (file 5, block 1)
Completely zero block found during datafile header read
Errors in file /u01/app/oracle/diag/rdbms/trsen/trsen/trace/trsen_ckpt_15829.trc:
ORA-63999: data file suffered media failure
ORA-01122: database file 5 failed verification check
ORA-01110: data file 5: ‘/oradata/trsen01.dbf’
ORA-01210: data file header is media corrupt
Errors in file /u01/app/oracle/diag/rdbms/trsen/trsen/trace/trsen_ckpt_15829.trc:
ORA-63999: data file suffered media failure
ORA-01122: database file 5 failed verification check
ORA-01110: data file 5: ‘/oradata/trsen01.dbf’
ORA-01210: data file header is media corrupt============>>>>5号datafile header有坏块
CKPT (ospid: 15829): terminating the instance due to error 63999
Wed Jan 13 14:36:14 2016
System state dump requested by (instance=1, osid=15829 (CKPT)), summary=[abnormal instance termination].
System State dumped to trace file /u01/app/oracle/diag/rdbms/trsen/trsen/trace/trsen_diag_15809_20160113143614.trc
Dumping diagnostic data in directory=[cdmp_20160113143614], requested by (instance=1, osid=15829 (CKPT)), summary=[abnormal instance termination].
Instance terminated by CKPT, pid = 15829=======>>>CKPT进程terminal实例
可以offline 5号数据文件来open数据库,日志如下;并且在ctl文件记录的5号文件信息为recover状态,说明需要恢复
Wed Jan 13 14:37:48 2016
alter database datafile 5 offline
Completed: alter database datafile 5 offline
alter database open
Beginning crash recovery of 1 threads
…..
….
QMNC started with pid=59, OS id=16341
Completed: alter database open
SQL> select name,file#,status from v$datafile where file#=5;
NAME
——————————————————————————–
FILE# STATUS
———- ——-
/oradata/trsen01.dbf
5 RECOVER
此时我们已经把datafile header有坏块的5好文件已经offline了,并且数据库在open状态,我进行常规的恢复动作如下
RMAN> restore datafile 5;
Starting restore at 13-JAN-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to /oradata/trsen01.dbf
channel ORA_DISK_1: reading from backup piece /oradata/dbbackup/TRSEN_db_09qr98bn
channel ORA_DISK_1: piece handle=/oradata/dbbackup/TRSEN_db_09qr98bn tag=TAG20160113T141102
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 13-JAN-16
RMAN> recover datafile 5;
Starting recover at 13-JAN-16
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 111 is already on disk as file /oradata/db_recovery_dest/TRSEN/archivelog/2016_01_13/o1_mf_1_111_c9ctnxnc_.arc
archived log for thread 1 with sequence 112 is already on disk as file /oradata/db_recovery_dest/TRSEN/archivelog/2016_01_13/o1_mf_1_112_c9cto350_.arc
archived log for thread 1 with sequence 113 is already on disk as file /oradata/db_recovery_dest/TRSEN/archivelog/2016_01_13/o1_mf_1_113_c9cvkokj_.arc
archived log for thread 1 with sequence 114 is already on disk as file /oradata/db_recovery_dest/TRSEN/archivelog/2016_01_13/o1_mf_1_114_c9cvxwmz_.arc
archived log for thread 1 with sequence 115 is already on disk as file /oradata/db_recovery_dest/TRSEN/archivelog/2016_01_13/o1_mf_1_115_c9cw66fn_.arc
archived log file name=/oradata/db_recovery_dest/TRSEN/archivelog/2016_01_13/o1_mf_1_111_c9ctnxnc_.arc thread=1 sequence=111
archived log file name=/oradata/db_recovery_dest/TRSEN/archivelog/2016_01_13/o1_mf_1_112_c9cto350_.arc thread=1 sequence=112
archived log file name=/oradata/db_recovery_dest/TRSEN/archivelog/2016_01_13/o1_mf_1_113_c9cvkokj_.arc thread=1 sequence=113
media recovery complete, elapsed time: 00:00:00
Finished recover at 13-JAN-16
RMAN> sql ‘alter database datafile 5 online’;
sql statement: alter database datafile 5 online