[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 关系型数据库 数据库管理
[20180619]bbed verify问题.txt
[20180619]bbed verify问题.txt --//记录一下自己一个多年的错误. 1.环境: SCOTT@test01p> @ ver1 PORT_STRING                    VERSION        BANNER   ...
1285 0
|
Oracle 关系型数据库
[20180502]ORA-01580.txt
[20180502]ORA-01580.txt RMAN> backup current controlfile; Starting backup at 2018-05-02 15:36:03 using channel ORA_DISK_1 using...
1174 0
|
关系型数据库 Oracle Linux
[20180321]ORA-08180.txt
[20180321]ORA-08180.txt $ oerr ora 08180 08180, 00000, "no snapshot found based on specified time" // *Cause: Could not match the time to an SCN from the mapping table.
1297 0
|
Oracle 关系型数据库 Linux
|
Oracle 关系型数据库 数据库管理
[20171124]bbed的使用问题2.txt
[20171124]bbed的使用问题2.txt --//bbed 是探究oracle数据块的好工具,有时候不用转储,直接可以它看oracle内部块的内部结构. --//在使用中要注意一些问题,昨天又犯类似错误,通过例子来说明: SCOTT@book> select rowid,dept.
1277 0
|
关系型数据库 Oracle Linux
[20170628]12C ORA-54032.txt
[20170628]12C ORA-54032.txt https://hourim.wordpress.com/2017/06/24/ora-54032-column-to-be-renamed-is-used-in-a-virtual-column-expres...
1460 0
|
Oracle 关系型数据库 数据库管理
[20161124]bbed使用问题.txt
[20161124]bbed使用问题.txt --最近一致在使用bbed探究oracle数据库,遇到一些问题做一些记录。 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION  ...
902 0
|
Oracle 关系型数据库 数据库管理
[20160325]bbed是否有4G的限制.txt
[20160325]bbed是否有4G的限制.txt http://www.itpub.net/thread-2053982-1-1.html --前一段时间,我想使用bbed查看某个块的信息,我发现如果我访问的操作在4G之外就出现问题。
758 0
|
数据库管理 关系型数据库 Oracle
[20160405]bbed的assign命令.txt
[20160405]bbed的assign命令.txt --我记得开始学习bbed的时候,看的是一份pdf文档,提到assign的用法,摘要如下: assign The assign command does symbolic assignment, with type and range checking.
945 0
|
SQL Oracle 关系型数据库
[20151215]ORA-60014.txt
[20151215]ORA-60014: invalid MAXSIZE storage option value.txt SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        ...
846 0