一文掌握Oracle高级专家必备神技之bbed从入门到放弃!

2024年 4月 17日 83.6k 0

BBED工具介绍:

BBED工具大家都知道吧,高级工程师必备技能,可以不用,但不可以不会,学习起来也非常简单,总共分三步:

1.下载安装;2.登录BBED;3.一脸懵逼,直接放弃 ...

但BBED实在是太强大了,就这么放弃,让我怎么在群里愉快的玩耍。

再次打开BBED的帮助信息,我发现BBED工具一共可分为19种命令,那么是不是学会这19种命令,明白每个命令的用途及使用场景就可以入门了,抱着试一试的想法,我开始了下面的学习:

再正经的看一下BBED工具介绍:

BBED(Oracle Block Brower and EDitor Tool),用来直接查看和修改数据文件数据的一个工具,是Oracle一款内部工具,可以直接修改Oracle数据文件块的内容,在一些极端恢复场景下比较有用。

本文内容:

    一:BBED安装
    二:BBED工具使用案例
    三:BBED常用命令介绍

    一:BBED安装

    上传文件

      [oracle@cjc-db-01 soft]$ ls -lrth
      total 20K
      -rw-r--r-- 1 oracle oinstall 8.5K Apr 14 21:26 bbedus.msb
      -rw-r--r-- 1 oracle oinstall 1.9K Apr 14 21:26 sbbdpt.o
      -rw-r--r-- 1 oracle oinstall 1.2K Apr 14 21:26 ssbbded.o

      拷贝文件到对于目录

        [oracle@cjc-db-01 soft]$ cp bbedus.msb $ORACLE_HOME/rdbms/mesg/
        [oracle@cjc-db-01 soft]$ cp ssbbded.o $ORACLE_HOME/rdbms/lib/
        [oracle@cjc-db-01 soft]$ cp sbbdpt.o $ORACLE_HOME/rdbms/lib/

        编译

          [oracle@cjc-db-01 soft]$ cd $ORACLE_HOME/rdbms/lib
          [oracle@cjc-db-01 lib]$ make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed

          编译日志如下

            Linking BBED utility (bbed)
            rm -f oracle/app/oracle/product/11.2/db/bin/bbed
            gcc -o oracle/app/oracle/product/11.2/db/bin/bbed -m64 -z noexecstack -L/oracle/app/oracle/product/11.2/db/rdbms/lib/ -L/oracle/app/oracle/product/11.2/db/lib/ -L/oracle/app/oracle/product/11.2/db/lib/stubs/ /oracle/app/oracle/product/11.2/db/lib/s0main.o oracle/app/oracle/product/11.2/db/rdbms/lib/ssbbded.o oracle/app/oracle/product/11.2/db/rdbms/lib/sbbdpt.o `cat oracle/app/oracle/product/11.2/db/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -ldbtools11 -lclntsh `cat oracle/app/oracle/product/11.2/db/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat oracle/app/oracle/product/11.2/db/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat oracle/app/oracle/product/11.2/db/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat oracle/app/oracle/product/11.2/db/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat oracle/app/oracle/product/11.2/db/lib/sysliblist` -Wl,-rpath,/oracle/app/oracle/product/11.2/db/lib -lm `cat oracle/app/oracle/product/11.2/db/lib/sysliblist` -ldl -lm -L/oracle/app/oracle/product/11.2/db/lib

            登录测试

            bbed 默认密码" blockedit"

              [oracle@cjc-db-01 ~]$ bbed
              Password:


              BBED: Release 2.0.0.0.0 - Limited Production on Sun Apr 14 21:35:30 2024


              Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.


              ************* !!! For Oracle Internal Use only !!! ***************


              BBED> exit

              使用BBED 工具之前需要创建filelist 文件

                set heading off
                set feedback off
                set linesize 100
                col name for a45
                spool home/oracle/bbed/filelist.txt
                select file#,name,bytes from v$datafile order by 1;
                spool off
                exit;

                去掉SQL、空号等

                  [oracle@cjc-db-01 bbed]$ cat filelist.txt
                  1 /oracle/app/oracle/oradata/cjc/system01.dbf 786432000
                  2 /oracle/app/oracle/oradata/cjc/sysaux01.dbf 566231040
                  3 /oracle/app/oracle/oradata/cjc/undotbs01.dbf 94371840
                  4 /oracle/app/oracle/oradata/cjc/users01.dbf 5242880
                  5 /oracle/app/oracle/oradata/cjc/example01.dbf 363069440
                  6 /oradata/cjctbs.dbf 11599872
                  7 /oradata/chentbs.dbf 1048576

                    [oracle@cjc-db-01 bbed]$ vi bbed.par
                    blocksize=8192
                    listfile=/home/oracle/bbed/filelist.txt
                    mode=edit
                    password=blockedit

                    登录

                      [oracle@cjc-db-01 bbed]$ bbed parfile=bbed.par


                      BBED: Release 2.0.0.0.0 - Limited Production on Sun Apr 14 21:45:29 2024


                      Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.


                      ************* !!! For Oracle Internal Use only !!! ***************


                      BBED> info
                      File# Name Size(blks)
                      ----- ---- ----------
                      1 oracle/app/oracle/oradata/cjc/system01.dbf 96000
                      2 oracle/app/oracle/oradata/cjc/sysaux01.dbf 69120
                      3 oracle/app/oracle/oradata/cjc/undotbs01.dbf 11520
                      4 oracle/app/oracle/oradata/cjc/users01.dbf 640
                      5 oracle/app/oracle/oradata/cjc/example01.dbf 44320
                      6 oradata/cjctbs.dbf 1416
                      7 oradata/chentbs.dbf 128

                      二:BBED工具使用案例

                      通过BBED工具查询UNDO段名;

                      这也是在数据库无法OPEN情况下,如何获取UNDO段名的一种方法,有些隐含参数需要这些段名。

                      其中,Oracle 11g 版本, undo$ 表信息一般位于 1 号文件第 225 个数据块中。

                        BBED> set file 1 block 225
                        FILE# 1
                        BLOCK# 225

                        通过  sb2 kdbr[21] 可以看到,存在21个回滚段名

                          BBED> map
                          File: /oracle/app/oracle/oradata/cjc/system01.dbf (1)
                          Block: 225 Dba:0x004000e1
                          ------------------------------------------------------------
                           KTB Data Block (Table/Cluster)


                          struct kcbh, 20 bytes @0


                          struct ktbbh, 48 bytes @20


                          struct kdbh, 14 bytes @68


                          struct kdbt[1], 4 bytes @82


                          sb2 kdbr[21] @86


                          ub1 freespace[4007] @128


                          ub1 rowdata[4053] @4135


                          ub4 tailchk @8188

                          继续查询(包括已经删除的)

                            BBED> p kdbr
                            sb2 kdbr[0] @86 8078
                            sb2 kdbr[1] @88 4337
                            sb2 kdbr[2] @90 5015
                            sb2 kdbr[3] @92 4947
                            sb2 kdbr[4] @94 4879
                            sb2 kdbr[5] @96 4812
                            sb2 kdbr[6] @98 4202
                            sb2 kdbr[7] @100 4676
                            sb2 kdbr[8] @102 4609
                            sb2 kdbr[9] @104 4067
                            sb2 kdbr[10] @106 4472
                            sb2 kdbr[11] @108 5877
                            sb2 kdbr[12] @110 5814
                            sb2 kdbr[13] @112 5748
                            sb2 kdbr[14] @114 5682
                            sb2 kdbr[15] @116 5616
                            sb2 kdbr[16] @118 5550
                            sb2 kdbr[17] @120 5484
                            sb2 kdbr[18] @122 5418
                            sb2 kdbr[19] @124 5352
                            sb2 kdbr[20] @126 5286

                            查看具体段名称

                              BBED> x rnc *kdbr[0]
                              rowdata[4011] @8146
                              -------------
                              flag@8146: 0x2c (KDRHFL, KDRHFF, KDRHFH)
                              lock@8147: 0x00
                              cols@8148:   17
                              col 0[1] @8149: 0
                              col 1[6] @8151: SYSTEM

                                BBED> x rnc *kdbr[1]
                                ......
                                col 1[20] @4411: _SYSSMU1_3724004606$
                                ......

                                验证:

                                  SQL> select SEGMENT_NAME,STATUS from dba_rollback_segs;


                                  SEGMENT_NAME STATUS
                                  ------------------------------ ----------------
                                  SYSTEM ONLINE
                                  _SYSSMU10_1197734989$ ONLINE
                                  _SYSSMU9_1650507775$ ONLINE
                                  _SYSSMU8_517538920$ ONLINE
                                  _SYSSMU7_2070203016$ ONLINE
                                  _SYSSMU6_1263032392$ ONLINE
                                  _SYSSMU5_898567397$ ONLINE
                                  _SYSSMU4_1254879796$ ONLINE
                                  _SYSSMU3_1723003836$ ONLINE
                                  _SYSSMU2_2996391332$ ONLINE
                                  _SYSSMU1_3724004606$ ONLINE


                                  11 rows selected.

                                  那么上面的这些命令是什么意思呢,别着急,学完下面的内容,你就会发现,你更不会了!

                                  三:BBED常用命令介绍

                                  查看帮助信息

                                    BBED> help all
                                    SET DBA [ dba | file#, block# ]
                                    SET FILENAME 'filename'
                                    SET FILE file#
                                    SET BLOCK [+/-]block#
                                    SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
                                    SET BLOCKSIZE bytes
                                    SET LIST[FILE] 'filename'
                                    SET WIDTH character_count
                                    SET COUNT bytes_to_display
                                    SET IBASE [ HEX | OCT | DEC ]
                                    SET OBASE [ HEX | OCT | DEC ]
                                    SET MODE [ BROWSE | EDIT ]
                                    SET SPOOL [ Y | N ]
                                    SHOW [ | ALL ]
                                    INFO
                                    MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
                                    DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
                                    PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
                                    EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
                                    :
                                    N - a number which specifies a repeat count.
                                    u - a letter which specifies a unit size:
                                    b - b1, ub1 (byte)
                                    h - b2, ub2 (half-word)
                                    w - b4, ub4(word)
                                    r - Oracle table/index row
                                    f - a letter which specifies a display format:
                                    x - hexadecimal
                                    d - decimal
                                    u - unsigned decimal
                                    o - octal
                                    c - character (native)
                                    n - Oracle number
                                    t - Oracle date
                                    i - Oracle rowid
                                    FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
                                    COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]
                                    MODIFY[/x|d|u|o|c] numeric/character string
                                    [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
                                    ASSIGN[/x|d|u|o] =
                                    : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
                                    : [ value | ]
                                    SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
                                    PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]
                                    POP [ALL]
                                    REVERT [ DBA | FILE | FILENAME | BLOCK ]
                                    UNDO
                                    HELP [ | ALL ]
                                    VERIFY [ DBA | FILE | FILENAME | BLOCK ]
                                    CORRUPT [ DBA | FILE | FILENAME | BLOCK ]

                                    可以看到,一共19种命令:

                                      1.SET
                                      2.SHOW
                                      3.INFO
                                      4.MAP
                                      5.DUMP
                                      6.PRINT
                                      7.EXAMINE
                                      8.FIND
                                      9.COPY
                                      10.MODIFY
                                      11.ASSIGN
                                      12.SUM
                                      13.PUSH
                                      14.POP
                                      15.REVERT
                                      16.UNDO
                                      17.HELP
                                      18.VERIFY
                                      19.CORRUPT

                                      常用命令介绍

                                      1.set 

                                      设定当前的环境

                                        BBED> help set
                                        SET DBA [ dba | file#, block# ]
                                        SET FILENAME 'filename'
                                        SET FILE file#
                                        SET BLOCK [+/-]block#
                                        SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
                                        SET BLOCKSIZE bytes
                                        SET LIST[FILE] 'filename'
                                        SET WIDTH character_count
                                        SET COUNT bytes_to_display
                                        SET IBASE [ HEX | OCT | DEC ]
                                        SET OBASE [ HEX | OCT | DEC ]
                                        SET MODE [ BROWSE | EDIT ]
                                        SET SPOOL [ Y | N ]

                                        例如:

                                          SQL> conn cjc/a
                                          SQL> create table t3(xxx varchar2(10));
                                          SQL> insert into t3 values('cjc');
                                          SQL> insert into t3 values('aaa');
                                          SQL> insert into t3 values('xxx cjc');
                                          SQL> commit;
                                          select
                                          xxx,
                                          rowid,
                                          dbms_rowid.rowid_relative_fno(rowid) rel_fno,
                                          dbms_rowid.rowid_block_number(rowid) blockno,
                                          dbms_rowid.rowid_row_number(rowid) rowno
                                          from t3;


                                          XXX ROWID REL_FNO BLOCKNO ROWNO
                                          ---------- ------------------ ---------- ---------- ----------
                                          cjc AAAVqGAAGAAAACvAAA 6175 0
                                          aaa AAAVqGAAGAAAACvAAB 6175 1
                                          xxx cjc AAAVqGAAGAAAACvAAC 6175 2

                                            BBED> set dba 1,175
                                            DBA 0x004000af (4194479 1,175)

                                            如果设置成功,会返回该block的RDBA (Relative Data Block Address),rdba就是rowid中的rfile#+block#。括号里面的是DBA值和block 和 file id。 我们验证一下:

                                            验证:

                                            #查找数据块的RDBA,和BBED结果相同。

                                              SQL> select dbms_utility.make_data_block_address(1,175) rdba from dual;
                                              RDBA
                                              ----------
                                              4194479

                                              #根据RDBA查看数据块文件号,块号

                                                SQL> SELECT dbms_utility.data_block_address_file(4194479) file#,dbms_utility.data_block_address_block(4194479) block# from dual;
                                                FILE# BLOCK#
                                                ---------- ----------
                                                1 175

                                                2.show 

                                                查看当前的环境参数,跟sqlplus的同名命令类似。

                                                  BBED> help show
                                                  SHOW [ | ALL ]

                                                  例如:显示的是之前设置的 FILE# 1,BLOCK# 175

                                                    BBED> show
                                                    FILE# 1
                                                    BLOCK# 175
                                                    OFFSET 0
                                                    DBA 0x004000af (4194479 1,175)
                                                    FILENAME /oracle/app/oracle/oradata/cjc/system01.dbf
                                                    BIFILE bifile.bbd
                                                    LISTFILE /home/oracle/bbed/filelist.txt
                                                    BLOCKSIZE 8192
                                                    MODE Edit
                                                    EDIT Unrecoverable
                                                    IBASE Dec
                                                    OBASE Dec
                                                    WIDTH 80
                                                    COUNT 512
                                                    LOGFILE log.bbd
                                                    SPOOL No

                                                    3.info

                                                    显示当前可以进行browse 或者edit 的file。即我们filelist 里指定的datafile信息。

                                                      BBED> help info
                                                      INFO

                                                      例如:如果一行显示不全,可以设置width,例如:set width 65

                                                        BBED> info
                                                        File# Name Size(blks)
                                                        ----- ---- ----------
                                                        1 /oracle/app/oracle/oradata/cjc/system01.dbf 96000
                                                        2 /oracle/app/oracle/oradata/cjc/sysaux01.dbf 69120
                                                        3 /oracle/app/oracle/oradata/cjc/undotbs01.dbf 11520
                                                        4 /oracle/app/oracle/oradata/cjc/users01.dbf 640
                                                        5 /oracle/app/oracle/oradata/cjc/example01.dbf 44320
                                                        6 /oradata/cjctbs.dbf 1416
                                                        7 /oradata/chentbs.dbf 128

                                                        4.map

                                                        map会通过偏移量来显示block里的详细信息,如block header,data block header 和row directory。 

                                                        使用/v 选项,可以查看更详细的信息。

                                                        在不指定block的情况下,会显示当前block的信息,如果想显示其他block的信息,可以使用file name,file id,block 和DBA 来指定要显示的block。

                                                          BBED> help map
                                                          MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]

                                                          例如:

                                                            BBED> map
                                                            File: /oracle/app/oracle/oradata/cjc/system01.dbf (1)
                                                            Block: 175 Dba:0x004000af
                                                            ------------------------------------------------------------
                                                            KTB Data Block (Index Leaf)


                                                            struct kcbh, 20 bytes @0


                                                            struct ktbbh, 72 bytes @20


                                                            struct kdxle, 32 bytes @92


                                                            sb2 kd_off[500] @124


                                                            ub1 freespace[0] @1124


                                                            ub1 rowdata[6996] @1124


                                                            ub4 tailchk @8188

                                                            使用/v选项,查看详细信息

                                                              BBED> map v
                                                              File: /oracle/app/oracle/oradata/cjc/system01.dbf (1)
                                                              Block: 175 Dba:0x004000af
                                                              ------------------------------------------------------------
                                                              KTB Data Block (Index Leaf)


                                                              struct kcbh, 20 bytes @0
                                                              ub1 type_kcbh @0
                                                              ub1 frmt_kcbh @1
                                                              ub1 spare1_kcbh @2
                                                              ub1 spare2_kcbh @3
                                                              ub4 rdba_kcbh @4
                                                              ub4 bas_kcbh @8
                                                              ub2 wrp_kcbh @12
                                                              ub1 seq_kcbh @14
                                                              ub1 flg_kcbh @15
                                                              ub2 chkval_kcbh @16
                                                              ub2 spare3_kcbh @18


                                                              struct ktbbh, 72 bytes @20
                                                              ub1 ktbbhtyp @20
                                                              union ktbbhsid, 4 bytes @24
                                                              struct ktbbhcsc, 8 bytes @28
                                                              sb2 ktbbhict @36
                                                              ub1 ktbbhflg @38
                                                              ub1 ktbbhfsl @39
                                                              ub4 ktbbhfnx @40
                                                              struct ktbbhitl[2], 48 bytes @44


                                                              struct kdxle, 32 bytes @92
                                                              struct kdxlexco, 16 bytes @92
                                                              sb2 kdxlespl @108
                                                              sb2 kdxlende @110
                                                              ub4 kdxlenxt @112
                                                              ub4 kdxleprv @116
                                                              ub1 kdxledsz @120
                                                              ub1 kdxleflg @121


                                                              sb2 kd_off[500] @124


                                                              ub1 freespace[0] @1124


                                                              ub1 rowdata[6996] @1124


                                                              ub4 tailchk @8188

                                                              这个是默认情况,@后面代表的对应的信息在block里的偏移量,即offset。

                                                               --通过dba 来指定某个block

                                                                BBED> map v dba 6,159
                                                                File: /oradata/cjctbs.dbf (6)
                                                                Block: 159 Dba:0x0180009f
                                                                ------------------------------------------------------------
                                                                KTB Data Block (Table/Cluster)


                                                                struct kcbh, 20 bytes @0
                                                                ub1 type_kcbh @0
                                                                ub1 frmt_kcbh @1
                                                                ub1 spare1_kcbh @2
                                                                ub1 spare2_kcbh @3
                                                                ub4 rdba_kcbh @4
                                                                ub4 bas_kcbh @8
                                                                ub2 wrp_kcbh @12
                                                                ub1 seq_kcbh @14
                                                                ub1 flg_kcbh @15
                                                                ub2 chkval_kcbh @16
                                                                ub2 spare3_kcbh @18


                                                                struct ktbbh, 72 bytes @20
                                                                ub1 ktbbhtyp @20
                                                                union ktbbhsid, 4 bytes @24
                                                                struct ktbbhcsc, 8 bytes @28
                                                                sb2 ktbbhict @36
                                                                ub1 ktbbhflg @38
                                                                ub1 ktbbhfsl @39
                                                                ub4 ktbbhfnx @40
                                                                    struct ktbbhitl[2], 48 bytes            @44      


                                                                struct kdbh, 14 bytes @100
                                                                ub1 kdbhflag @100
                                                                sb1 kdbhntab @101
                                                                sb2 kdbhnrow @102
                                                                sb2 kdbhfrre @104
                                                                sb2 kdbhfsbo @106
                                                                sb2 kdbhfseo @108
                                                                sb2 kdbhavsp @110
                                                                sb2 kdbhtosp @112


                                                                struct kdbt[1], 4 bytes @114
                                                                sb2 kdbtoffs @114
                                                                sb2 kdbtnrow @116


                                                                sb2 kdbr[3] @118


                                                                ub1 freespace[7986] @124


                                                                ub1 rowdata[78] @8110


                                                                ub4 tailchk @8188

                                                                --通过block 来map

                                                                  BBED> map v block 159
                                                                  File: /oradata/cjctbs.dbf (6)
                                                                  Block: 159 Dba:0x0180009f
                                                                  ------------------------------------------------------------
                                                                  KTB Data Block (Table/Cluster)


                                                                  struct kcbh, 20 bytes @0
                                                                  ub1 type_kcbh @0
                                                                  ub1 frmt_kcbh @1
                                                                  ub1 spare1_kcbh @2
                                                                  ub1 spare2_kcbh @3
                                                                  ub4 rdba_kcbh @4
                                                                  ub4 bas_kcbh @8
                                                                  ub2 wrp_kcbh @12
                                                                  ub1 seq_kcbh @14
                                                                  ub1 flg_kcbh @15
                                                                  ub2 chkval_kcbh @16
                                                                  ub2 spare3_kcbh @18


                                                                  struct ktbbh, 72 bytes @20
                                                                  ub1 ktbbhtyp @20
                                                                  union ktbbhsid, 4 bytes @24
                                                                  struct ktbbhcsc, 8 bytes @28
                                                                  sb2 ktbbhict @36
                                                                  ub1 ktbbhflg @38
                                                                  ub1 ktbbhfsl @39
                                                                  ub4 ktbbhfnx @40
                                                                  struct ktbbhitl[2], 48 bytes @44


                                                                  struct kdbh, 14 bytes @100
                                                                  ub1 kdbhflag @100
                                                                  sb1 kdbhntab @101
                                                                  sb2 kdbhnrow @102
                                                                  sb2 kdbhfrre @104
                                                                  sb2 kdbhfsbo @106
                                                                  sb2 kdbhfseo @108
                                                                  sb2 kdbhavsp @110
                                                                  sb2 kdbhtosp @112


                                                                  struct kdbt[1], 4 bytes @114
                                                                  sb2 kdbtoffs @114
                                                                  sb2 kdbtnrow @116


                                                                  sb2 kdbr[3] @118


                                                                  ub1 freespace[7986] @124


                                                                  ub1 rowdata[78] @8110


                                                                  ub4 tailchk @8188

                                                                  map 显示的具体信息解释如下:

                                                                    (1)struct kcbh, 20 bytes
                                                                    Block Header Structure


                                                                    (2)ub1 type_kcbh
                                                                    Block type (see Header Block Types below)


                                                                    (3)ub1 frmt_kcbh
                                                                    Block format 1=Oracle 7, 2=Oracle 8+


                                                                    (4)ub1 spare1_kcbh
                                                                    Not used


                                                                    (5)ub1 spare2_kcbh
                                                                    Not used


                                                                    (6)ub4 rdba_kcbh
                                                                    RDBA -Relative Data Block Address


                                                                    (7)ub4 bas_kcbh
                                                                    SCN Base


                                                                    (8)ub2 wrp_kcbh
                                                                    SCN Wrap


                                                                    (9)ub1 seq_kcbh
                                                                    Sequence number, incremented for every change made to the block at the same SCN


                                                                    (10)ub1 flg_kcbh
                                                                    Flag:
                                                                    0x01 New Block
                                                                    0x02 Delayed Logging Change advanced SCN/seq 0x04 Check value saved - block XOR‘s to zero
                                                                    0x08 Temporary block


                                                                    (11)ub2 chkval_kcbh
                                                                    Optional block checksum (if DB_BLOCK_CHECKSUM=TRUE)


                                                                    (12)ub2 spare3_kcbh
                                                                    Not used


                                                                    (13)struct ktbbh, 72 bytes
                                                                    Transaction Fixed Header Structure


                                                                    (14)ub1 ktbbhtyp
                                                                    Block type (1=DATA, 2=INDEX)


                                                                    (15)union ktbbhsid, 4 bytes
                                                                    Segment/Object ID


                                                                    (16)struct ktbbhcsc, 8 bytes
                                                                    SCN at last block cleanout


                                                                    (17)b2 ktbbhict
                                                                    Number of ITL slots


                                                                    (18)ub1 ktbbhflg
                                                                    0=on the freelist


                                                                    (19)ub1 ktbbhfsl
                                                                    ITL TX freelist slot


                                                                    (20)ub4 ktbbhfnx
                                                                    DBA of next block on the freelist


                                                                    (21)struct ktbbhitl[2], 48 bytes
                                                                    ITL list index


                                                                    (22)struct kdbh, 14 bytes
                                                                    Data Header Structure


                                                                    (23)ub1 kdbhflag
                                                                    N=pctfree hit(clusters); F=do not put on freelist; K=flushable cluster keys


                                                                    (24)b1 kdbhntab
                                                                    Number of tables (>1 in clusters)


                                                                    (25)b2 kdbhnrow
                                                                    Number of rows


                                                                    (26)sb2 kdbhfrre
                                                                    First free row entry index; -1 = you have to add one


                                                                    (27)sb2 kdbhfsbo
                                                                    Freespace begin offset


                                                                    (28)sb2 kdbhfseo
                                                                    Freespace end offset


                                                                    (29)b2 kdbhavsp
                                                                    Available space in the block


                                                                    (30)b2 kdbhtosp
                                                                    Total available space when all TXs commit


                                                                    (31)struct kdbt[1], 4 bytes
                                                                    Table Directory Entry Structure


                                                                    (32)b2 kdbtoffs


                                                                    (33)b2 kdbtnrow


                                                                    (34)sb2 kdbr[1]
                                                                    Row Directory


                                                                    (35)ub1 freespace[8030]
                                                                    Free Space


                                                                    (36)ub1 rowdata[38]
                                                                    Row Data


                                                                    (37)ub4 tailchk
                                                                    (See Tailchecks below)

                                                                    不同的block 可以第一个byte的值是不一样的。 

                                                                    具体值对应block 类型如下:

                                                                      Different block types are designated by the first byte of the block.
                                                                      The following tableshows how to decode the block type:
                                                                      Header Block Types

                                                                      ID  Type

                                                                        01
                                                                        Undo segment header


                                                                        02
                                                                        Undo data block


                                                                        03
                                                                        Save undo header


                                                                        04
                                                                        Save undo data block


                                                                        05
                                                                        Data segment header (temp, index, data and so on)


                                                                        06
                                                                        KTB managed data block (with ITL)


                                                                        07
                                                                        Temp table data block (no ITL)


                                                                        08
                                                                        Sort Key


                                                                        09
                                                                        Sort Run


                                                                        10
                                                                        Segment free list block


                                                                        11
                                                                        Data file header

                                                                        5.dump 

                                                                        列出指定block的内容

                                                                        dump命令将块的内容转储到屏幕上。

                                                                        它可以与/v选项结合使用,以产生更详细的输出。

                                                                        可以使用命令指定要转储的DBA, Filename, File, Block 和/或 Offset。

                                                                        如果未指定这些,则将转储使用set命令建立的当前file, block 和 offsetas。

                                                                        转储的大小由set count选项限制,默认为512字节,或者可以使用命令指定转储的大小。

                                                                          BBED> help dump
                                                                          DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]

                                                                          例如:

                                                                            BBED> dump
                                                                            File: /oracle/app/oracle/oradata/cjc/system01.dbf (1)
                                                                            Block: 1 Offsets: 0 to 511 Dba:0x00400001
                                                                            ------------------------------------------------------------------------
                                                                            0ba20000 01004000 00000000 00000104 aa2c0000 00000000 0004200b 7d148de2
                                                                            434a4300 00000000 f8080000 00770100 00200000 01000300 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
                                                                            08024000 07000000 00000000 7dc92131 25846d45 e61c1200 00000000 00000000
                                                                            00000000 00000000 00000020 ae000000 bf836d45 ad000000 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 06005359 5354454d 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 01000000 00000000 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 00000000 00000000 00000000 0a000a00
                                                                            0a766d45 f8141200 00000000 00000000 00000000 00000000 00000000 00000000
                                                                            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
                                                                             00000000 5a391200 00000000 ca6c8445 01000000 01000000 b16e0000 100051db 


                                                                            详细信息

                                                                              BBED> dump /v
                                                                              File: /oracle/app/oracle/oradata/cjc/system01.dbf (1)
                                                                              Block: 1 Offsets: 0 to 511 Dba:0x00400001
                                                                              -------------------------------------------------------
                                                                              0ba20000 01004000 00000000 00000104 l ......@.........
                                                                              aa2c0000 00000000 0004200b 7d148de2 l .,........ .}...
                                                                              434a4300 00000000 f8080000 00770100 l CJC..........w..
                                                                              00200000 01000300 00000000 00000000 l . ..............
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              08024000 07000000 00000000 7dc92131 l ..@.........}.!1
                                                                              25846d45 e61c1200 00000000 00000000 l %.mE............
                                                                              00000000 00000000 00000020 ae000000 l ........... ....
                                                                              bf836d45 ad000000 00000000 00000000 l ..mE............
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              06005359 5354454d 00000000 00000000 l ..SYSTEM........
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              01000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 0a000a00 l ................
                                                                              0a766d45 f8141200 00000000 00000000 l .vmE............
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 00000000 00000000 00000000 l ................
                                                                              00000000 5a391200 00000000 ca6c8445 l ....Z9.......l.E
                                                                              01000000 01000000 b16e0000 100051db l .........n....Q.


                                                                                BBED> dump /v dba 6,175 offset 0
                                                                                File: /oradata/cjctbs.dbf (6)
                                                                                Block: 175 Offsets: 0 to 511 Dba:0x018000af
                                                                                -------------------------------------------------------
                                                                                06a20000 af008001 fe3d1200 00000106 l .........=......
                                                                                c9410000 01000000 865a0100 ed3d1200 l .A.......Z...=..
                                                                                00000000 02003200 a8008001 03001900 l ......2.........
                                                                                c7030000 6207c000 a5002b00 03200000 l ....b.....+.. ..
                                                                                fe3d1200 00000000 00000000 00000000 l .=..............
                                                                                00000000 00000000 00000000 00000000 l ................
                                                                                00000000 00010300 ffff1800 7f1f631f l ..............c.
                                                                                631f0000 0300911f 8a1f7f1f 00000000 l c...............
                                                                                00000000 00000000 00000000 00000000 l ................
                                                                                00000000 00000000 00000000 00000000 l ................
                                                                                00000000 00000000 00000000 00000000 l ................
                                                                                ......

                                                                                6.PRINT(p)

                                                                                print命令允许以原始输出或格式化输出的形式打印数据结构。

                                                                                要打印的DBA, Filename, File, Block and/or Offset可以通过该命令指定。

                                                                                如果未指定,则将打印使用set命令建立的当前file, block and offset。

                                                                                  BBED> help print
                                                                                  PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]

                                                                                    BBED> set dba 5,175
                                                                                    DBA 0x014000af (20971695 5,175)




                                                                                    BBED> p
                                                                                    kcbh.type_kcbh
                                                                                    --------------
                                                                                    ub1 type_kcbh @0 0x06




                                                                                    BBED> print
                                                                                    kcbh.type_kcbh
                                                                                    --------------
                                                                                    ub1 type_kcbh @0 0x06

                                                                                    7.EXAMINE(x)

                                                                                    检查命令用于以原始输出或格式化输出显示块中的数据。

                                                                                    要检查的DBA, Filename, File, Block and/or Offset可以通过命令指定。

                                                                                    如果当前文件中没有指定这些,则将检查使用set命令建立的block和offset。

                                                                                    如果发出的检查命令只包含要检查的block和offset,bbed将显示该offset的数据结构。

                                                                                      BBED> help EXAMINE
                                                                                      EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
                                                                                      :
                                                                                      N - a number which specifies a repeat count.
                                                                                      u - a letter which specifies a unit size:
                                                                                      b - b1, ub1 (byte)
                                                                                      h - b2, ub2 (half-word)
                                                                                      w - b4, ub4(word)
                                                                                      r - Oracle table/index row
                                                                                      f - a letter which specifies a display format:
                                                                                      x - hexadecimal
                                                                                      d - decimal
                                                                                      u - unsigned decimal
                                                                                      o - octal
                                                                                      c - character (native)
                                                                                      n - Oracle number
                                                                                      t - Oracle date
                                                                                      i - Oracle rowid

                                                                                      例如:

                                                                                        BBED> EXAMINE
                                                                                        kcvfh.kcvfhbfh.type_kcbh @0
                                                                                        ------------------------
                                                                                        0x0b

                                                                                        8.FIND(f) 

                                                                                        find命令用于定位块中的数据。

                                                                                        该命令允许搜索十六进制、字符串或数值数据。

                                                                                        可以使用top指令从块的顶部(偏移量0)搜索模式,也可以使用CURR指令从当前位置搜索模式。

                                                                                          The find command is used to locate data within a block.
                                                                                          The command allows hex,string or numeric data to be searched for.
                                                                                          The pattern can be searched for fromthe top of the block (offset 0) using the TOP directive, or from the currentposition using the CURR directive.

                                                                                            BBED> help find
                                                                                            FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]

                                                                                            例如:

                                                                                              SQL> conn cjc/a
                                                                                              SQL> create table t3(xxx varchar2(10));
                                                                                              SQL> insert into t3 values('cjc');
                                                                                              SQL> insert into t3 values('aaa');
                                                                                              SQL> insert into t3 values('xxx cjc');
                                                                                              SQL> commit;

                                                                                                select
                                                                                                xxx,
                                                                                                rowid,
                                                                                                dbms_rowid.rowid_relative_fno(rowid) rel_fno,
                                                                                                dbms_rowid.rowid_block_number(rowid) blockno,
                                                                                                dbms_rowid.rowid_row_number(rowid) rowno
                                                                                                from t3;


                                                                                                XXX ROWID REL_FNO BLOCKNO ROWNO
                                                                                                ---------- ------------------ ---------- ---------- ----------
                                                                                                cjc AAAVqGAAGAAAACvAAA 6175 0
                                                                                                aaa AAAVqGAAGAAAACvAAB 6175 1
                                                                                                xxx cjc AAAVqGAAGAAAACvAAC 6175 2

                                                                                                --设置block 和 offset

                                                                                                  BBED> set file 6
                                                                                                  BBED> set block 175
                                                                                                  BBED> set offset 0

                                                                                                  --查找cjc

                                                                                                    BBED> find /c cjc top
                                                                                                    File: /oradata/cjctbs.dbf (6)
                                                                                                    Block: 175 Offsets: 8171 to 8191 Dba:0x018000af
                                                                                                    ------------------------------------------------------------------------
                                                                                                     636a632c 01010361 61612c01 0103636a 630106fe 3d 


                                                                                                    bbed 显示在offset 8171的为位置,我们dump 该offset 看看

                                                                                                      BBED> d /v dba 6,175 offset 8171 count 128


                                                                                                      File: /oradata/cjctbs.dbf (6)
                                                                                                      Block: 175 Offsets: 8171 to 8191 Dba:0x018000af
                                                                                                      -------------------------------------------------------
                                                                                                      636a632c 01010361 61612c01 0103636a l cjc,...aaa,...cj
                                                                                                       630106fe 3d                         l c...=


                                                                                                      9.COPY

                                                                                                      把一个block的内容copy到另一个block中。

                                                                                                      复制命令用于将块从一个位置复制到另一个位置。

                                                                                                      与其他命令一样,可以指定文件或文件名和偏移量,也可以指定DBA。

                                                                                                        The copy command is used to copy blocks from one location to another.
                                                                                                        As with other commands, the file or filename and offset can be specified, or the DBA can bespecified instead.

                                                                                                          BBED> help copy
                                                                                                          COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]

                                                                                                          例如:

                                                                                                          命令格式如下(危险命令,慎用!):

                                                                                                            ---BBED> copy dba 6,175 to dba 6,100

                                                                                                            10.MODIFY

                                                                                                            modify命令用于更改块内的数据。

                                                                                                            可以使用命令指定要修改的DBA, Filename, File,Block and/or Offset。

                                                                                                            如果未指定这些,则将修改使用set命令建立的当前文件、块和偏移量。

                                                                                                            或者,可以指定一个符号或符号指针进行修改。

                                                                                                            可以使用与find命令相同的开关在十六进制、十进制、无符号十进制、八进制或字符数据中指定用于覆盖原始数据的字节模式。

                                                                                                              The modify command is used to change data inside a block.
                                                                                                              The DBA, Filename, File,Block and/or Offset to modify can be specified with the command.
                                                                                                              If these arenot specified the current file, block and offset as established with the setcommand will be modified.
                                                                                                              Alternatively a symbol or symbol pointer can bespecified for modification.
                                                                                                              Thepattern of bytes used to overwrite the original can be specified inhexadecimal, decimal, unsigned decimal, octal or character data using the same switches as the find command.

                                                                                                                BBED> help MODIFY
                                                                                                                MODIFY[/x|d|u|o|c] numeric/character string
                                                                                                                [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]

                                                                                                                例如:

                                                                                                                在file 6,block 175 内存cjc改成chen。

                                                                                                                  BBED> modify /c chen dba 6, 175 offset 8171
                                                                                                                  File: /oradata/cjctbs.dbf (6)
                                                                                                                  Block: 175 Offsets: 8171 to 8191 Dba:0x018000af
                                                                                                                  ------------------------------------------------------------------------
                                                                                                                  6368656e 01010361 61612c01 0103636a 630106fe 3d


                                                                                                                  验证:

                                                                                                                    BBED> d /v dba 6,175 offset 8171 count 128
                                                                                                                    File: /oradata/cjctbs.dbf (6)
                                                                                                                    Block: 175 Offsets: 8171 to 8191 Dba:0x018000af
                                                                                                                    -------------------------------------------------------
                                                                                                                    6368656e 01010361 61612c01 0103636a l chen...aaa,...cj
                                                                                                                    630106fe 3d l c...=


                                                                                                                    注意一点,这里仅仅是修改,还没有进行update,即sum apply, select 才会改变。

                                                                                                                      SQL> select * from t3;
                                                                                                                      XXX
                                                                                                                      ----------
                                                                                                                      cjc
                                                                                                                      aaa
                                                                                                                      xxx cjc

                                                                                                                      11.ASSIGN

                                                                                                                      assign命令执行符号赋值,并进行类型和范围检查。

                                                                                                                      对于当前偏移量,可以省略目标或源。

                                                                                                                      例如,以下命令将当前偏移量的结构分配给文件4,即块2的第一个ITL条目。

                                                                                                                        BBED> assign dba 4, 2 ktbbhitl[0]

                                                                                                                          The assign command does symbolic assignment, with type and range checking.
                                                                                                                          Either target or source can be omitted for the current offset.
                                                                                                                          For example, the following command assigns structure at current offset to file 4,block 2 ”s first ITL entry

                                                                                                                            BBED> help ASSIGN
                                                                                                                            ASSIGN[/x|d|u|o] =
                                                                                                                            : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
                                                                                                                            : [ value | ]

                                                                                                                            12.SUM

                                                                                                                            sum命令用于检查和设置块校验和。

                                                                                                                            可以使用命令指定要检查的DBA、文件名、文件、块和/或偏移量。

                                                                                                                            如果未指定这些,则将检查使用set命令建立的当前文件、块和偏移。

                                                                                                                            apply指令可用于更新校验和。

                                                                                                                              The sum command is used to check and set the block checksum.
                                                                                                                              The DBA, Filename,File, Block and/or Offset to check can be specified with the command.
                                                                                                                              If these are not specified the current file, block and offset as established with theset command will be checked.
                                                                                                                              The apply directive can be used to update the checksum.

                                                                                                                              计算block的checksum,modify之后block就被标识为坏块,current checksum与reqired checksum不一致,sum命令可以计算出新的checksum并应用到当前块。

                                                                                                                              我们可以使用bbed 对block 进行修改。

                                                                                                                              要使这些修改生效,就要使用sum命令。

                                                                                                                                BBED> help sum
                                                                                                                                SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]

                                                                                                                                例如:

                                                                                                                                  BBED> sum dba 6,175
                                                                                                                                  Check value for File 6, Block 175:
                                                                                                                                  current = 0x41c9, required = 0x4789


                                                                                                                                  BBED> sum dba 6,175 apply
                                                                                                                                  Check value for File 6, Block 175:
                                                                                                                                  current = 0x4789, required = 0x4789

                                                                                                                                  没生效

                                                                                                                                    SQL> select * from t3;


                                                                                                                                    XXX
                                                                                                                                    ----------
                                                                                                                                    cjc
                                                                                                                                    aaa
                                                                                                                                    xxx cjc

                                                                                                                                    清空buffer_cache

                                                                                                                                      SQL> alter system flush buffer_cache;

                                                                                                                                      查看,修改的有些问题,需要回退

                                                                                                                                        SQL> select * from t3;
                                                                                                                                        XXX
                                                                                                                                        ----------
                                                                                                                                        cjc
                                                                                                                                        aa,cjc
                                                                                                                                        xxx che

                                                                                                                                        13/14.PUSH/POP

                                                                                                                                        push命令将对象放到内存的stack,pop 将对象从内存写回磁盘。

                                                                                                                                        这允许在检查或修改另一个位置时临时保存正在编辑的当前位置。

                                                                                                                                        请注意,堆栈只存储位置,而不保存内容。

                                                                                                                                          The push and pop commands are used to push a file, block and offset location on to a memory backed stack and then pop them back.
                                                                                                                                          This allows a current locationbeing edited to be temporarily saved while another location is examined ormodified.
                                                                                                                                          Note that the stack only stores the locationœ it does notsave the contents.
                                                                                                                                          The following example shows file 7, block 16, offset 8163 being examined.
                                                                                                                                          The location is saved with the push command.
                                                                                                                                          We then move to file 6, block 1 before returning to DBA 7,16 with the pop command.

                                                                                                                                            BBED> help PUSH
                                                                                                                                            PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]




                                                                                                                                            BBED> help POP
                                                                                                                                            POP [ALL]

                                                                                                                                            以下示例显示了正在检查的文件7,块16,偏移8163。

                                                                                                                                            使用push命令保存位置。

                                                                                                                                            然后,我们转到文件6的块1,然后用pop命令返回DBA 7,16。

                                                                                                                                              BBED> push dba 7,16
                                                                                                                                              DBA 0x01c00010 (29360144 7,16)
                                                                                                                                              OFFSET 8163


                                                                                                                                              BBED> set dba 6,1
                                                                                                                                              DBA 0x01800001 (25165825 6,1)


                                                                                                                                              BBED> pop
                                                                                                                                              DBA 0x01c00010 (29360144 7,16)
                                                                                                                                              OFFSET 8163

                                                                                                                                              15.REVERT

                                                                                                                                              revert是恢复自bbed 启动以来的所有修改。

                                                                                                                                                The revert command is used to restore a file, filename, block or DBA to it‘soriginal state when bbed was started.

                                                                                                                                                  BBED> help REVERT
                                                                                                                                                  REVERT [ DBA | FILE | FILENAME | BLOCK ]

                                                                                                                                                  回退

                                                                                                                                                    BBED> revert dba 6,175

                                                                                                                                                      All changes made to this block will be rolled back. Proceed? (Y/N) Y
                                                                                                                                                      Reverted file '/oradata/cjctbs.dbf', block 175

                                                                                                                                                        BBED> sum dba 6,175 apply
                                                                                                                                                        Check value for File 6, Block 175:
                                                                                                                                                        current = 0x41c9, required = 0x41c9

                                                                                                                                                        检查数据,没生效

                                                                                                                                                          SQL> select * from t3;


                                                                                                                                                          XXX
                                                                                                                                                          ----------
                                                                                                                                                          cjc
                                                                                                                                                          aa,cjc
                                                                                                                                                          xxx che

                                                                                                                                                          清空buffer_cache

                                                                                                                                                            SQL> alter system flush buffer_cache;

                                                                                                                                                            生效了

                                                                                                                                                              SQL> select * from t3;


                                                                                                                                                              XXX
                                                                                                                                                              ----------
                                                                                                                                                              cjc
                                                                                                                                                              aaa
                                                                                                                                                              xxx cjc

                                                                                                                                                              16.UNDO

                                                                                                                                                              回滚当前的修改操作,如果手误做错了,undo一下就ok了,回到原来的状态。

                                                                                                                                                              undo命令回滚最后一个修改或分配命令。

                                                                                                                                                              如果再次发出undo命令,则会重新进行修改。

                                                                                                                                                                The undo command rolls back the last modify or assign command.
                                                                                                                                                                If the undo commandis issued again the modification is re-done.

                                                                                                                                                                  BBED> help UNDO
                                                                                                                                                                  BBED> UNDO

                                                                                                                                                                  自动出现下面信息:

                                                                                                                                                                    BBED> modify /x 636A632C filename '/oradata/cjctbs.dbf' block 175. offset 8171.
                                                                                                                                                                    File: /oradata/cjctbs.dbf (6)
                                                                                                                                                                    Block: 175 Offsets: 8171 to 8191 Dba:0x018000af
                                                                                                                                                                    ------------------------------------------------------------------------
                                                                                                                                                                    636a632c 01010361 61612c01 0103636a 630106fe 3d




                                                                                                                                                                    BBED> d /v dba 6,175 offset 8171 count 128
                                                                                                                                                                    File: /oradata/cjctbs.dbf (6)
                                                                                                                                                                    Block: 175 Offsets: 8171 to 8191 Dba:0x018000af
                                                                                                                                                                    -------------------------------------------------------
                                                                                                                                                                    636a632c 01010361 61612c01 0103636a l cjc,...aaa,...cj
                                                                                                                                                                    630106fe 3d l c...=


                                                                                                                                                                    17.HELP

                                                                                                                                                                    帮助信息

                                                                                                                                                                      BBED> help help
                                                                                                                                                                      HELP [ | ALL ]

                                                                                                                                                                      18.VERIFY

                                                                                                                                                                      检查当前环境是否有坏块。

                                                                                                                                                                      verify命令用来验证block的完整性。

                                                                                                                                                                      verify命令用于验证块的完整性。

                                                                                                                                                                      它执行与dbverify实用程序类似的功能。

                                                                                                                                                                        The verify command is used to verify the integrity of the block.
                                                                                                                                                                        It performs asimilar function to the dbverify utility.

                                                                                                                                                                          BBED> help VERIFY
                                                                                                                                                                          VERIFY [ DBA | FILE | FILENAME | BLOCK ]

                                                                                                                                                                          例如:

                                                                                                                                                                            BBED> verify dba 6,175
                                                                                                                                                                            DBVERIFY - Verification starting
                                                                                                                                                                            FILE = /oradata/cjctbs.dbf
                                                                                                                                                                            BLOCK = 175

                                                                                                                                                                              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
                                                                                                                                                                              Message 531 not found; product=RDBMS; facility=BBED

                                                                                                                                                                              19.CORRUPT

                                                                                                                                                                              corrupt命令将一个block 标记为corrupt,这样db 在操作时就会跳过该block,从而避免错误。

                                                                                                                                                                                Thec orrupt command is used to mark blocks as media corrupt.

                                                                                                                                                                                例如:

                                                                                                                                                                                  BBED> corrupt dba 6,175

                                                                                                                                                                                  注意:undo 命令不能undo 一个corruption,但是revert 命令却可以。

                                                                                                                                                                                  参考:

                                                                                                                                                                                  主要参考戴老师CSDN博客《Oracle BBED 工具 说明》

                                                                                                                                                                                    https://blog.csdn.net/tianlesoftware/article/details/5006580

                                                                                                                                                                                    参考的其他文章:

                                                                                                                                                                                      https://www.cnblogs.com/guopengcheng/articles/15074000.html
                                                                                                                                                                                      https://www.cnblogs.com/guopengcheng/articles/15075008.html
                                                                                                                                                                                      https://www.cnblogs.com/guopengcheng/articles/15075238.html
                                                                                                                                                                                      https://blog.csdn.net/qq_22960681/article/details/131932447
                                                                                                                                                                                      https://blog.csdn.net/gumengkai/article/details/53187529
                                                                                                                                                                                      https://blog.itpub.net/29785807/viewspace-2128326/

                                                                                                                                                                                      欢迎关注我的公众号《IT小Chen》

                                                                                                                                                                                      ###chenjuchao 20240415###

                                                                                                                                                                                      相关文章

                                                                                                                                                                                      Oracle如何使用授予和撤销权限的语法和示例
                                                                                                                                                                                      Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
                                                                                                                                                                                      下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
                                                                                                                                                                                      社区版oceanbase安装
                                                                                                                                                                                      Oracle 导出CSV工具-sqluldr2
                                                                                                                                                                                      ETL数据集成丨快速将MySQL数据迁移至Doris数据库

                                                                                                                                                                                      发布评论