[20180205]使用bbed相关问题.txt

简介: [20180205]使用bbed相关问题.txt --//上个星期5使用bbed修改块遇到一些问题,做一个记录: 1.环境: SCOTT@book> @ ver1 PORT_STRING                    VERSION       ...

[20180205]使用bbed相关问题.txt

--//上个星期5使用bbed修改块遇到一些问题,做一个记录:

1.环境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

create table t (id number, update_scn number, commit_scn number,pad varchar2(20));
insert into t values (1,dbms_flashback.get_system_change_number,userenv('commitscn'),lpad('x',10,'x'));
commit;

SCOTT@book> select ora_rowscn,rowid,t.* from scott.t;
  ORA_ROWSCN ROWID                        ID   UPDATE_SCN   COMMIT_SCN PAD
------------ ------------------ ------------ ------------ ------------ --------------------
13278403922 AAAWUOAAEAAAAI0AAA            1  13278403918  13278403921 xxxxxxxxxx

SCOTT@book> @ &r/rowid AAAWUOAAEAAAAI0AAA
      OBJECT         FILE        BLOCK          ROW ROWID_DBA            DBA                  TEXT
------------ ------------ ------------ ------------ -------------------- -------------------- ----------------------------------------
       91406            4          564            0  0x1000234           4,564                alter system dump datafile 4 block 564 ;

select 13278403922,trunc(13278403922/power(2,32)) scn_wrap,mod(13278403922,power(2,32))  scn_base from dual
13278403922     SCN_WRAP     SCN_BASE SCN_WRAP16 SCN_BASE16
------------ ------------ ------------ ---------- ----------
13278403922            3    393502034          3   17745d52
      
SCOTT@book> alter system checkpoint ;
System altered.

2.以dba=4,564为例子说明问题一:
$ cat scn.cmd
set count 8192
set width 210

p dba 4,564  kcbh.bas_kcbh
p dba 4,564  ktbbh.ktbbhcsc.kscnbas

p dba 4,564  ktbbh.ktbbhitl[0].ktbitflg
p dba 4,564  ktbbh.ktbbhitl[0].ktbitbas

p dba 4,564  ktbbh.ktbbhitl[1].ktbitflg
p dba 4,564  ktbbh.ktbbhitl[1].ktbitbas

p dba 4,564  ktbbh.ktbbhitl[2].ktbitflg
p dba 4,564  ktbbh.ktbbhitl[2].ktbitbas

p dba 4,564 tailchk
quit


$ $ORACLE_HOME/bin/bbed parfile=bbed.par cmdfile=scn.cmd
..
BBED> p dba 4,564  kcbh.bas_kcbh
ub4 bas_kcbh                                @8        0x17745d52

BBED> p dba 4,564  ktbbh.ktbbhcsc.kscnbas
ub4 kscnbas                                 @28       0x17745d50

BBED> p dba 4,564  ktbbh.ktbbhitl[0].ktbitflg
ub2 ktbitflg                                @60       0x2001 (KTBFUPB)

BBED> p dba 4,564  ktbbh.ktbbhitl[0].ktbitbas
ub4 ktbitbas                                @64       0x17745d52

BBED> p dba 4,564  ktbbh.ktbbhitl[1].ktbitflg
ub2 ktbitflg                                @84       0x0000 (NONE)

BBED> p dba 4,564  ktbbh.ktbbhitl[1].ktbitbas
ub4 ktbitbas                                @88       0x00000000

BBED> p dba 4,564  ktbbh.ktbbhitl[2].ktbitflg
ub2 ktbitflg                                @60       0x2001 (KTBFUPB)

BBED> p dba 4,564  ktbbh.ktbbhitl[2].ktbitbas
ub4 ktbitbas                                @64       0x17745d52
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BBED> p dba 4,564 tailchk
ub4 tailchk                                 @8188     0x5d520601

BBED> quit

--//注意看下划线实际上仅仅2个itl槽.ktbbh.ktbbhitl[2].ktbitbas根本不存在.
BBED> p dba 4,564 ktbbh.ktbbhitl
struct ktbbhitl[0], 24 bytes                @44
   struct ktbitxid, 8 bytes                 @44
      ub2 kxidusn                           @44       0x0008
      ub2 kxidslt                           @46       0x000d
      ub4 kxidsqn                           @48       0x0000076d
   struct ktbituba, 8 bytes                 @52
      ub4 kubadba                           @52       0x00c008cc
      ub2 kubaseq                           @56       0x03ca
      ub1 kubarec                           @58       0x2e
   ub2 ktbitflg                             @60       0x2001 (KTBFUPB)
   union _ktbitun, 2 bytes                  @62
      sb2 _ktbitfsc                         @62       0
      ub2 _ktbitwrp                         @62       0x0000
   ub4 ktbitbas                             @64       0x17745d52
struct ktbbhitl[1], 24 bytes                @68
   struct ktbitxid, 8 bytes                 @68
      ub2 kxidusn                           @68       0x0000
      ub2 kxidslt                           @70       0x0000
      ub4 kxidsqn                           @72       0x00000000
   struct ktbituba, 8 bytes                 @76
      ub4 kubadba                           @76       0x00000000
      ub2 kubaseq                           @80       0x0000
      ub1 kubarec                           @82       0x00
   ub2 ktbitflg                             @84       0x0000 (NONE)
   union _ktbitun, 2 bytes                  @86
      sb2 _ktbitfsc                         @86       0
      ub2 _ktbitwrp                         @86       0x0000
   ub4 ktbitbas                             @88       0x00000000

--//显示第7槽,实际上都是槽1的信息.感觉这个是bbed的bug.

BBED> p dba 4,564 ktbbh.ktbbhitl[7]
struct ktbbhitl[7], 24 bytes                @44
   struct ktbitxid, 8 bytes                 @44
      ub2 kxidusn                           @44       0x0008
      ub2 kxidslt                           @46       0x000d
      ub4 kxidsqn                           @48       0x0000076d
   struct ktbituba, 8 bytes                 @52
      ub4 kubadba                           @52       0x00c008cc
      ub2 kubaseq                           @56       0x03ca
      ub1 kubarec                           @58       0x2e
   ub2 ktbitflg                             @60       0x2001 (KTBFUPB)
   union _ktbitun, 2 bytes                  @62
      sb2 _ktbitfsc                         @62       0
      ub2 _ktbitwrp                         @62       0x0000
   ub4 ktbitbas                             @64       0x17745d52


3.问题2:
BBED> p dba 4,564 tailchk
ub4 tailchk                                 @8188     0x5d520601
--//tailchk的组成包括kcbh.bas_kcbh的低4个位.
BBED> p dba 4,564 kcbh.bas_kcbh
ub4 bas_kcbh                                @8        0x17745d52

--//我一直以为assign命令不能修改tailchk,实际上是可以的.

BBED> assign dba 4,564  tailchk=0x6d520601
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub4 tailchk                                 @8188     0x6d520601

--//仅仅第一位大于0x8才存在问题:
BBED> assign dba 4,564  tailchk=0x9d520601
BBED-00207: invalid offset specifier (9d520601)


BBED> assign dba 4,564  tailchk=0x8d520601
BBED-00207: invalid offset specifier (8d520601)


BBED> assign dba 4,564  tailchk=0x5d520601
ub4 tailchk                                 @8188     0x5d520601

--//感觉这个也是bug.要使用modify修改要注意大小头问题,intel系列.

BBED> modify /x 529d offset 8190
File: /mnt/ramdisk/book/users01.dbf (4)
Block: 564                                                  Offsets: 8190 to 8191                                               Dba:0x01000234
------------------------------------------------------------------------------------------------------------------------------------------------
529d
<64 bytes per line>

BBED> p dba 4,564 tailchk
ub4 tailchk                                 @8188     0x9d520601

--//还原:
BBED> modify /x 525d offset 8190
File: /mnt/ramdisk/book/users01.dbf (4)
Block: 564                                                  Offsets: 8190 to 8191                                               Dba:0x01000234
------------------------------------------------------------------------------------------------------------------------------------------------
525d

<64 bytes per line>

BBED> p dba 4,564 tailchk
ub4 tailchk                                 @8188     0x5d520601

3.问题3:

--//在上个星期的测试中我自己还犯了一个小错误在执行modify前忘记指定dba地址,导致修改数据文件1的文件头tailchk.
--//导致测试库无法启动.

$ cat filelist.txt
4 /mnt/ramdisk/book/users01.dbf
1 /mnt/ramdisk/book/system01.dbf
2 /mnt/ramdisk/book/sysaux01.dbf
3 /mnt/ramdisk/book/undotbs01.dbf
5 /mnt/ramdisk/book/example01.dbf
6 /mnt/ramdisk/book/tea01.dbf
7 /mnt/ramdisk/book/sugar01.dbf

BBED> show all
        FILE#           1
        BLOCK#          1
        OFFSET          0
        DBA             0x00400001 (4194305 1,1)
        FILENAME        /mnt/ramdisk/book/system01.dbf
        BIFILE          bifile.bbd
        LISTFILE        /home/oracle/bbed/filelist.txt
        BLOCKSIZE       8192
        MODE            Edit
        EDIT            Unrecoverable
        IBASE           Dec
        OBASE           Dec
        WIDTH           160
        COUNT           64
        LOGFILE         log.bbd
        SPOOL           Yes

--//无论system文件放在什么位置,bbed启动自动定位dba=1,1的位置.

4.这些细节要在以后工作中注意,避免犯一些低级错误.
感觉好久不用bbed,有点生疏了.所谓的用进废退吧.

目录
相关文章
|
Oracle 关系型数据库 OLAP
[20180628]expdp与rows=n.txt
[20180628]expdp与rows=n.txt --//想导出一些表结构,使用错参数rows=n,才发现expdp会自动修正这个错误,使用content=metadata_only代替.
1831 0
|
Oracle 关系型数据库 数据库管理
[20180619]bbed verify问题.txt
[20180619]bbed verify问题.txt --//记录一下自己一个多年的错误. 1.环境: SCOTT@test01p> @ ver1 PORT_STRING                    VERSION        BANNER   ...
1288 0
|
Oracle 关系型数据库 Linux
[20180115]RMAN-06820.txt
[20180115]RMAN-06820.txt --//在备库做归档备份出现RMAN-06820的问题。就是如果在备库做全表,因为要做主库日志切换,一般执行rman target /会出现问题。
1420 0
|
Oracle 关系型数据库 测试技术
[20171225]RMAN-06808.txt
[20171225]RMAN-06808: SECTION SIZE cannot be used when piece limit is in effect.txt --//朋友拿我的一些例子来测试遇到的RMAN-06808: SECTION SIZE cannot be used when piece limit is in effect问题.
951 0
|
关系型数据库
[20171221]RMAN-05501.txt
[20171221]RMAN-05501 aborting duplication of target database.txt --//昨天使用rman duplicate建立dg,出现如下错误: rman > duplicate target database for standby from active database; .
1070 0
|
Oracle 关系型数据库 数据库管理
[20171124]bbed的使用问题2.txt
[20171124]bbed的使用问题2.txt --//bbed 是探究oracle数据块的好工具,有时候不用转储,直接可以它看oracle内部块的内部结构. --//在使用中要注意一些问题,昨天又犯类似错误,通过例子来说明: SCOTT@book> select rowid,dept.
1282 0
|
Oracle 关系型数据库
[20171130]关于rman的一些总结.txt
[20171130]关于rman的一些总结.txt --//最近一直做rman相关测试,测试那个乱,没办法.无法从周围的人获得帮助,纯粹是自己的乱猜,乱测,不知道别人是否能看懂我写的东西.
1090 0
|
Oracle 关系型数据库 API
[20170208]rman tape.txt
[20170208]rman tape.txt --前一阵子,同事测试使用磁带做rman备份,留下一些备份信息在控制文件,要清除. --我依稀记得我以前也干过这些事情,晚上看了一下书: Apress.
986 0
|
关系型数据库 Oracle Linux
[20161230]rman checksyntax2.txt
[20161230]rman checksyntax2.txt --曾经写过一篇rman checksyntax的问题,这个问题存在10g: http://blog.
761 0
|
SQL Oracle 关系型数据库
[20161214]rman checksyntax.txt
[20161214]rman checksyntax.txt --rman在命令行使用参数checksyntax可以检查命令语法是否正确,而且并不会真正执行.但是昨天在恢复一个10g的数据库时遇到问题,做 --一个记录: 1.
946 0