--改动file header

-------------------------------------------------------------------------

cd $ORACLE_H0ME/rdbms/lib

./bbed blockedit

set filename '/u01/app/oracle/product/10.2.0/db_1/dbs/test01.dbf'

show

map /v

p kcvfhckp

BBED> modify /x 005a





--拷贝 文件 那块 要好好測试 和认知









BBED> showv

        FILE#           1

        BLOCK#          1

        OFFSET          0

        DBA             0x00400001 (4194305 1,1)

        FILENAME        /u01/app/oracle/oradata/test/block.dbf

        BIFILE          bifile.bbd

        LISTFILE        list

        BLOCKSIZE       8192

        MODE            Edit

        EDIT            Unrecoverable

        IBASE           Dec

        OBASE           Dec

        WIDTH           80

        COUNT           512

        LOGFILE         log.bbd

        SPOOL           No





BBED> map /v

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                                     Dba:0x00400001

------------------------------------------------------------

 Data File Header





 struct kcvfh, 676 bytes                    @0       

    struct kcvfhbfh, 20 bytes               @0       

    struct kcvfhhdr, 76 bytes               @20      

    ub4 kcvfhrdb                            @96      

    struct kcvfhcrs, 8 bytes                @100     

    ub4 kcvfhcrt                            @108     

    ub4 kcvfhrlc                            @112     

    struct kcvfhrls, 8 bytes                @116     

    ub4 kcvfhbti                            @124     

    struct kcvfhbsc, 8 bytes                @128     

    ub2 kcvfhbth                            @136

ub2 kcvfhsta                            @138               //强制打开数据库的时候  有的资料上说这个也要改动

图片来源(oracle 实战攻略)

struct kcvfhckp, 36 bytes               @484       改动的三个部分!   9i 140 处

ub4 kcvfhcpc                            @140     

    ub4 kcvfhrts                            @144     

    ub4 kcvfhccc                            @148     

    struct kcvfhbcp, 36 bytes               @152     

    ub4 kcvfhbhz                            @312     

    struct kcvfhxcd, 16 bytes               @316     

    word kcvfhtsn                           @332     

    ub2 kcvfhtln                            @336     

    text kcvfhtnm[30]                       @338     

    ub4 kcvfhrfn                            @368     

    struct kcvfhrfs, 8 bytes                @372     

    ub4 kcvfhrft                            @380     

    struct kcvfhafs, 8 bytes                @384     

    ub4 kcvfhbbc                            @392     

    ub4 kcvfhncb                            @396     

    ub4 kcvfhmcb                            @400     

    ub4 kcvfhlcb                            @404     

    ub4 kcvfhbcs                            @408     

    ub2 kcvfhofb                            @412     

    ub2 kcvfhnfb                            @414     

    ub4 kcvfhprc                            @416     

    struct kcvfhprs, 8 bytes                @420     

    struct kcvfhprfs, 8 bytes               @428     

    ub4 kcvfhtrt                            @444     





 ub4 tailchk                                @8188    









BBED> p kcvfhckp

struct kcvfhckp, 36 bytes                   @484     

   struct kcvcpscn, 8 bytes                 @484     

      ub4 kscnbas                           @484      0x000ddc27   --

      ub2 kscnwrp                           @488      0x0000

   ub4 kcvcptim                             @492      0x2d2fe78a   --

   ub2 kcvcpthr                             @496      0x0001

   union u, 12 bytes                        @500     

      struct kcvcprba, 12 bytes             @500     

         ub4 kcrbaseq                       @500      0x00000011

         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> p kcvfhcpc

ub4 kcvfhcpc                                @140      0x00000032 --





BBED> p kcvfhccc

ub4 kcvfhccc                                @148      0x00000031 --

--改动以上几个数据就能够了

BBED> set offset 484 count 16

        OFFSET          484

        COUNT           16





BBED> dump /v

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1       Offsets:  484 to  499  Dba:0x00400001

-------------------------------------------------------

 27dc0d00 00005a00 8ae72f2d 01000000 l '?...Z..?-....





 <16 bytes per line>'

--一下是详细的实验步骤

--shutdown database and reopen to mount

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount

ORACLE instance started.





Total System Global Area  184549376 bytes

Fixed Size                  1218412 bytes

Variable Size              92276884 bytes

Database Buffers           88080384 bytes

Redo Buffers                2973696 bytes

Database mounted.

--update datafile header

BBED> show

        FILE#           1

        BLOCK#          1

        OFFSET          0

        DBA             0x00400001 (4194305 1,1)

        FILENAME        /u01/app/oracle/oradata/test/block.dbf

        BIFILE          bifile.bbd

        LISTFILE        list

        BLOCKSIZE       8192

        MODE            Edit

        EDIT            Unrecoverable

        IBASE           Dec

        OBASE           Dec

        WIDTH           80

        COUNT           512

        LOGFILE         log.bbd

        SPOOL           No





BBED> p kcvfhckp

struct kcvfhckp, 36 bytes                   @484     

   struct kcvcpscn, 8 bytes                 @484     

      ub4 kscnbas                           @484      0x000df330

      ub2 kscnwrp                           @488      0x0000

   ub4 kcvcptim                             @492      0x2d3006c5

   ub2 kcvcpthr                             @496      0x0001

   union u, 12 bytes                        @500     

      struct kcvcprba, 12 bytes             @500     

         ub4 kcrbaseq                       @500      0x00000011

         ub4 kcrbabno                       @504      0x00002da7

         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      0x00000033





BBED> p kcvfhccc

ub4 kcvfhccc                                @148      0x00000032





BBED> set offset 484 count 16

        OFFSET          484

        COUNT           16





BBED> dump /v

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1       Offsets:  484 to  499  Dba:0x00400001

-------------------------------------------------------

 30f30d00 00000000 c506302d 01000a00 l 0?.....?0-....





 <16 bytes per line>





BBED> modify /x 20

Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  484 to  499           Dba:0x00400001

------------------------------------------------------------------------

 20f30d00 00000000 c506302d 01000a00 





 <32 bytes per line>





BBED> set offset 492

        OFFSET          492





BBED> dump

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  492 to  507           Dba:0x00400001

------------------------------------------------------------------------

 c506302d 01000a00 11000000 a72d0000 





 <32 bytes per line>





BBED> modify /x c0

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  492 to  507           Dba:0x00400001

------------------------------------------------------------------------

 c006302d 01000a00 11000000 a72d0000 





 <32 bytes per line>





BBED> set offset 140

        OFFSET          140





BBED> dump

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  140 to  155           Dba:0x00400001

------------------------------------------------------------------------

 33000000 ea63292d 32000000 00000000 





 <32 bytes per line>





BBED> modify /x 31

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  140 to  155           Dba:0x00400001

------------------------------------------------------------------------

 31000000 ea63292d 32000000 00000000 





 <32 bytes per line>





BBED>  set offset 148

        OFFSET          148





BBED> modify

BBED-00203: incomplete/malformed command









BBED> modify /x 30

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  148 to  163           Dba:0x00400001

------------------------------------------------------------------------

 30000000 00000000 00000000 00000000 





 <32 bytes per line>





BBED> sum apply-------------------------------------------------------------------------------------

Check value for File 1, Block 1:

current = 0xa51f, required = 0xa51f

--alter database open

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01113: file 5 needs media recovery

ORA-01110: data file 5: '/u01/app/oracle/oradata/test/block.dbf'

--modify the file header from system

BBED> set offset 484 count 16

        OFFSET          484

        COUNT           16





BBED> dump /v

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1       Offsets:  484 to  499  Dba:0x00400001

-------------------------------------------------------

 30f30d00 00000000 c506302d 01000a00 l 0?.....?0-....





 <16 bytes per line>





BBED> modify /x 20

Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  484 to  499           Dba:0x00400001

------------------------------------------------------------------------

 20f30d00 00000000 c506302d 01000a00 





 <32 bytes per line>





BBED> set offset 492

        OFFSET          492





BBED> dump

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  492 to  507           Dba:0x00400001

------------------------------------------------------------------------

 c506302d 01000a00 11000000 a72d0000 





 <32 bytes per line>





BBED> modify /x c0

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  492 to  507           Dba:0x00400001

------------------------------------------------------------------------

 c006302d 01000a00 11000000 a72d0000 





 <32 bytes per line>





BBED> set offset 140

        OFFSET          140





BBED> dump

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  140 to  155           Dba:0x00400001

------------------------------------------------------------------------

 33000000 ea63292d 32000000 00000000 





 <32 bytes per line>





BBED> modify /x 31

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  140 to  155           Dba:0x00400001

------------------------------------------------------------------------

 31000000 ea63292d 32000000 00000000 





 <32 bytes per line>





BBED>  set offset 148

        OFFSET          148





BBED> modify

BBED-00203: incomplete/malformed command









BBED> modify /x 30

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  148 to  163           Dba:0x00400001

------------------------------------------------------------------------

 30000000 00000000 00000000 00000000 





 <32 bytes per line>





BBED> sum apply

Check value for File 1, Block 1:

current = 0xa51f, required = 0xa51f





BBED> set offset 484

        OFFSET          484





BBED> dump /v count 16

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1       Offsets:  484 to  499  Dba:0x00400001

-------------------------------------------------------

 20f30d00 00000000 c006302d 01000a00 l  ?.....?0-....





 <16 bytes per line>





BBED> modify /x 30

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  484 to  499           Dba:0x00400001

------------------------------------------------------------------------

 30f30d00 00000000 c006302d 01000a00 





 <32 bytes per line>





BBED> set offset 492 

        OFFSET          492





BBED> dump /v

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1       Offsets:  492 to  507  Dba:0x00400001

-------------------------------------------------------

 c006302d 01000a00 11000000 a72d0000 l ?0-........?..





 <16 bytes per line>





BBED> modify /c5

BBED-00201: invalid switch (/c5)









BBED> modify /x c5

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  492 to  507           Dba:0x00400001

------------------------------------------------------------------------

 c506302d 01000a00 11000000 a72d0000 





 <32 bytes per line>





BBED> set offset 140

        OFFSET          140





BBED> dump /v

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1       Offsets:  140 to  155  Dba:0x00400001

-------------------------------------------------------

 31000000 ea63292d 30000000 00000000 l 1...阠)-0.......





 <16 bytes per line>





BBED> modify /x 33

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  140 to  155           Dba:0x00400001

------------------------------------------------------------------------

 33000000 ea63292d 30000000 00000000 





 <32 bytes per line>





BBED> set offset 148

        OFFSET          148





BBED> dump /v

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1       Offsets:  148 to  163  Dba:0x00400001

-------------------------------------------------------

 30000000 00000000 00000000 00000000 l 0...............





 <16 bytes per line>





BBED> modify /x 32

 File: /u01/app/oracle/oradata/test/block.dbf (1)

 Block: 1                Offsets:  148 to  163           Dba:0x00400001

------------------------------------------------------------------------

 32000000 00000000 00000000 00000000 





 <32 bytes per line>





BBED> sum apply

Check value for File 1, Block 1:

current = 0xa50a, required = 0xa50a

--open the database

SQL> alter database open;





Database altered.





SQL> 

--------------------------------------------------------------------

--数据有坏块 时候是否影响启动

--corrupt the block

BBED> p kcbh

struct kcbh, 20 bytes                       @0       

   ub1 type_kcbh                            @0        0x06

   ub1 frmt_kcbh                            @1        0xa2

   ub1 spare1_kcbh                          @2        0x00

   ub1 spare2_kcbh                          @3        0x00

   ub4 rdba_kcbh                            @4        0x0140000c

   ub4 bas_kcbh                             @8        0x000de97d

   ub2 wrp_kcbh                             @12       0x0000

   ub1 seq_kcbh                             @14       0x02

   ub1 flg_kcbh                             @15       0x04 (KCBHFCKV)

   ub2 chkval_kcbh                          @16       0x1c9c

   ub2 spare3_kcbh                          @18       0x0000





BBED> corrupt

Block marked media corrupt.





BBED> v

DBVERIFY - Verification starting

FILE = /u01/app/oracle/oradata/test/block.dbf

BLOCK = 12





Block Checking: DBA = 4194316, Block Type = KTB-managed data block

Found block already marked corrupted





DBVERIFY - Verification complete





Total Blocks Examined         : 1

Total Blocks Processed (Data) : 1

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





BBED> p kcbh

struct kcbh, 20 bytes                       @0       

   ub1 type_kcbh                            @0        0x06

   ub1 frmt_kcbh                            @1        0xa2

   ub1 spare1_kcbh                          @2        0x00

   ub1 spare2_kcbh                          @3        0x00

   ub4 rdba_kcbh                            @4        0x0040000c

   ub4 bas_kcbh                             @8        0x00000000

   ub2 wrp_kcbh                             @12       0x0000

   ub1 seq_kcbh                             @14       0xff  --原来是02

   ub1 flg_kcbh                             @15       0x04 (KCBHFCKV)

   ub2 chkval_kcbh                          @16       0x1d91

   ub2 spare3_kcbh                          @18       0x0000





BBED> sum apply

Check value for File 1, Block 12:

current = 0x1d91, required = 0x1d91

--reopen the database

SQL> alter database open;





Database altered.





SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.





Total System Global Area  184549376 bytes

Fixed Size                  1218412 bytes

Variable Size              92276884 bytes

Database Buffers           88080384 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

SQL> 

--一般坏块不影响数据库的启动

--改动回来 用corropt改动不会来 奶奶的 还是简单改改ff吧  revert 能够的 注意呀 奶奶的

--跟踪文件中的错误

Bad header found during buffer read

Data in bad block:

 type: 6 format: 2 rdba: 0x0040000c

 last change scn: 0x0000.00000000 seq: 0x2 flg: 0x04

 spare1: 0x0 spare2: 0x0 spare3: 0x0

 consistency value in tail: 0x00000602

 check value in block header: 0x1d91

 computed block checksum: 0x0

Reread of rdba: 0x0140000c (file 5, block 12) found same corrupted data

-----------------------------------------------------------------------

改动file header (測)的更多相关文章

  1. SQL Server通过File Header Page来进行Crash Recovery

    SQL Server通过File Header Page来进行Crash Recovery 看了盖总的一篇文章 http://www.eygle.com/archives/2008/11/oracle ...

  2. Oracle bbed 实用示例-----File Header Reset

    一.查看当前环境 1.1 当前控制文件中的SCN号 [oracle@ora10 ~]$ sqlplus /nolog SQL :: Copyright (c) , , Oracle. All righ ...

  3. this inspection reports usage of the default file template for file header

    使用idea创建一个java class的时候会出现如下的warning: this inspection reports usage of the default file template for ...

  4. 【Oracle】IMP-00010: not a valid export file, header failed verification

    别人给了一个Oracle文件,结果在导入的时候发现有问题,报错如下: IMP-00010: not a valid export file, header failed verification 在网 ...

  5. sublime text 3插件---File Header配置

    今天趁着有点闲工夫,准备好好配置一下sublime环境,毕竟天天见面. 首当其冲的就是FileHeader插件了,安装它之后就懒得配置过.(方便起见,以下简称FH) FH是一个为文件自动添加前缀字段的 ...

  6. VSCode Plugin & Auto File Header Comments Generator

    VSCode Plugin & Auto File Header Comments Generator Xcode SwiftUI // // ContentView.swift // Mem ...

  7. oracle data file header replace(測)

    SQL> create tablespace rm_tbs datafile 'f1.dbf' size 10m; Tablespace created. SQL> select file ...

  8. Watch gcc at ubuntu 12,See ELF file header

    first write article at my ubuntu 12. ELF is very important file format.

  9. vscode使用插件来添加文件说明和函数说明——42header——psioniq File Header——koroFileHeader

    安装号以后,设置快捷键如下: 同时需要根据自己的需要的修改json文件 // 文件头部注释 "fileheader.customMade": { "Description ...

随机推荐

  1. urllib模块

    python爬虫-urllib模块   urllib 模块是一个高级的 web 交流库,其核心功能就是模仿web浏览器等客户端,去请求相应的资源,并返回一个类文件对象.urllib 支持各种 web ...

  2. 【从零开始,从内核驱动驱动到用户空间调用】编写第一个linux驱动,通过端口访问I/O寄存器。

    目的: 通过I/O端口方式访问RTC的秒寄存器: 由于本人从来没看过linux方面的书籍,也只是会在终端用些常用的命令而已,这次老大叫我学着通过I/O端口方式直接去读写寄存器.于是我在google中搜 ...

  3. innerHeight与clientHeight、innerWidth与clientWidth、scrollLeft与pageXOffset等属性

    区分innerHeight与clientHeight.innerWidth与clientWidth.scrollLeft与pageXOffset等属性 标签: innerheight clienthe ...

  4. AspNet MVC4 教学-22:Asp.Net MVC4 Partial View 技术高速应用Demo

    A.创建Basic类型的MVC项目. B.Model文件夹下,创建文件: LoginModel.cs: using System; using System.Collections.Generic; ...

  5. access数据库:怎么直接从access里把数据里同样的文字替换成空字符&quot;&quot;

    access数据库:怎么直接从access里把数据里同样的文字替换成空字符"" 搜所到文字后,替换的项里写"",就是了.一定要是英文的""

  6. 解决VTune错误.../lib64/libstdc++.so.6: version `GLIBCXX_3.4.14&#39; not found (required by ...)

    错误信息及出现情景: 在export环境变量LD_PRELOAD=$XTERN_ROOT/dync_hook/interpose.so后,再执行amplxe-gui,出现上述错误.新增的动态链接库对V ...

  7. SVM(支持向量机)(二)—Lagrange Duality(拉格朗日对偶问题)

    (整理自AndrewNG的课件,转载请注明.整理者:华科小涛@http://www.cnblogs.com/hust-ghtao/) SVM有点让人头疼,但还是要弄明白.把这一大块搞懂了,会很有成就感 ...

  8. 网页 css

    css---- 层叠样式表(Cascading Style Sheet) 一,层叠样式表的分类 1,外部样式表:在外部定义样式表,然后在页面head里面附加该样式表 2,内嵌样式表:直接在网页head ...

  9. Servlet的学习(二)

    本篇接上一篇<Servlet的学习(一)>,讲述如何利用MyEclipse来创建web工程, 同时讲述如何在MyEclipse中配置Tomcat服务器. 在MyEclipse中,新建“We ...

  10. DM8168硬件平台

    DM8168硬件平台  作者:Marvin_wu TMS320DM8168是一款多核SoC,它集成了包含ARM Cortex A8.DSP C674X+.M3 VIDEO.M3 VPSS等处理器.DS ...