Bbed2


  1. examine(x)

       The examine command is used to display data from the block in raw or formattedoutput. The DBA, Filename, File, Block and/or Offset to examine can bespecified with the command. If these are not specified the current file, blockand offset as established with the set command will be examined. If the examinecommand is issued with just the block and offset to examine, bbed will displaythe data structure at that offset.

       —examine命令也是用来显示datablock的内容的

       Unlikethe print command it cannot interpret data structures, but it can be used todisplay row information. Combined with knowledge of the data type of the row,it can be used to retrieve complete rows from the block:

       –print命令不能对data structures 进行一个解释说明。

 
 

       The examine command will interpret the data in the block according to the followingswitches:

Switch

Display Format

/b

b1, ub1 (byte)

/h

b2, ub2 (half-word)

/w

b4, ub4 (word)

/l

b8, ub8 (long) (was b4/ub4 in Oracle7).

/r

Oracle table/index row

 
 

       Theexamine command allows switches from the print command to be combined withthese specific switches to interpret data.

       —examine可以根据switch的方式和print 命令进行一个结合来对data 进行解释说明

 
 

       Forexample if we wanted to interpret data as an Oracle table row with the firstcolumn character and the second and third columns numeric, we would execute thecommand as follows:

       BBED>x /rcnn

 
 

       Thefollowing example shows the print and examine commands being used to step throughthe first and second rows of a block, with the data interpreted as a row in theformat: character, number, number:

 
 

x /rcnn

 Bbed2

select * from scott.emp;

Bbed2

  1. find(f)

       The find command is used to locate data within a block. The command allows hex,string or numeric data to be searched for. The pattern can be searched for fromthe top of the block (offset 0) using the TOP directive, or from the currentposition using the CURR directive.

       find命令可以用来搜索关键字
可以从offset 0 搜索到top 或者从当前的offset 搜索到top

 
 

       Switchesare used to determine the data type of the pattern to search for. These areshown below:

Switch

Datatype

/x

Hexadecimal

/d

Decimal

/u

unsigned decimal

/o

Octal

/c

character (native)

Note: Number and Dates are not supported bythe find command.

       find 命令支持的switch 类型如上表,注意,find 不支持numberDate

 
 

 select rowid,

dbms_rowid.rowid_relative_fno(rowid)rel_fno,

dbms_rowid.rowid_block_number(rowid)blockno,

dbms_rowid.rowid_row_number(rowid) rowno

from scott.emp;

Bbed2

set file 4

set block 145

set offset 0

find /c SCOTT top

Bbed2

d /v dba 4,145 offset 7864 count 128

Bbed2

SCOTT

 

 
 

  1. copy

       The copy command is used to copy blocks from one location to another. As with other commands, the file or filename and offset can be specified, or the DBA can be specified instead.

 可以把一个块的内容拷贝到另一个块中。

命令格式如下:

BBED> copy dba 1,115362 to dba 1,115363

copy 是个危险的命令,慎用。

 
 

  1. modify(m)

BBED> help modify

MODIFY[/x|d|u|o|c] numeric/character string

[ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]

 

BBED>

 

       The modify command is used to change data inside a block. The DBA, Filename, File,Block and/or Offset to modify can be specified with the command. If these are not specified the current file, block and offset as established with the set command will be modified. Alternatively a symbol or symbol pointer can bespecified for modification.

       The pattern of bytes used to overwrite the original can be specified inhexadecimal, decimal, unsigned decimal, octal or character data using the sameswitches as the find command.

 可以修改块中的内容,该步骤不演示,下面实验有。

       file 1,block 115362 有我们的Dave,我们这里把Dave 改成dmm

 modify /c HAHAH dba 4,31 offset 7864  该步骤不演示,下面实验有。

 

Bbed2

d /v dba 4,31 offset 7864 count 128

Bbed2

select * from scott.emp;

Bbed2

现在无改变。

sum apply

Bbed2

重启库才能生效。

shutdown immediate;

startup

select * from scott.emp;

Bbed2

 

  1. assign

       The assign command does symbolic assignment, with type and range checking. Either target or source can be omitted for the current offset.

       For example, the following command assigns structure at current offset to file 4,block 2 “s first ITL entry

BBED> assign dba 4, 145 ktbbhitl[0]

 指定结构
,不演示。

  1. sum

       Thesum command is used to check and set the block checksum. The DBA, Filename,File, Block and/or Offset to check can be specified with the command. If theseare not specified the current file, block and offset as established with theset command will be checked.

       Theapply directive can be used to update the checksum.

       我们可以使用bbed block 进行修改。
要使这些修改生效,就要使用sum命令

该步骤不演示,下面实验有。

 sum dba 4,31 apply  该步骤不演示,下面实验有。

Bbed2

重启库或清除缓冲区才能生效。

 

  1. push / pop

       Thepush and pop commands are used to push a file, block and offset location onto amemory backed stack and then pop them back. This allows a current locationbeing edited to be temporarily saved while another location is examined ormodified.

Note that the stack only stores the locationœ it does notsave the contents.

       —push命令将对象放到内存的stackpop 将对象从内存写回磁盘

 
 

       Thefollowing example shows file 7, block 16, offset 8163 being examined. Thelocation is saved with the push command. We then move to file 6, block 1 beforereturning to DBA 7,16 with the pop command.

 
 

BBED> push dba 7,16

DBA 0x01c00010 (29360144 7,16)

OFFSET 8163

 
 

BBED> set dba 6,1

DBA 0x01800001 (25165825 6,1)

 
 

BBED> pop

DBA 0x01c00010 (29360144 7,16)

OFFSET 8163

       The command pop all can be used to remove all push’d entries from the stack. Thecommand show all can be used to show all saved locations.

 
 

 
 

  1. revert

       Therevert command is used to restore a file, filename, block or DBA to it’soriginal state when bbed was started.

       revert恢复自bbed 启动以来的所有修改

 revert dba 4,31该步骤不演示,下面实验有。

Bbed2

sum dba 4,31 apply

Bbed2

重启库才能看到变化。

shutdown immediate

startup

Bbed2

或者:

alter system flush buffer_cache;

Bbed2

select * from scott.emp;

Bbed2

 
 

还是没有改变,flush 一下buffer cache之后就更改回来了。我们刚才在之前的测试时,是重启了DB
看来也是启了flush buffer cache的作用。

 
 

  1. undo

       Theundo command rolls back the last modify or assign command. If the undo commandis issued again the modification is re-done.

       undo命令是回滚最后一次的操作

该步骤不演示,下面实验有。

 modify /c HAHAH dba 4,31 offset 7864该步骤不演示,下面实验有。

Bbed2

d /v dba 4,31 offset 7864 count 128

Bbed2

sum apply

Bbed2

一定要提交。

如果不提交之前可以

undo 该步骤不演示,下面实验有。

Bbed2

alter system flush buffer_cache;

Bbed2

select * from scott.emp;

Bbed2

 

 
 

 
 

  1. verify

       Theverify command is used to verify the integrity of the block. It performs asimilar function to the dbverify utility.

       verify命令用来验block的完整性

 verify dba 4,145

Bbed2

查看有没有坏块 

 

  1. corrupt

       The corrupt command is used to mark blocks as media corrupt.

       corrupt命令将一个block 标记为corrupt,这样db 在操作时就会跳过该block,从而避免错误

verify dba 4,31 该步骤不演示,下面实验有。

Bbed2

corrupt dba 4,31该步骤不演示,下面实验有。

Bbed2

verify dba 4,31

Bbed2

注意: undo 命令不能undo 一个corruption,但是revert 命令却可以。

 revert dba 4,31

Bbed2

sum apply

Bbed2

verify dba 4,31

Bbed2