1,bbed的创建(10g的测试)
[oracle@rac1 ~]$
[oracle@rac1 lib]$
[oracle@rac1 lib]$ cd $ORACLE_HOME/bin
[oracle@rac1 bin]$ ls -lrt bbed
-rwxr-xr-x 1 oracle oinstall 548768 Dec 17 11:49 bbed
2,使用bbed工具
(1) 创建par配置文件
sql>select file#||' '||name||' '||bytes from v$datafile ; 将查询的结果放入/home/oracle/bbed/filelist.txt中。
[oracle@rac1 ~]$ cat /home/oracle/bbed/bbed.par
blocksize=8192
/home/oracle/bbed/filelist.txt
mode=edit
(2)登陆bbed
[oracle@rac1 bbed]$bbed parfile=bbed.par
默认的密码为:blockedit
BBED>
(3)常用命令
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不一致,sum命令可以计算出新的checksum并应用到当前块。
undo 回滚当前的修改操作,如果手误做错了,undo一下就ok了,回到原来的状态。
revert 回滚所有之前的修改操作,意思就是 undo all
(4)直接修改数据文件头的起库
SQL> startup
ORACLE instance started.
Total System Global Area 788529152 bytes
Fixed Size 2087216 bytes
Variable Size 423626448 bytes
Database Buffers 356515840 bytes
Redo Buffers 6299648 bytes
Database mounted.
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/opt/ora10g/oradata/orcl/users01.dbf'
SQL> select name,checkpoint_change# from v$datafile;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------- ------------------
/opt/ora10g/oradata/orcl/system01.dbf 13185657
/opt/ora10g/oradata/orcl/undotbs01.dbf 13185657
/opt/ora10g/oradata/orcl/sysaux01.dbf 13185657
/opt/ora10g/oradata/orcl/users01.dbf 13185657
/opt/ora10g/oradata/orcl/test_data.dbf 13185657
/opt/ora10g/oradata/orcl/xldata01.dbf 13185657
/opt/ora10g/oradata/orcl/timdata01.dbf 13185657
/opt/ora10g/oradata/orcl/xllogtmpdata01.dbf 13185657
/opt/ora10g/oradata/orcl/user02.dbf 13185657
13185657 换算为16进制 C93279
SQL> select name,checkpoint_change# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------- ------------------
/opt/ora10g/oradata/orcl/system01.dbf 13185657
/opt/ora10g/oradata/orcl/undotbs01.dbf 13185657
/opt/ora10g/oradata/orcl/sysaux01.dbf 13185657
/opt/ora10g/oradata/orcl/test_data.dbf 13185657
/opt/ora10g/oradata/orcl/xldata01.dbf 13185657
/opt/ora10g/oradata/orcl/timdata01.dbf 13185657
/opt/ora10g/oradata/orcl/xllogtmpdata01.dbf 13185657
/opt/ora10g/oradata/orcl/user02.dbf 13185657