8535.com-新浦京娱乐场官网|欢迎您

oracle bbed恢复删除数据实例

来源:http://www.dnamique.com 作者:计算机网络 人气:52 发布时间:2020-05-04
摘要:重作冯妇己删除数据一、创造模拟条件 复制代码 代码如下:SQL create table hr.xifenfei(id number,name varchar2(20卡塔尔国卡塔尔国 tablespace xff;Table created.SQL insertinto hr.xifenfei values(1,'xifenfei'卡塔尔

重作冯妇己删除数据一、创造模拟条件复制代码 代码如下:SQL create table hr.xifenfei (id number,name varchar2(20卡塔尔国卡塔尔国 tablespace xff;Table created.SQL insert into hr.xifenfei values(1,'xifenfei'卡塔尔;1 row created.SQL insert into hr.xifenfei values(2,'xff'State of Qatar;1 row created.SQL commit;Commit complete.SQL select * from hr.xifenfei;ID NAME———- ——————–1 xifenfei2 xffSQL select rowid,2 dbms_rowid.rowid_relative_fno(rowid)rel_fno,3 dbms_rowid.rowid_block_number(rowid)blockno,4 dbms_rowid.rowid_row_number(rowid) rowno5 from hr.xifenfei;ROWID REL_FNO BLOCKNO ROWNO—————— ———- ———- ———-AAAHy3AACAAAAISAAA 2 530 0AAAHy3AACAAAAISAAB 2 530 1查询file#,block,前边回复要用SQL delete from hr.xifenfei where id=2;1 row deleted.SQL commit;Commit complete.SQL select * from hr.xifenfei;ID NAME———- ——————–1 xifenfeiSQL shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.二、bbed苏醒删除数据复制代码 代码如下:[oracle@localhost ~]$ bbed parfile=/tmp/parfile.cnfPassword:BBED: Release 2.0.0.0.0 – Limited Production on Mon Aug 22 01:52:52 2011Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.************* !!! For Oracle Internal Use only !!! ***************BBED show allFILE# 2BLOCK# 1OFFSET 0DBA 0×00800001 (8388609 2,1卡塔尔FILENAME /opt/oracle/oradata/xifenfei/xff01.dbfBIFILE bifile.bbdLISTFILE /tmp/listBLOCKSIZE 8192MODE EditEDIT UnrecoverableIBASE DecOBASE DecWIDTH 80COUNT 512LOGFILE log.bbdSPOOL NoBBED set dba 2,530DBA 0×00800212 (8389138 2,530State of QatarBBED find /c xffFile: /opt/oracle/oradata/xifenfei/xff01.dbf (2卡塔尔国Block: 530 Offsets: 8170 to 8191 Dba:0×00800212————————————————————————7866662c 000202c1 02087869 66656e66 65690106 80e232 bytes per lineBBED dump /vFile: /opt/oracle/oradata/xifenfei/xff01.dbf (2卡塔尔(قطر‎Block: 530 Offsets: 8170 to 8191 Dba:0×00800212——————————————————-7866662c 000202c1 02087869 66656e66 l xff,……xifenf65690106 80e2 l ei….16 bytes per lineBBED dump /v offset 8160File: /opt/oracle/oradata/xifenfei/xff01.dbf (2State of QatarBlock: 530 Offsets: 8160 to 8191 Dba:0×00800212——————————————————-0000003c 020202c1 03037866 662c0002 l …......xff,..02c10208 78696665 6e666569 010680e2 l ....xifenfei....16 bytes per lineBBED dump /v offset 8164File: /opt/oracle/oradata/xifenfei/xff01.dbf (2卡塔尔国Block: 530 Offsets: 8164 to 8191 Dba:0×00800212——————————————————-020202c1 03037866 662c0002 02c10208 l ……xff,……78696665 6e666569 010680e2 l xifenfei….16 bytes per lineBBED dump /v offset 8162File: /opt/oracle/oradata/xifenfei/xff01.dbf (2State of QatarBlock: 530 Offsets: 8162 to 8191 Dba:0×00800212——————————————————-003c0202 02c10303 7866662c 000202c1 l .......xff,....02087869 66656e66 65690106 80e2 l ..xifenfei....16 bytes per lineBBED dump /v offset 8163File: /opt/oracle/oradata/xifenfei/xff01.dbf (2卡塔尔Block: 530 Offsets: 8163 to 8191 Dba:0×00800212——————————————————-3c020202 c1030378 66662c00 0202c102 l ......xff,.....08786966 656e6665 69010680 e2 l .xifenfei....16 bytes per line通过尝试,揣摸出来3c的offsetBBED modify /x 2cWarning: contents of previous BIFILE will be lost. Proceed? (Y/N卡塔尔国yFile: /opt/oracle/oradata/xifenfei/xff01.dbf (2State of QatarBlock: 530 Offsets: 8163 to 8191 Dba:0×00800212————————————————————————2c020202 c1030378 66662c00 0202c102 08786966 656e6665 69010680 e232 bytes per line校勘3c为2cBBED sum applyCheck value for File 2, Block 530:current = 0xb1b9, required = 0xb1b9三、核对结果复制代码 代码如下:SQL startupORACLE instance started.Total System Global Area 236000356 bytesFixed Size 451684 bytesVariable Size 二零一三26592 bytesDatabase Buffers 33554432 bytesRedo Buffers 667648 bytesDatabase mounted.Database opened.SQL select * from hr.xifenfei;ID NAME———- ——————–1 xifenfei2 xff申明:1)如若数据未删减:row flag的值为 32+8+4=44照旧0x2c2)倘使数据被去除:row flag的值为 32+16+8+4=60依然0x3c找回被剔除数据成立模拟表数据复制代码 代码如下:SQL create table t_xifenfei(id number,name varchar2(10));Table created.SQL insert into t_xifenfei values(1,'xifenfei');1 row created.SQL insert into t_xifenfei values(2,'XIFENFEI');1 row created.SQL commit;Commit complete.dump数据块SQL alter system flush BUFFER_CACHE;System altered.SQL select rowid,id,name, 2 dbms_rowid.rowid_relative_fno(rowid)rel_fno, 3 dbms_rowid.rowid_block_number(rowid)blockno, 4 dbms_rowid.rowid_row_number(rowid) rowno 5 from chf.t_xifenfei;ROWID ID NAME REL_FNO BLOCKNO ROWNO------------------ ---------- ---------- ---------- ---------- ----------AAASdmAAEAAAACvAAA 1 xifenfei 4 175 0AAASdmAAEAAAACvAAB 2 XIFENFEI 4 175 1SQL alter system dump datafile 4 block 175;System altered.dump文件内容block_row_dump:tab 0, row 0, @0x1f89tl: 15 fb: --H-FL-- lb: 0x1 cc: 2col 0: [ 2] c1 02col 1: [ 8] 78 69 66 65 6e 66 65 69tab 0, row 1, @0x1f7atl: 15 fb: --H-FL-- lb: 0x1 cc: 2col 0: [ 2] c1 03col 1: [ 8] 58 49 46 45 4e 46 45 49end_of_block_dump2012-05-01 05:09:29.287714 : kjbmbassert [0xaf.4]End dump data blocks tsn: 4 file#: 4 minblk 175 maxblk 175删减表数据复制代码 代码如下:SQL delete from t_xifenfei;2 rows deleted.SQL commit;Commit complete.SQL alter system flush BUFFER_CACHE;System altered.SQL alter system dump datafile 4 block 175;System altered.dump文件内容block_row_dump:tab 0, row 0, @0x1f89tl: 2 fb: --HDFL-- lb: 0x2tab 0, row 1, @0x1f7atl: 2 fb: --HDFL-- lb: 0x2end_of_block_dump2012-05-01 05:13:35.214357 : kjbmbassert [0xaf.4]End dump data blocks tsn: 4 file#: 4 minblk 175 maxblk 175因而相比那五次的dump文件发掘1.数目内容被去除,并不是的确删除,而是给其增添了五个标记位(fd:---D----卡塔尔(قطر‎2.fb:--H-FL--(head of row piece+first data piece+last data piece State of Qatar其有8个筛选每一种选项的值分别对应bitmask即32+8+4=44 or 0x2c3.若是三个row被delete了,那么row flag就能够更新,bitmask里的deleted被设置为16. 此时row flag为:32+16+8+4 = 60 or 0x3c.4.一旦大家要找回来被删去的数码,只要求把3c改为2c就可以关闭数据库复制代码 代码如下:SQL select * from chf.t_xifenfei;no rows selectedSQL select name from v$datafile where file#=4;NAME------------------------------------------------/tmp/user01.dbfSQL shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.bbed校勘数据BBED set filename '/tmp/user01.dbf' FILENAME /tmp/user01.dbfBBED set block 175 BLOCK# 175BBED set blocksize 8192 BLOCKSIZE 8192BBED set mode edit MODE EditBBED mapFile: /tmp/user01.dbf (0)Block: 175 Dba:0x00000000------------------------------------------------------------KTB Data Block (Table/Cluster)struct kcbh, 20 bytes @0 struct ktbbh, 72 bytes @20 struct kdbh, 14 bytes @100 struct kdbt[1], 4 bytes @114 sb2 kdbr[2] @118 ub1 freespace[8036] @122 ub1 rowdata[30] @8158 ub4 tailchk @8188 BBED p *kdbr[0]rowdata[15]-----------ub1 rowdata[15] @8173 0x3cBBED p *kdbr[1]rowdata[0]----------ub1 rowdata[0] @8158 0x3cBBED m /x 2c offset 8158File: /tmp/user01.dbf (0)Block: 175 Offsets: 8158 to 8191 Dba:0x00000000------------------------------------------------------------------------2c630202 c1030858 4946454e 46454932 630202c1 02087869 66656e66 65690106b47e32 bytes per lineBBED m /x 2c offset 8173File: /tmp/user01.dbf (0)Block: 175 Offsets: 8173 to 8191 Dba:0x00000000------------------------------------------------------------------------2c630202 c1020878 6966656e 66656901 06b47e32 bytes per lineBBED sum applyCheck value for File 0, Block 175:current = 0x4d13, required = 0x4d13 初步数据库验证复制代码 代码如下:SQL startupORACLE instance started.Total System Global Area 535662592 bytesFixed Size 1346140 bytesVariable Size 411043236 bytesDatabase Buffers 117440512 bytesRedo Buffers 5832704 bytesDatabase mounted.Database opened.SQL select * from chf.t_xifenfei; ID NAME---------- ---------- 1 xifenfei 2 XIFENFEI

本文由8535.com-新浦京娱乐场官网|欢迎您发布于计算机网络,转载请注明出处:oracle bbed恢复删除数据实例

关键词:

最火资讯