一、BBED安装
[oracle@10g ~]$ cd /u01/app/oracle/product/10.2.0/db_1/rdbms/lib/
[oracle@10g lib]$ make -f ins_rdbms.mk /u01/app/oracle/product/10.2.0/db_1/rdbms/lib/bbed
密码:blockedit
二、进入BBED
[oracle@10g lib]$ ./bbed
Password: blockedit
BBED: Release 2.0.0.0.0 - Limited Production on Sun Mar 23 14:10:03 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED>
三、查看帮助
BBED> help all;
SET DBA [ dba | file#, block# ]
SET FILENAME 'filename'
SET FILE file#
SET BLOCK [+/-]block#
SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
SET BLOCKSIZE bytes
SET LIST[FILE] 'filename'
SET WIDTH character_count
SET COUNT bytes_to_display
SET IBASE [ HEX | OCT | DEC ]
SET OBASE [ HEX | OCT | DEC ]
SET MODE [ BROWSE | EDIT ]
SET SPOOL [ Y | N ]
SHOW [ | ALL ]
INFO
MAP[/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 | BLOCK | 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 row
f - a letter which specifies a display format:
x - hexadecimal
d - decimal
u - unsigned decimal
o - octal
c - character (native)
n - Oracle number
t - Oracle date
i - Oracle rowid
FIND[/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[/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 [ALL]
REVERT [ DBA | FILE | FILENAME | BLOCK ]
UNDO
HELP [ | ALL ]
VERIFY [ DBA | FILE | FILENAME | BLOCK ]
CORRUPT [ DBA | FILE | FILENAME | BLOCK ]
四、测试
1、创建表空间test
SYS@ORCL>create tablespace test datafile
'/u01/app/oracle/oradata/test01.dbf' size 10m;
Tablespace created.
SYS@ORCL>select file_id,file_name from dba_data_files;
FILE_ID FILE_NAME
---------- --------------------------------------------------
4 /u01/app/oracle/oradata/ORCL/users01.dbf
3 /u01/app/oracle/oradata/ORCL/sysaux01.dbf
2 /u01/app/oracle/oradata/ORCL/undotbs01.dbf
1 /u01/app/oracle/oradata/ORCL/system01.dbf
5 /u01/app/oracle/oradata/test01.dbf
2、创建用户jzh
SYS@ORCL>create user jzh identified by jzh default tablespace TEST;
User created.
SYS@ORCL>grant dba to jzh;
Grant succeeded.
3、创建测试表、插入数据
JZH@ORCL>create table t (id int,name varchar2(30)) tablespace test;
Table created.
JZH@ORCL>insert into t values(1,'jzha');
1 row created.
JZH@ORCL>insert into t values(2,'jzhb');
1 row created.
JZH@ORCL>insert into t values(3,'jzhc');
1 row created.
JZH@ORCL>commit;
Commit complete.
JZH@ORCL>select dbms_rowid.ROWID_RELATIVE_FNO(rowid),dbms_rowid.ROWID_BLOCK_NUMBER(rowid),id,name from t;
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID) DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID) ID NAME
------------------------------------ ------------------------------------ ---------- ------------------------------
5 14 1 jzha
5 14 2 jzhb
5 14 3 jzhc
4、设置文件
BBED> set filename '/u01/app/oracle/oradata/test01.dbf'
FILENAME /u01/app/oracle/oradata/test01.dbf
5、设置文件编号
BBED> set file 5
FILE# 5
BBED> set block 14
BLOCK# 14
6、设置块号
BBED> show all
FILE# 5
BLOCK# 14
OFFSET 0
DBA 0x0140000e (20971534 5,14)
FILENAME /u01/app/oracle/oradata/test01.dbf
BIFILE bifile.bbd
LISTFILE /home/oracle/bbed.lst
BLOCKSIZE 8192
MODE Browse
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No
7、设置编辑模式
BBED> set MODE edit
MODE Edit
8、设置块大小
BBED> set count 8192
COUNT 8192
9、dump块结构
BBED> dump
File: /u01/app/oracle/oradata/test01.dbf (5)
Block: 14 Offsets: 0 to 8191 Dba:0x0140000e
------------------------------------------------------------------------
06a20000 0e004001 3a780800 00000506 5ebd0000 01000000 9cc80000 e0770800
00000000 02003200 09004001 04001a00 27010000 0c078000 ab002000 03200000
3a780800 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00010300 ffff1800 771f5f1f 5f1f0000 03008d1f 821f771f 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
JZH@ORCL>alter system dump datafile 5 block 14;
[oracle@10g udump]$ more orcl_ora_17005.trc
/u01/app/oracle/admin/ORCL/udump/orcl_ora_17005.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
System name: Linux
Node name: 10g
Release: 2.6.32-200.13.1.el5uek
Version: #1 SMP Wed Jul 27 21:02:33 EDT 2011
Machine: x86_64
Instance name: ORCL
Redo thread mounted by this instance: 1
Oracle process number: 17
Unix process pid: 17005, image: oracle@10g (TNS V1-V3)