find命令可以用来搜索关键字。 可以从offset 0 搜索到top 或者从当前的offset 搜索到top。
find 命令支持的switch 类型如下,注意, find 不支持number和Date 。
|
Switch |
Datatype |
|
/x |
Hexadecimal 十六进制 |
|
/d |
Decimal 十进制 |
|
/u |
unsigned decimal |
|
/o |
Octal 八进制 |
|
/c |
character(native) |
创建测试数据
SQL> drop table test;
Table dropped.
SQL> create table test(name varchar2(100));
Table created.
SQL> insert into test values('ZhangSan');
1 row created.
SQL> commit;
Commit complete.
查看block情况:
SQL> 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 test;
ROWID REL_FNO BLOCKNO ROWNO
------------------ ---------- ---------- ----------
AAASK1AABAAAcc5AAA 1 116537 0
设置block 和 offset
BBED> set file 1
FILE# 1
BBED> set block 116537
BLOCK# 116537
BBED> set offset 0
OFFSET 0
查找ZhangSan
BBED> find /c ZhangSan top
File: /u01/app/oracle/oradata/T1/system01.dbf (1)
Block: 116537 Offsets: 8180 to 8191 Dba:0x0041c739
------------------------------------------------------------------------
5a68616e 6753616e 0506b2b2
<32 bytes per line>
BBED显示在offset8180的位置,dump该offset看看
BBED> d /v dba 1,116537 offset 8180 count 128
File: /u01/app/oracle/oradata/T1/system01.dbf (1)
Block: 116537 Offsets: 8180 to 8191 Dba:0x0041c739
-------------------------------------------------------
5a68616e 6753616e 0506b2b2 l ZhangSan..²²
<16 bytes per line>
如果我们要继续搜索Dave,那么只需要按下f 就可以了,不需要跟参数。
copy命令
命令格式如下:
BBED>copy dba 1,116537todba 1,116538
这个命令很危险,慎用
modify命令
在file 1,block 116537有ZhangSan,把他改成LiSi
BBED> modify /c LiSi dba 1,116537 offset 8180
File: /u01/app/oracle/oradata/T1/system01.dbf (1)
Block: 116537 Offsets: 8180 to 8191 Dba:0x0041c739
------------------------------------------------------------------------
4c695369 6753616e 0506b2b2
<32 bytes per line>
dump验证一下
BBED> d /v dba 1,116537 offset 8180 count 128
File: /u01/app/oracle/oradata/T1/system01.dbf (1)
Block: 116537 Offsets: 8180 to 8191 Dba:0x0041c739
-------------------------------------------------------
4c695369 6753616e 0506b2b2 l LiSigSan..²²
<16 bytes per line>
------注意: 这 里只修改了ZhangSan的前四个字母,即把Zhan改成LiSi
------注意:这里仅仅是修改,还没有进行update,即sum apply,select 才会改变。
SQL>select * from test;
NAME
-------------
ZhangSan
执行sum apply
BBED> sum apply
Check value for File 1, Block 116537:
current = 0x281a, required = 0x281a
再次查询
SQL>select*from test;
NAME -----------LiSigSan
