oracle特殊恢复-bbed修改某个数据文件头

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

1、环境如下

使用Oracle 11gR2进行测试,具体版本为11.2.0.4

[email protected] SQL>select file#,name,checkpoint_change#,checkpoint_time from v$datafile;

     FILE# NAME                                     CHECKPOINT_CHANGE# CHECKPOINT_TIME
---------- ---------------------------------------- ------------------ -------------------
         1 /dbdata/oradata/xbtst/system01.dbf                  1233066 2016-11-10 11:23:44
         2 /dbdata/oradata/xbtst/sysaux01.dbf                  1233066 2016-11-10 11:23:44
         3 /dbdata/oradata/xbtst/undotbs01.dbf                 1233066 2016-11-10 11:23:44
         4 /dbdata/oradata/xbtst/users01.dbf                   1233066 2016-11-10 11:23:44
         5 /dbdata/oradata/xbtst/moe01.dbf                     1233066 2016-11-10 11:23:44

2、模拟某个数据文件在问题

shutdown immediate数据库,然后拷贝moe01.dbf这个数据文件,然后打开数据库,做日志切换,然后shutdown immediate,再把之前的拷贝替换现在的moe01.dbf数据文件

[email protected] SQL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

[[email protected] xbtst]$ cp moe01.dbf moe01.dbf.bak
[[email protected] xbtst]$ 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

[email protected] 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.

[email protected] SQL>alter system switch logfile;

System altered.

[email protected] SQL>alter system switch logfile;

System altered.

[email protected] SQL>alter system switch logfile;

System altered.

[email protected] SQL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

[[email protected] xbtst]$ cp moe01.dbf moe01.dbf.bak.f
[[email protected] xbtst]$ cp moe01.dbf.bak moe01.dbf

启动数据库报错
[email protected] 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/xbtst/moe01.dbf‘

[email protected] 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

3、场景模拟出来了,下面是修复过程

使用BBED,将文件头的SCN等关键信息修改到与控制文件control file相匹配即可

[email protected] SQL>select file#, CHECKPOINT_CHANGE# from v$datafile;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1233692
         2            1233692
         3            1233692
         4            1233692
         5            1233692

[email protected] SQL>select CHECKPOINT_CHANGE# from v$database;

CHECKPOINT_CHANGE#
------------------
           1233692

[email protected] SQL>select file#, recover, fuzzy, CHECKPOINT_CHANGE# from v$datafile_header;

     FILE# REC FUZ CHECKPOINT_CHANGE#
---------- --- --- ------------------
         1 NO  NO             1233692
         2 NO  NO             1233692
         3 NO  NO             1233692
         4 NO  NO             1233692
         5 YES NO             1233063

控制文件中datafile5的scn是:1233692,而数据文件头中的scn是:1233063

使用bbed将datafile5的数据文件头对应的SCN修改为与其他文件相同,我们先看一下users01.dbf这个文件的文件头

BBED> set filename ‘/dbdata/oradata/xbtst/users01.dbf‘
        FILENAME        /dbdata/oradata/xbtst/users01.dbf

BBED> set block 1
        BLOCK#          1

BBED> map
 File: /dbdata/oradata/xbtst/users01.dbf (0)
 Block: 1                                     Dba:0x00000000
------------------------------------------------------------
 Data File Header

 struct kcvfh, 860 bytes                    @0       

 ub4 tailchk                                @8188

因为我们要修改数据文件头,因此我们需要关注四个偏移量offset点,分别为484、492、140和148

1、datafile 的file header 存储在第一个block里

2、Oracle considers four attributes of this data structure when determining if a datafile is sync with the other data files of the database:(不同oracle版本offset可能不同)

(1)kscnbas (at offset 484) – SCN of last change to the datafile.

(2)kcvcptim (at offset 492) -Time of the last change to the datafile.

(3)kcvfhcpc (at offset 140) – Checkpoint count.

(4)kcvfhccc (at offset 148) – Unknown, but is always 1 less than thecheckpoint point count.

Oracle有4个属性来判断datafile 是否和其他的datafile 一致,如果都一致,可以正常操作,如果不一致,那么会报ORA-01113错误

下面我们看下这几个offset

BBED> set offset 484
        OFFSET          484

BBED> dump
 File: /dbdata/oradata/xbtst/users01.dbf (0)
 Block: 1                Offsets:  484 to  995           Dba:0x00000000
------------------------------------------------------------------------
 1cd31200 00000000 bd384937 01000000 1b000000 30010000 100051f2 02000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 0d000d00 0d000100 00000000 00000000 00000000 02000001 03000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> set offset 492
        OFFSET          492

BBED> dump
 File: /dbdata/oradata/xbtst/users01.dbf (0)
 Block: 1                Offsets:  492 to 1003           Dba:0x00000000
------------------------------------------------------------------------
 bd384937 01000000 1b000000 30010000 100051f2 02000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100 
 00000000 00000000 00000000 02000001 03000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> set offset 140
        OFFSET          140

BBED> dump
 File: /dbdata/oradata/xbtst/users01.dbf (0)
 Block: 1                Offsets:  140 to  651           Dba:0x00000000
------------------------------------------------------------------------
 78000000 14ff4737 77000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 04000000 05005553 45525300 00000000 00000000 00000000 00000000 00000000 
 00000000 04000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 7ac92131 01000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 1cd31200 00000000 
 bd384937 01000000 1b000000 30010000 100051f2 02000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100 

 <32 bytes per line>

BBED> set offset 148
        OFFSET          148

BBED> dump
 File: /dbdata/oradata/xbtst/users01.dbf (0)
 Block: 1                Offsets:  148 to  659           Dba:0x00000000
------------------------------------------------------------------------
 77000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 04000000 05005553 
 45525300 00000000 00000000 00000000 00000000 00000000 00000000 04000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 7ac92131 01000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 1cd31200 00000000 bd384937 01000000 
 1b000000 30010000 100051f2 02000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 0d000d00 0d000100 00000000 00000000 

 <32 bytes per line>

其中,位于484和488偏移量的是数据文件对应的SCN编号。在Oracle内部,SCN是使用wrap*4*1024*1024*1024+base来进行标示的。通常我们看到的数据库wrap都是0。位于492偏移量的是最后一次检查点对应的时间信息。位于140和148偏移量的是检查点次数。这些信息都是会由于时间推动和检查点动作引起变化,我们严格情况下,需要保证文件头块的信息和控制文件信息一致。

另外一点,由于Linux是Little字节系统,要关注写入时候的格式问题。最简单的方式是dump一下偏移量,看看是怎么保存的。

BBED> dump
 File: /dbdata/oradata/xbtst/users01.dbf (0)
 Block: 1                Offsets:  484 to  995           Dba:0x00000000
------------------------------------------------------------------------
 1cd31200 00000000 bd384937 01000000 1b000000 30010000 100051f2 02000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

然后我们修改moe01.dbf的文件头(修改这几个offset,我这里只修改了484、492就可以open库了)

BBED> set filename ‘/dbdata/oradata/xbtst/moe01.dbf‘
        FILENAME        /dbdata/oradata/xbtst/moe01.dbf

BBED> set block 1
        BLOCK#          1

BBED> set mode edit
        MODE            Edit

BBED> set offset 484
        OFFSET          484

BBED> dump
 File: /dbdata/oradata/xbtst/moe01.dbf (0)
 Block: 1                Offsets:  484 to  995           Dba:0x00000000
------------------------------------------------------------------------
 a7d01200 00000000 52204937 01000000 18000000 4d8d0000 100051f2 02000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 0d000d00 0d000100 00000000 00000000 00000000 02004001 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> m /x 1cd31200 484
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /dbdata/oradata/xbtst/moe01.dbf (0)
 Block: 1                Offsets:  484 to  995           Dba:0x00000000
------------------------------------------------------------------------
 1cd31200 00000000 52204937 01000000 18000000 4d8d0000 100051f2 02000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 0d000d00 0d000100 00000000 00000000 00000000 02004001 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> m /x bd384937 492
BBED-00209: invalid number (bd384937)

BBED> m /x bd38 492
 File: /dbdata/oradata/xbtst/moe01.dbf (0)
 Block: 1                Offsets:  492 to 1003           Dba:0x00000000
------------------------------------------------------------------------
 bd384937 01000000 18000000 4d8d0000 100051f2 02000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 0d000d00 0d000100 
 00000000 00000000 00000000 02004001 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> m /x 4937 494
 File: /dbdata/oradata/xbtst/moe01.dbf (0)
 Block: 1                Offsets:  494 to 1005           Dba:0x00000000
------------------------------------------------------------------------
 49370100 00001800 00004d8d 00001000 51f20200 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000d00 0d000d00 01000000 
 00000000 00000000 00000200 40010000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

 <32 bytes per line>

BBED> sum apply
Check value for File 0, Block 1:
current = 0x1683, required = 0x1683

BBED> verify
DBVERIFY - Verification starting
FILE = /dbdata/oradata/xbtst/moe01.dbf
BLOCK = 1

DBVERIFY - Verification complete

Total Blocks Examined         : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing   (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing   (Index): 0
Total Blocks Empty            : 0
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
Message 531 not found;  product=RDBMS; facility=BBED

这时我们再次查看各个数据文件头的scn,发现scn一致了

[email protected] SQL>select file#, recover, fuzzy, CHECKPOINT_CHANGE# from v$datafile_header;

     FILE# REC FUZ CHECKPOINT_CHANGE#
---------- --- --- ------------------
         1 NO  NO             1233692
         2 NO  NO             1233692
         3 NO  NO             1233692
         4 NO  NO             1233692
         5 YES NO             1233692

试着open库

[email protected] SQL>alter database open
  2  ;
alter database open
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: ‘/dbdata/oradata/xbtst/moe01.dbf‘

[email protected] SQL>recover datafile 5;
Media recovery complete.
[email protected] SQL>alter database open;

Database altered.

看一下alert文件

ALTER DATABASE RECOVER  datafile 5  
Media Recovery Start
Serial Media Recovery started
Media Recovery Complete (xbtst)
Completed: ALTER DATABASE RECOVER  datafile 5  
Thu Nov 10 13:47:24 2016
alter database open
Thu Nov 10 13:47:25 2016
Thread 1 opened at log sequence 27
  Current log# 3 seq# 27 mem# 0: /dbdata/oradata/xbtst/redo03.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Thu Nov 10 13:47:25 2016
SMON: enabling cache recovery
[20910] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:3710149144 end:3710149224 diff:80 (0 seconds)
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is AL32UTF8
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Thu Nov 10 13:47:25 2016
QMNC started with pid=20, OS id=21409 
Completed: alter database open

在本次恢复过程中,recover是可行的,原因是该库并没做过resetlog,如果datafile是在 resetlog之前就已经offline的数据文件,那recover是不可行的。

时间: 2024-08-22 15:44:43

oracle特殊恢复-bbed修改某个数据文件头的相关文章

利用BBED恢复数据文件头

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/31018075 @@@@@@@利用BBED模拟损坏5文件1号块(文件头) BBED> copy file 4 block 4 to file 5 block 1 File: /u01/app/oracle/oradata/PROD/tp01.dbf (5) Block: 1 Offsets: 0 to 19 Dba:0x01400001 --------------------------

使用BBED恢复数据文件头

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/31018075 @@@@@@@利用BBED模拟损坏5文件1号块(文件头) BBED> copy file 4 block 4 to file 5 block 1 File: /u01/app/oracle/oradata/PROD/tp01.dbf (5) Block: 1 Offsets: 0 to 19 Dba:0x01400001 --------------------------

分享:bbed修改数据文件头推进scn与其他数据文件相同

场景简介: 物理copy表空间数据文件,数据库发生完全检查点,删除该表空间下的数据文件,使该表空间数据文件头的scn与其他数据文件不一致. 场景构造: 1.  创建测试表空间 [email protected]> create tablespace bbed datafile '/u01/app/oracle/oradata/orser/bbed01.dbf' size 10M autoextend on; Tablespace created 2.  物理cp数据文件(最好先做备份) [[em

bbed 修复数据文件头

把同一表空间下的好的数据文件头拷贝到有问题的数据文件头,例如: copy file x block 1 to file y block 1,然后按如下offset来确认并修改. rdba_kcbh (offset  4)  即使文件头block的rdba地址 2. kccfhfsz (offset  44) 即文件大小 3. kccfhfno (offset  52) 即datafile文件号 4. kscnbas  (offset 100) 即v$datafile.create_change#

一次数据文件头不一致恢复

[email protected]>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须要介质恢复 [email p

关于oracle实例恢复的前滚和回滚的理解

关于oracle实例恢复的一些理解,一直都有误区,今天通过查看相关资料和与同学探讨,发觉了自己的错误,探讨结果如下: 实例恢复:当数据库非正常关闭的时候(断电或者shu  abort等等非一致性关闭),当你从新启动数据库的时候,数据库相关进程自动进行实例恢复,无须人工干预. 什么时候需要实例恢复 在shutdown normal or shutdown immediate下,也就是所谓的clean shutdown,checkpoint也会自动触发,并且把SCN纪录写回. 当发生checkpoi

Oracle 实例恢复

-======================= -- Oracle 实例恢复 --======================= 一.Oracle实例失败 Oracle实例失败多为实例非一致性关闭所致,通常称为崩溃(crash).实例失败的结果等同于shutdown abort. 实例失败的原因 电源负载故障 硬件故障 后台进程失败 异常关闭数据库 实例失败后的状况 数据库可能丢失已提交的事务以及存储了未提交的事务,导致数据库出现不一致的情况 解决方案 使用startup 重新启动实例.实例实

【表空间支持的最大数据文件大小的算法】【数据库限制】【数据文件文件头保留数据块数】

本地管理表空间中设置不同大小的db_block_size时数据文件头保留空间相应例如以下:--?? db_block_size=2KB,文件头保留32个数据块,即64KB. db_block_size=4KB.文件头保留16个数据块,即64KB. db_block_size=8KB,文件头保留8个数据块,即64KB. db_block_size=16KB,文件头保留4个数据块.即64KB. db_block_size=32KB,文件头保留4个数据块.即128KB. --为什么不是64kb? 默认

使用bbed修改文件头,推进scn,找到offline drop的数据文件

最近处理了一起由于用户操作错误导致的数据库无法打开的情况. 用户数据库为windows 64bit,数据库版本为11.2.0.1,非归档模式.由于异常断电,数据库无法正常打开,而且经过用户的判断使用了错误的offline drop操作.导致数据库打开后,日志文件切换过多,无法使用recover命令. 因为中间没有做其他操作,所以接到case后,这里将受损的几个数据文件copy到linux下使用bbed进行修改,再copy回windows,成功跳过recover,打开了offline drop的数