非归档数据文件offline的恢复(二)

2014-11-24 17:02:25 · 作者: · 浏览: 1
| filename | AUTO | CANCEL} cancel Media recovery cancelled. SQL> alter database datafile 5 online; alter database datafile 5 online * ERROR at line 1: ORA-01113: file 5 needs media recovery if it was restored from backup, or END BACKUP if it was not ORA-01110: data file 5: '/u01/app/oracle/oradata/ptod/zxy01.dbf' ---下面用bbed来检查点信息: BBED> info File# Name Size(blks) ----- ---- ---------- 1 /u01/app/oracle/oradata/ptod/system01.dbf 0 2 /u01/app/oracle/oradata/ptod/undotbs03.dbf 0 3 /u01/app/oracle/oradata/ptod/sysaux01.dbf 0 4 /u01/app/oracle/oradata/ptod/users01.dbf 0 5 /u01/app/oracle/oradata/ptod/zxy01.dbf 0 BBED> set file 5 block 1 FILE# 5 BLOCK# 1 BBED> p kcvfhckp struct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x000877dd---数据文件头的SCN低4字节值 ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x317c161a ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x00000018---数据文件当前写的redolog sequence。 ub4 kcrbabno @504 0x00000002---数据文件当前写的redolog的block号 ub2 kcrbabof @508 0x0010 ub1 kcvcpetb[0] @512 0x02 ub1 kcvcpetb[1] @513 0x00 ub1 kcvcpetb[2] @514 0x00 ub1 kcvcpetb[3] @515 0x00 ub1 kcvcpetb[4] @516 0x00 ub1 kcvcpetb[5] @517 0x00 ub1 kcvcpetb[6] @518 0x00 ub1 kcvcpetb[7] @519 0x00 因此我只需要把红色部分的信息改成与正常的数据文件的值一样,骗过oracle的检测。 BBED> set file 4 blcok 1 FILE# 4 BBED-00202: invalid parameter (blcok) BBED> set file 4 block 1 FILE# 4 BLOCK# 1 BBED> p kcvfhckp struct kcvfhckp, 36 bytes @484 struct kcvcpscn, 8 bytes @484 ub4 kscnbas @484 0x0008783b ub2 kscnwrp @488 0x0000 ub4 kcvcptim @492 0x317c1711 ub2 kcvcpthr @496 0x0001 union u, 12 bytes @500 struct kcvcprba, 12 bytes @500 ub4 kcrbaseq @500 0x0000001c ub4 kcrbabno @504 0x00000002 ub2 kcrbabof @508 0x0010 ub1 kcvcpetb[0] @512 0x02 ub1 kcvcpetb[1] @513 0x00 ub1 kcvcpetb[2] @514 0x00 ub1 kcvcpetb[3] @515 0x00 ub1 kcvcpetb[4] @516 0x00 ub1 kcvcpetb[5] @517 0x00 ub1 kcvcpetb[6] @518 0x00 ub1 kcvcpetb[7] @519 0x00 BBED>
d /v offset 484 count 16 File: /u01/app/oracle/oradata/ptod/users01.dbf (4) Block: 1 Offsets: 484 to 499 Dba:0x01000001 ------------------------------------------------------- 3b780800 0000af76 11177c31 01008e00 l ;x....|1.... <16 bytes per line> BBED> set file 5 block 1 FILE# 5 BLOCK# 1 BBED> modify /x 3b7808 offset 484 Warning: contents of previous BIFILE will be lost. Proceed (Y/N) y File: /u01/app/oracle/oradata/ptod/zxy01.dbf (5) Block: 1 Offsets: 484 to 499 Dba:0x01400001 ------------------------------------------------------------------------ 3b780800 0000af76 1a167c31 01008e00 <32 bytes per line> BBED> d /v offset 484 count 16 File: /u01/app/oracle/oradata/ptod/zxy01.dbf (5) Block: 1 Offsets: 484 to 499 Dba:0x01400001 ------------------------------------------------------- 3b780800 0000af76 1a167c31 01008e00 l ;x....|1.... <16 bytes per line> BBED> modify /x 18 offset 500 File: /u01/app/oracle/oradata/ptod/zxy01.dbf (5) Block: 1 Offsets: 500 to 515 Dba:0x01400001 ------------------------------------------------------------------------ 18000000 02000000 10000000 02000000 <32 bytes per line> BBED> sum apply Check value for File 5, Block 1: current = 0x9989, required = 0x9989 BBED> exit ----在查看SCN的情况,试着recover SQL> select file#,checkpoint_change# from v$datafile; FILE# CHECKPOINT_CHANGE# ---