版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、今天学习了bbed工具的初步使用方法,以下是备忘:bbed就是英文block browse block edit的缩写,用来直接查看和修改数据文件数据的一个工具。今天学习了bbed工具的初步使用方法,以下是备忘:bbed就是英文block browse block edit的缩写,用来直接查看和修改数据文件数据的一个工具。在windows上没有提供这个工具,在linux上面有,需要编译:make -f ins_rdbms.mk BBED=$ORACLE_HOME/rdbms/lib/bbed $ORACLE_HOME/bin/bbed然后把$ORACLE_HOME/rdbms/lib加到环境变
2、量的PATH里面,就可以直接在命令中bbed了。编译好了就可以使用了,不过有个默认的口令blockedit。运行bbed之前先要自己写几个配置文件:这里有2个 a.txt par.bbdoraclevm1 oracle$ lsa.txt bifile.bbd Desktop log.bbd par.bbdoraclevm1 oracle$ more a.txt5 /oradata/orcl/data02_01.dbf6 /u01/oracle/oradata/test/users01.dbf 262225922 /u01/oracle/oradata/test/users01.dbf.bak
3、26222592oraclevm1 oracle$ more par.bbdblocksize=8192listfile=a.txtmode=edit编好了就可以运行bbed了oraclevm1 oracle$ bbed parfile=par.bbdPassword: -这里的密码 blockeditBBED: Release 2.0.0.0.0 - Limited Production on Wed Sep 14 16:18:31 2005Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.* ! For Or
4、acle Internal Use only ! *BBED先看看帮助,有那些命令:BBED helpHELP | ALL BBED help ALLSET DBA dba | file#, block# SET FILENAME filenameSET FILE file#SET BLOCK +/-block#SET OFFSET +/-byte offset | symbol | *symbol SET BLOCKSIZE bytesSET LISTFILE filenameSET WIDTH character_countSET COUNT bytes_to_displaySET IBA
5、SE HEX | OCT | DEC SET OBASE HEX | OCT | DEC SET MODE BROWSE | EDIT SET SPOOL Y | N SHOW | ALL INFOMAP/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 | B
6、LOCK | 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 rowf - a letter which specifies a display format:x - hexadecimald - decimalu - unsigned decimalo - o
7、ctalc - character (native)n - Oracle numbert - Oracle datei - Oracle rowidFIND/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/
8、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 ALLREVERT DBA | FILE | FILENAME | BLOCK UNDOHELP | ALL VERIFY DBA | FILE | FILENAME | BLOCK CORRUPT DBA | FILE | FILENAME | BLOCK BB
9、ED还真不少,下面是几个常用的:set 设定当前的环境。show 查看当前的环境参数,跟sqlplus的同名命令类似。dump 列出指定block的内容find 在指定的block中查找指定的字符串,结果是显示出字符串,及其偏移量-offset,偏移量就是在block中的字节数modify 修改指定block的指定偏移量的值,可以在线修改。copy 把一个block的内容copy到另一个block中verify 检查当前环境是否有坏块sum 计算block的checksum,modify之后block就被标识为坏块,current checksum与reqired checksum不一致,su
10、m命令可以计算出新的checksum并应用到当前块。undo 回滚当前的修改操作,如果手误做错了,undo一下就ok了,回到原来的状态。revert 回滚所有之前的修改操作,意思就是 undo all下面做些实验:先建个表,插入1条数据。oraclevm1 oracle$ sqlplusSQL*Plus: Release 9.2.0.4.0 - Production on Wed Sep 14 16:46:15 2005Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.Enter user-name: / as
11、sysdbaConnected to:Oracle9i Enterprise Edition Release 9.2.0.4.0 - ProductionWith the Partitioning optionJServer Release 9.2.0.4.0 - ProductionSQL create table haocp ( a varchar2(10) tablespace users;Table created.SQL insert into haocp values(a);1 row created.SQL commit;Commit complete.SQL select se
12、gment_name,file_id,block_id,blocks from dba_extents where segment_name = HAOCP;SEGMENT_NAME-FILE_ID BLOCK_ID BLOCKS- - -HAOCP6 33 8表存放在file 6 block 33 - 33+8 上面,这时先关闭数据库,对users数据文件作个cp。SQL shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL SQL exitDisconnected from O
13、racle9i Enterprise Edition Release 9.2.0.4.0 - ProductionWith the Partitioning optionJServer Release 9.2.0.4.0 - Productionoraclevm1 oracle$oraclevm1 test$ pwd/u01/oracle/oradata/testoraclevm1 test$ cp users01.dbf users01.dbf.bakoraclevm1 test$ sqlplusSQL*Plus: Release 9.2.0.4.0 - Production on Wed
14、Sep 14 16:56:30 2005Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.Enter user-name: / as sysdbaConnected to an idle instance.SQL startupORACLE instance started.Total System Global Area 185668648 bytesFixed Size 451624 bytesVariable Size 117440512 bytesDatabase Buffers 67108864 byt
15、esRedo Buffers 667648 bytesDatabase mounted.Database opened.SQL重新启动完数据库,进入bbedoraclevm1 oracle$ lsa.txt bifile.bbd Desktop log.bbd par.bbdoraclevm1 oracle$ pwd/home/oracleoraclevm1 oracle$ bbed parfile=par.bbdPassword:BBED: Release 2.0.0.0.0 - Limited Production on Wed Sep 14 17:06:24 2005Copyright
16、(c) 1982, 2002, Oracle Corporation. All rights reserved.* ! For Oracle Internal Use only ! *BBED set file 6FILE# 6BBED showFILE# 6BLOCK# 1OFFSET 0DBA 0x01800001 (25165825 6,1)FILENAME /u01/oracle/oradata/test/users01.dbfBIFILE bifile.bbdLISTFILE a.txtBLOCKSIZE 8192MODE EditEDIT UnrecoverableIBASE De
17、cOBASE DecWIDTH 80COUNT 512LOGFILE log.bbdSPOOL NoBBED刚才创建的haocp表在file 6 blcok 33 - 33+8上面,用bbed看看36的内容BBED dump file 6 block 36File: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 0 to 511 Dba:0x01800024-06020000 24008001 9dcc0300 00000106 d3aa0000 01000000 4f190000 9bcc030000000000 020
18、03200 21008001 07000a00 54000000 84238000 17000b00 012000009dcc0300 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00010100 ffff1400 931f7b1f 7b1f0000 0100931f 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 0
19、0000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000
20、 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 000000
21、00 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000BBEDoffset 偏移量 从 0 到 511 单位是字节,数据块是8k的,想看完全就要扩大offset的范围BBED dump file 6 block 36 count 8200File: /u01/oracle/oradata/test/users01.dbf (6)Block: 36
22、 Offsets: 0 to 8191 Dba:0x01800024-06020000 24008001 9dcc0300 00000106 d3aa0000 01000000 4f190000 9bcc030000000000 02003200 21008001 07000a00 54000000 84238000 17000b00 012000009dcc0300 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00010100 ffff1400 931f7b1f 7b1f0000 0100931
23、f 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000之间略00000000 00000000 00000000 00000000 00000000 00000000 00000000 00
24、00000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 0000002c 01010161 01069dccBBEDOffset
25、s: 0 to 8191 1024 * 8 = 8192个字节,正好8K。注意最后的几个字节中,有个61,这个就是表中的那条数据,验证一下。SQL select * from haocp;A-aSQL select dump(a,1016) from haocp;DUMP(A,1016)-Typ=1 Len=1 CharacterSet=ZHS16GBK: 61字符a对应的16进制编码是61。如果数据量大的话,可以用find命令查找BBED help findFIND/x|d|u|o|c numeric/character string TOP | CURR BBED set file 6FI
26、LE# 6BBED set block 36BLOCK# 36BBED find 97 currFile: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6101069d ccBBED find /x 61 currFile: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6101069d cc在find之前先设置想要查找的 file 和 b
27、lock,默认是十进制的ascii编码,/x 表示16进制,find的结果显示出offset,即字符出现的位置。下面试试修改他,把a改成b。BBED help modifyMODIFY/x|d|u|o|c numeric/character string DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol BBED modify 98 file 6 block 36 offset 8187Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) yFile:
28、 /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6201069d cc修改完了以后,由61变成62了,不过这时数据块是损坏状态,试一下。BBED verifyDBVERIFY - Verification startingFILE = /u01/oracle/oradata/test/users01.dbfBLOCK = 36Block 36 is corrupt*Corrupt block relative dba: 0x01800024 (file 0, bloc
29、k 36)Bad check value found during verificationData in bad block -type: 6 format: 2 rdba: 0x01800024last change scn: 0x0000.0003cc9d seq: 0x1 flg: 0x06consistency value in tail: 0xcc9d0601check value in block header: 0xaad3, computed block checksum: 0x300spare1: 0x0, spare2: 0x0, spare3: 0x0*DBVERIFY
30、 - Verification completeTotal Blocks Examined : 1Total Blocks Processed (Data) : 0Total Blocks Failing (Data) : 0Total Blocks Processed (Index): 0Total Blocks Failing (Index): 0Total Blocks Empty : 0Total Blocks Marked Corrupt : 1Total Blocks Influx : 0Total Blocks Marked Corrupt : 1 有1个块被标识为损坏,从刚才备
31、份的那个文件覆盖它。BBED copy file 2 block 36 to file 6 block 36Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) yFile: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 0 to 511 Dba:0x01800024-06020000 24008001 9dcc0300 00000106 d3aa0000 01000000 4f190000 9bcc030000000000 02003200 2
32、1008001 07000a00 54000000 84238000 17000b00 012000009dcc0300 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00010100 ffff1400 931f7b1f 7b1f0000 0100931f 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000
33、 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 000000
34、00 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000
35、000000000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000000000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000从刚才关闭数据库时cp的文件中复制第36个块来覆盖当前的块,覆盖完了再检查一下。BBED verifyDBVERIFY - Verification startingFILE = /u01/oracle/oradata/test/users01.dbfBLOCK = 36DBVERIFY - Verific
36、ation completeTotal Blocks Examined : 1Total Blocks Processed (Data) : 1Total Blocks Failing (Data) : 0Total Blocks Processed (Index): 0Total Blocks Failing (Index): 0Total Blocks Empty : 0Total Blocks Marked Corrupt : 0Total Blocks Influx : 0好了,看看8187的情况BBED dump file 6 block 36 offset 8187File: /u
37、01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6101069d cc是原来的61,也就是字符 a 。再次改过来,试试回滚的命令。BBED modify /x 62 file 6 block 36 offset 8187File: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6201069d ccBBED undoBBED modify /x 6
38、1 filename /u01/oracle/oradata/test/users01.dbf block 36. offset 8187.File: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6101069d ccundo就相当于sqlplus里面的 rollback 不过是回滚上一步,而不是所有操作。下面试试revert,不过要重新登陆,因为revert是回滚这次登陆以来所有的操作。BBED dump file 6 block 36 offset 8187Fi
39、le: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6101069d ccBBED modify /x 62 file 6 block 36 offset 8187Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) yFile: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01
40、800024-6201069d ccBBED revertAll changes made in this session will be rolled back. Proceed? (Y/N) yReverted file /u01/oracle/oradata/test/users01.dbf, block 36Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) yBBED dump file 6 block 36 offset 8187File: /u01/oracle/oradata/test/users0
41、1.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6101069d cc个人感觉bbed主要用在数据库恢复的时候,比如由于误操作把数据库的字典表的信息改错了,导致数据库不能启动了,此时用bbed在脱机的情况下把字典表的值再改回来。使数据库open。用modify改完数据之后,block处于corrupt状态,所以要通过sum命令计算并应用checksum值,使block状态恢复正常。SQL select * from haocp;A-aBBED dump file 6 block 36 offset 8187File: /u01/o
42、racle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-6101069d ccBBED modify /x 62 file 6 block 36 offset 8187Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) yFile: /u01/oracle/oradata/test/users01.dbf (6)Block: 36 Offsets: 8187 to 8191 Dba:0x01800024-620
43、1069d ccBBED verifyDBVERIFY - Verification startingFILE = /u01/oracle/oradata/test/users01.dbfBLOCK = 36Block 36 is corrupt*Corrupt block relative dba: 0x01800024 (file 0, block 36)Bad check value found during verificationData in bad block -type: 6 format: 2 rdba: 0x01800024last change scn: 0x0000.0003cc9d seq: 0x1 flg: 0x06consistency value in tail: 0xcc9d0601check value in block header: 0xa
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024至2030年中国H型翅片管数据监测研究报告
- 2024年中国气相色谱演示仪市场调查研究报告
- 狗用外套项目可行性实施报告
- 2024年担保公司反担保抵押合同
- 2024年简单的门面出租合同
- 买卖合作协议书合同2024年
- 2024年酒店合作经营合同1000字范本
- 2024年员工试用期书面劳动合同范本
- 2024年方圆装饰工程合同
- 2024年农副产品买卖合同范本
- 部编小学道德与法治六年级上册感受生活中的法律(第一课时)课件
- 韩国《寄生虫》电影鉴赏解读
- 排球训练总结(4篇)
- 预防校园欺凌主题班会课件
- 六年级语文下册《记一次体育比赛》教案设计
- 文档系统需求方案(完整版)资料
- 贵州省高中信息技术会考复习
- 人教版九年级数学上册《反证法》说课稿
- 高清视频会议系统建设项目的验收方式与内容
- 2023年陕西省中考语文试卷【含答案】
- 浙人美2011版二年级美术上册《画家笔下的快乐童年》教案及教学反思
评论
0/150
提交评论