BBED修改某个数据文件头

Oracle数据文件头中的scn要与控制文件中的scn一致,数据库才可以open,在open过程中我们可以通过bbed来修改某个数据文件头的scn,来欺骗oracle,来open库。

1、环境如下
使用Oracle 11gR2进行测试,具体版本为11.2.0.4
SYS@linuxidc SQL>select file#,name,checkpoint_change#,checkpoint_time from v$datafile;
 
    FILE# NAME                                    CHECKPOINT_CHANGE# CHECKPOINT_TIME
---------- ---------------------------------------- ------------------ -------------------
        1 /dbdata/oradata/linuxidc/system01.dbf                  1233066 2016-11-10 11:23:44
        2 /dbdata/oradata/linuxidc/sysaux01.dbf                  1233066 2016-11-10 11:23:44
        3 /dbdata/oradata/linuxidc/undotbs01.dbf                1233066 2016-11-10 11:23:44
        4 /dbdata/oradata/linuxidc/users01.dbf                  1233066 2016-11-10 11:23:44
        5 /dbdata/oradata/linuxidc/moe01.dbf                    1233066 2016-11-10 11:23:44

2、模拟某个数据文件在问题
shutdown immediate数据库,然后拷贝moe01.dbf这个数据文件,然后打开数据库,做日志切换,然后shutdown immediate,再把之前的拷贝替换现在的moe01.dbf数据文件
SYS@linuxidc SQL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 
[oracle@tstdb-25-220 linuxidc]$ cp moe01.dbf moe01.dbf.bak
[oracle@tstdb-25-220 linuxidc]$ ll
总用量 3872076
-rw-r-----. 1 oracle oinstall    9748480 11月 10 09:48 control01.ctl
-rw-r-----. 1 oracle oinstall    9748480 11月 10 09:48 control02.ctl
-rw-r-----. 1 oracle oinstall 1073750016 11月 10 09:48 moe01.dbf
-rw-r-----. 1 oracle oinstall 1073750016 11月 10 11:23 moe01.dbf.bak
-rw-r-----. 1 oracle oinstall  52429312 11月  9 13:13 redo01.log
-rw-r-----. 1 oracle oinstall  52429312 11月  9 22:00 redo02.log
-rw-r-----. 1 oracle oinstall  52429312 11月 10 09:48 redo03.log
-rw-r-----. 1 oracle oinstall  587210752 11月 10 09:48 sysaux01.dbf
-rw-r-----. 1 oracle oinstall  807411712 11月 10 09:48 system01.dbf
-rw-r-----. 1 oracle oinstall  30416896 11月  9 22:00 temp01.dbf
-rw-r-----. 1 oracle oinstall  131080192 11月 10 09:48 undotbs01.dbf
-rw-r-----. 1 oracle oinstall  111419392 11月 10 09:48 users01.dbf
 
SYS@linuxidc SQL>startup
ORACLE instance started.
 
Total System Global Area 2455228416 bytes
Fixed Size                  2255712 bytes
Variable Size            620758176 bytes
Database Buffers        1811939328 bytes
Redo Buffers              20275200 bytes
Database mounted.
Database opened.
 
SYS@linuxidc SQL>alter system switch logfile;
 
System altered.
 
SYS@linuxidc SQL>alter system switch logfile;
 
System altered.
 
SYS@linuxidc SQL>alter system switch logfile;
 
System altered.
 
SYS@linuxidc SQL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 
[oracle@tstdb-25-220 linuxidc]$ cp moe01.dbf moe01.dbf.bak.f
[oracle@tstdb-25-220 linuxidc]$ cp moe01.dbf.bak moe01.dbf
 
启动数据库报错
SYS@linuxidc SQL>startup
ORACLE instance started.
 
Total System Global Area 2455228416 bytes
Fixed Size                  2255712 bytes
Variable Size            620758176 bytes
Database Buffers        1811939328 bytes
Redo Buffers              20275200 bytes
Database mounted.
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '/dbdata/oradata/linuxidc/moe01.dbf'
 
SYS@linuxidc SQL>recover datafile 5;
ORA-00279: change 1233063 generated at 11/10/2016 09:48:02 needed for thread 1
ORA-00289: suggestion : /apps/oracle/11.2.0/db_1/dbs/arch1_24_925478204.dbf
ORA-00280: change 1233063 for thread 1 is in sequence #24
 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log '/apps/oracle/11.2.0/db_1/dbs/arch1_24_925478204.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
 
 
ORA-00308: cannot open archived log '/apps/oracle/11.2.0/db_1/dbs/arch1_24_925478204.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/0396d572cc25ac9eddec321a61cba1ec.html