Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and use of BBED tools (1)

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

BBED is a tool used to view and modify data files directly. It is an internal tool of Oracle that can directly modify the contents of Oracle data file blocks. It is useful in some extreme recovery scenarios. To use the tool, you need to install it yourself. In Oracle 9i and 10g versions, the installation method is simple:

[oracle@node1 U01] $cd $ORACLE_HOME/rdbms/lib/

[oracle@node1 lib] $make-f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed

Linking BBED utility (bbed)

Rm-f / u01/app/oracle/10.2.0/db_1/rdbms/lib/bbed

Gcc-o / u01/app/oracle/10.2.0/db_1/rdbms/lib/bbed-L/u01/app/oracle/10.2.0/db_1/rdbms/lib/-L/u01/app/oracle/10.2.0/db_1/lib/-L/u01/app/oracle/10.2.0/db_1/lib/stubs/-L/usr/lib-lirc / u01/app/oracle/10.2.0/db_1/ Lib/s0main.o / u01/app/oracle/10.2.0/db_1/rdbms/lib/ssbbded.o / u01/app/oracle/10.2.0/db_1/rdbms/lib/sbbdpt.o `cat / u01/app/oracle/10.2.0/db_1/lib/ ldbears`-lnsslb10-lncrypt10-lnsgr10-lnzjs10-ln10-lnnz10-lnl10 / u01/app/oracle/10.2.0/db_1/rdbms/lib/defopt.o-ldbtools10-lclntsh `cat / u01 / App/oracle/10.2.0/db_1/lib/ ldyogs`-lnsslb10-lncrypt10-lnsgr10-lnzjs10-ln10-lnnz10-lnl10-lnro10 `cat / u01/app/oracle/10.2.0/db_1/lib/ ldyogs`-lnsslb10-lncrypt10-lnsgr10-lnzjs10-ln10-lnnz10-lnl10-lclient10-lnnetd10-lvsn10-lcommon10-lgeneric10-lmm-lsnls10-lnls10-lcore10-lsnls10-lnls10-lcore10-lsnls10-lnls10-lxml10-lcore10-lunls10-lsnls10-lnls10-lnls10 / lcore10. 2.0/db_1/lib/ ldyogs`-lnsslb10-lncrypt10-lnsgr10-lnzjs10-ln10-lnnz10-lnl10-lnro10 `cat / u01/app/oracle/10.2.0/db_1/lib/ ldfants`-lnsslb10-lncrypt10-lnsgr10-lnzjs10-ln10-lnnz10-lnl10-lclient10-lnnetd10-lvsn10-lcommon10-lgeneric10-lsnls10-lnls10-lcore10-lsnls10-lnls10-lcore10-lsnls10-lnls10-lxml10-lcore10-lunls10-lsnls10-lnls10-lnls10-lcore10-lcore10-lnls10-lnls10-lclient10-lclient10-- -lnls10-lcore10-lsnls10-lnls10-lxml10-lcore10-lunls10-lsnls10-lnls10-lcore10-lnls10 `cat / u01/app/oracle/10.2.0/db_1/lib/ sysliblist`-Wl -rpath,/u01/app/oracle/10.2.0/db_1/lib-lm `cat / u01/app/oracle/10.2.0/db_1/lib/ sysliblist`-ldl-lm-L/u01/app/oracle/10.2.0/db_1/lib

BBET library files are not provided by default in Oracle11g. If necessary, you can copy the files in 10g to the corresponding directory in 11g and then perform the installation:

$ORACLE_HOME/rdbms/lib/ssbbded.o

$ORACLE_HOME/rdbms/lib/sbbdpt.o

$ORACLE_HOME/rdbms/mesg/bbedus.msb

$ORACLE_HOME/rdbms/mesg/bbedus.msg

You will find that there is a default password when you use it for the first time, from which you can see the restriction of oracle on the bbed tool. The default password is blockedit.

[oracle@node1 ~] $cd $ORACLE_HOME/rdbms/lib

[oracle@node1 lib] $. / bbed

Password:

BBED: Release 2.0.0.0.0-Limited Production on Thu Jul 10 16:09:57 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

*! For Oracle Internal Use only!! *

Check the bbed command

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]

Modem [/ 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]

Set sets the current environment

Show looks at the current environment parameters, similar to sqlplus's command of the same name.

Dump lists the contents of the specified block

Find looks for the specified string in the specified block. The result is that the string and its offset, offset, are displayed. The offset is the number of bytes in the block.

Modify modifies the value of the specified offset of the specified block, which can be modified online.

Copy copy the contents of one block to another block

Verify checks whether there are bad blocks in the current environment

After sum calculates the checksum,modify of block, block is identified as a bad block, current checksum is inconsistent with reqired checksum, and the sum command can calculate a new checksum and apply it to the current block.

Undo rolls back the current modification operation. If you make a mistake, undo will ok and return to the original state.

Revert rolls back all previous modifications, which means undo all

Configure a parameter text for bbed

Make bbed list

SQL > set heading off

SQL > set feedback off

SQL > spool / u01/bbedlist.parf

SQL > select file# | |''| | name | |''| | bytes from v$datafile

1/ u01/app/oracle/oradata/orcl_dup/system01.dbf 524288000

3 / u01/app/oracle/oradata/orcl_dup/sysaux01.dbf 346030080

4 / u01/app/oracle/oradata/orcl_dup/users01.dbf 191365120

5 / u01/app/oracle/oradata/orcl_dup/example01.dbf 104857600

6 / u01/app/oracle/oradata/orcl_dup/tts01.dbf 20971520

7 / u01/app/oracle/oradata/orcl_dup/tts02.dbf 20971520

8 / u01/app/oracle/oradata/orcl_dup/undotbs001.dbf 104857600

SQL > spool off

SQL > set heading on

SQL > set feedback on

Make parfile

[oracle@node1 lib] $vi / u01/bbed.par

Blocksize = 8192

Listfile= / u01/bbedlist.parf

Mode = edit

Start bbed with parfile

[oracle@node1 lib] $. / bbed parfile=/u01/bbed.par password=blockedit

BBED: Release 2.0.0.0.0-Limited Production on Thu Jul 10 16:42:27 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

*! For Oracle Internal Use only!! *

BBED > show

FILE# 1

BLOCK# 1

OFFSET 0

DBA 0x00400001 (4194305 1)

FILENAME / u01/app/oracle/oradata/orcl_dup/system01.dbf

BIFILE bifile.bbd

LISTFILE / u01/bbedlist.parf

BLOCKSIZE 8192

MODE Edit

EDIT Unrecoverable

IBASE Dec

OBASE Dec

WIDTH 80

COUNT 512

LOGFILE log.bbd

SPOOL No

Get the RDBA (Relative Data Block Address) of the specified value through bbed

SQL > select * from bbed_test

JOB

-

123456

1234567890

2 rows selected.

SQL > select

2 rowid

3 dbms_rowid.rowid_relative_fno (rowid) rel_fno

4 dbms_rowid.rowid_block_number (rowid) blockno

5 dbms_rowid.rowid_row_number (rowid) rowno

6 from bbed_test

ROWID REL_FNO BLOCKNO ROWNO

--

AAAN9GAAEAAAAK0AAA 4 692 0

AAAN9GAAEAAAAK0AAB 4 692 1

2 rows selected.

BBED > set dba 4692 offset 0

DBA 0x010002b4 (16777908 4692)

OFFSET 0

BBED > show

FILE# 4

BLOCK# 692

OFFSET 8168

DBA 0x010002b4 (16777908 4692)

FILENAME / u01/app/oracle/oradata/orcl_dup/users01.dbf

BIFILE bifile.bbd

LISTFILE / u01/bbedlist.parf

BLOCKSIZE 8192

MODE Edit

EDIT Unrecoverable

IBASE Dec

OBASE Dec

WIDTH 80

COUNT 512

LOGFILE log.bbd

SPOOL No

Of course, it is also easily available in the database through the dbms_utility package, which can be compared here.

SQL > variable get_rdba varchar2 (30)

SQL > exec: dba: = dbms_utility.make_data_block_address (4692)

PL/SQL procedure successfully completed.

SQL > print dba

DBA

-

16777908

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report