SYS@orcl11g>alter database datafile 6 online;
alter database datafile 6 online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/opt/oracle/oradata/orcl11g/zbdba01.dbf'
有时候我们数据文件offline之后,再online需要介质恢复
SYS@orcl11g>select file#,name,status from v$datafile;
FILE# NAME STATUS
---------- ------------------------------------------------------------ ------------------------------------------------------------
1 /opt/oracle/oradata/orcl11g/system01.dbf SYSTEM
2 /opt/oracle/oradata/orcl11g/sysaux01.dbf ONLINE
3 /opt/oracle/oradata/orcl11g/undotbs01.dbf ONLINE
4 /opt/oracle/oradata/orcl11g/users01.dbf ONLINE
5 /opt/oracle/oradata/orcl11g/zbdba.dbf ONLINE
6 /opt/oracle/oradata/orcl11g/zbdba01.dbf RECOVER
7 /opt/oracle/oradata/orcl11g/test.dbf ONLINE
但是我们归档已经丢失,无法完成介质恢复:
SYS@orcl11g>recover datafile 6;
ORA-00279: change 1986632 generated at 10/28/2014 05:16:11 needed for thread 1
ORA-00289: suggestion : /opt/oracle/flash_recovery_area/ORCL11G/archivelog/2014_10_28/o1_mf_1_74_b4yqrglr_.arc
ORA-00280: change 1986632 for thread 1 is in sequence #74
Specify log: {=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log '/opt/oracle/flash_recovery_area/ORCL11G/archivelog/2014_10_28/o1_mf_1_74_b4yqrglr_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
所以这时候我们直接修改文件头进行online:
[oracle@ogg1 lib]$ bbed parfile=par.txt
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Tue Oct 28 05:20:19 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED>
BBED>
BBED> info all
File# Name Size(blks)
----- ---- ----------
1 /opt/oracle/oradata/orcl11g/system01.dbf 0
2 /opt/oracle/oradata/orcl11g/sysaux01.dbf 0
3 /opt/oracle/oradata/orcl11g/undotbs01.dbf 0
4 /opt/oracle/oradata/orcl11g/users01.dbf 0
5 /opt/oracle/oradata/orcl11g/zbdba.dbf 0
6 /opt/oracle/oradata/orcl11g/zbdba01.dbf 0
7 /opt/oracle/oradata/orcl11g/test.dbf 0
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x001e526c
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x3362e202
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000004d
ub4 kcrbabno @504 0x000001a6
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> p kcvfhcpc
ub4 kcvfhcpc @140 0x000000f9
BBED> p kcvfhccc
ub4 kcvfhccc @148 0x000000f8
BBED> set file 6 block 1
FILE# 6
BLOCK# 1
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x001e5048
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x3362e11b
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000004a
ub4 kcrbabno @504 0x00005801
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 0x