[20140624]bbed修改資料記錄.txt

lfree發表於2014-06-24

[20140624]bbed修改資料記錄.txt

上午看了連結:
http://www.itpub.net/thread-1872851-1-1.html

自己也做一下看看.

SCOTT@test> @ver

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

create table itpub_t1 (id int,name varchar2(100));
insert into itpub_t1 values(1,'AAAAA');
insert into itpub_t1 values(2,'BBBBB');
commit;

update itpub_t1 set name='aaaaa' where name='AAAAA';
commit;

SCOTT@test>  select * from itpub_t1;
        ID NAME
---------- --------------------
         1 aaaaa
         2 BBBBB

--看看自己是否能恢復資料:


SCOTT@test>  select rowid,itpub_t1.* from itpub_t1;
ROWID                      ID NAME
------------------ ---------- --------------------
AABF2CAAEAAAAJHAAA          1 aaaaa
AABF2CAAEAAAAJHAAB          2 BBBBB

SCOTT@test> @lookup_rowid  AABF2CAAEAAAAJHAAA
    OBJECT       FILE      BLOCK        ROW DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- ----------------------------------------
    286082          4        583          0 4,583                alter system dump datafile 4 block 583 ;


SCOTT@test> alter system checkpoint;
System altered.

--保證寫盤.最好關閉資料庫操作bbed.

BBED> set dba 4,583
        DBA             0x01000247 (16777799 4,583)

BBED> p *kdbr[0]
rowdata[12]
-----------
ub1 rowdata[12]                             @8176     0x2c

BBED> x /rnc
rowdata[12]                                 @8176
-----------
flag@8176: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8177: 0x02
cols@8178:    2

col    0[2] @8179: 1
col    1[5] @8182: aaaaa


BBED> set offset 8183
        OFFSET          8183

--注意前面字串前有一個長度指示器,偏移要加+1.

BBED>  modify  /c 'AAAAA'
BBED> modify  /c 'AAAAA'
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/app/oracle11g/oradata/test/users01.dbf (4)
Block: 583             Offsets: 8183 to 8191     Dba:0x01000247
-----------------------------------------------------------------
41414141 410106ce b4

<80 bytes per line>

BBED> p *kdbr[0]
rowdata[12]
-----------
ub1 rowdata[12]                             @8176     0x2c

BBED> x /rnc
rowdata[12]                                 @8176
-----------
flag@8176: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8177: 0x01
cols@8178:    2

col    0[2] @8179: 1
col    1[5] @8182: AAAAA


--ok 已經修改正確.
BBED> sum
Check value for File 4, Block 583:
current = 0x8a14, required = 0xaa14

--檢查和不對.
BBED> sum apply
Check value for File 4, Block 583:
current = 0xaa14, required = 0xaa14


--重新啟動資料庫,ok.

SCOTT@test>  select rowid,itpub_t1.* from itpub_t1;

ROWID                      ID NAME
------------------ ---------- --------------------
AABF2CAAEAAAAJHAAA          1 AAAAA
AABF2CAAEAAAAJHAAB          2 BBBBB

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1192369/,如需轉載,請註明出處,否則將追究法律責任。

相關文章