前提: 重建控制文件中少加一个数据文件,resetlogs后发现查表报错如下:
SQL> select *from scott.t1;
select *from scott.t1
*
ERROR at line 1:
ORA-00376: file 5 cannot be read at this time
ORA-01111: name for data file 5 is unknown - rename to correct file
ORA-01110: data file 5: '/u01/app/oracle/product/19.3.0/db/dbs/MISSING00005'
通过 reset database to incarnation 后依旧报错:
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01210: data file header is media corrupt
ORA-01110: data file : '/oradata/ORCL/test01.dbf'
ORA-01189: file is from a different RESETLOGS than previous files
ORA-01110: data file 5: '/oradata/ORCL/test01.dbf'
BBED> map /v
File: /oradata/ORCL/users01.dbf (7)
Block: 1 Dba:0x01c00001
------------------------------------------------------------
Data File Header
struct kcvfh, 1272 bytes @0
struct kcvfhbfh, 20 bytes @0 --块头,主要包含block的rdba地址和block标志(是否坏块)
struct kcvfhhdr, 76 bytes @20 --头部结构,主要包括版本号,dbid,dbname,文件大小,文件类型等
ub4 kcvfhrdb @96
struct kcvfhcrs, 8 bytes @100 --create 时候的scn ,重要
ub4 kcvfhcrt @108 --create scn 对应的时间戳
ub4 kcvfhrlc @112 --resetlogs scn 对应的时间戳
struct kcvfhrls, 8 bytes @116 --包含有resetlogs scn,重要
ub4 kcvfhbti @124
struct kcvfhbsc, 8 bytes @128 --意义不大,跟备份有关 SCN allocated when last backup started
ub2 kcvfhbth @136
ub2 kcvfhsta @138
struct kcvfhckp, 36 bytes @484 --checkpoint 信息:包含检查点信息,如检查点SCN和时间戳
ub4 kcvfhcpc @140 --datafile checkpoint count
............... .
--查看 offset 112 和 116
d /v dba 5,1 offset 112 count 10
d /v dba 5,1 offset 116 count 10
--把上面查出的值依次复制到其他文件
modify /x 562a35 dba 1,1 offset 112
sum apply
modify /x d14f1d dba 1,1 offset 116
sum apply
--最后重建控制文件resetlogs后正常
|