​[20231023]生成bbed的执行脚本(bash shell).txt

来源:这里教程网 时间:2026-03-03 19:00:47 作者:

[20231023]生成bbed的执行脚本(bash shell).txt --//尝试使用bbed 恢复rename IDL_UB1$的情况,前面的准备分析时间很长,恢复很容易。但是每次做修复数据块的一致性时,我总是还要 --//查询我以前写的文档,特别浪费时间记不住一些细节。实际上主要写计算公式上,我想既然已经给出提示信息。通过外部命令计算很 --//容易生成bbed的执行脚本,自己尝试看看。 --//bbed执行verify后出现6110,6111错误,简单更正公式如下: --//code 6110 --//avsp = dtl-used-fsc --//code 6111 --//tosp = avsp+stb+fsc --//code=6110的情况: BBED> verify DBVERIFY - Verification starting FILE = /mnt/ramdisk/book/system01.dbf BLOCK = 243 Block Checking: DBA = 4194547, Block Type = KTB-managed data block data header at 0x8ec644 kdbchk: the amount of space used is not equal to block size         used=7298 fsc=66 avsp=822 dtl=8120 Block 243 failed with check code 6110 --//avsp = dtl-used-fsc --//avsp= 8120-7298-66 = 756 --//补充建议:我看有一些选择设置fsc=0,方法就是要修改对应事务itl的fsc值,要看行记录的lock,才知道那个事务的ITL。 --//这样可能avsp不需要修改。比如修改成如下: used=7298 fsc=0 avsp=822 dtl=8120 --//dtl-used-fsc 8120-7298-0 = 822. BBED> assign kdbh.kdbhavsp=756 sb2 kdbhavsp                                @78       756 --//code=6111的情况: BBED> verify DBVERIFY - Verification starting FILE = /mnt/ramdisk/book/system01.dbf BLOCK = 243 Block Checking: DBA = 4194547, Block Type = KTB-managed data block data header at 0x8ec644 kdbchk: space available on commit is incorrect         tosp=890 fsc=66 stb=0 avsp=756 Block 243 failed with check code 6111 --//tosp = avsp+stb+fsc --//tosp= 756+0+66  = 822 BBED> assign kdbh.kdbhtosp=822 sb2 kdbhtosp                                @80       822 --//建立脚本如下: $ cat bbed1011.sh #! /bin/bash # create bbed script ,resolve code 6110 and 6111 # argument1=dba a=$1 echo verify dba $a| rlbbed | grep "code 6110" > /dev/null if [ $? -eq 0 ] ; then #    echo verify dba $a | rlbbed | tr -d '\r' | grep "avsp" | sed -e "s/^\s*//;s/ /;/g;s/$/;dtl-used-fsc/"| bc -q | sed "s/^/ assign dba $a kdbh.kdbhavsp = /" echo verify dba $a | rlbbed | tr -d '\r' | grep "avsp" | sed -e "s/^\s*//;s/ /;/g;s/$/;dtl-used-fsc/" | bc -q | sed "s/^/ assign dba $a kdbh.kdbhavsp = /" fi echo verify dba $a| rlbbed | grep "code 6111" > /dev/null if [ $? -eq 0 ] ; then     echo verify dba $a | rlbbed | tr -d '\r' | grep "avsp" | sed -e "s/^\s*//;s/ /;/g;s/$/;avsp+stb+fsc/"| bc -q | sed "s/^/assign dba $a kdbh.kdbhtosp = /" fi --//感觉不需要调用这么多次bbed,再引入1个参数输出code代码,修改如下: $ cat bbed1011x.sh #! /bin/bash # create bbed script ,resolve code 6110 and 6111 # argument1=dba argument2=bbed code # if [$2 -eq 6110  ] ; then #     str1=";dtl-used-fsc" #     str2="kdbh.kdbhavsp" # fi # if [$2 -eq 6110  ] ; then #     str1=";avsp+stb+fsc" #     str2="kdbh.kdbhtosp" # fi a=$1 case $2 in     6110|10)         str1=";dtl-used-fsc"         str2="kdbh.kdbhavsp"         str3=6110         ;;     6111|11)         str1=";avsp+stb+fsc"         str2="kdbh.kdbhtosp"         str3=6111         ;; esac echo verify dba $a| rlbbed | tr -d '\r' | grep -B1 "code ${str3}$" | grep "avsp" | sed -e "s/^\s*//;s/ /;/g;s/$/${str1}/"| bc -q | sed "s/^/assign dba $a $str2 = /" #echo verify dba $a | rlbbed | grep -B1 "code ${str3}$" | grep "avsp" | sed -e "s/^\s*//;s/ /;/g;s/$/${str1}/"| bc -q | sed "s/^/ assign dba $a $str2 = /" #echo verify dba $a| rlbbed | grep -B1 "code 6110$" | grep "avsp" | sed -e "s/^\s*//;s/ /;/g;s/$/;dtl-used-fsc/"| bc -q | sed "s/^/ assign dba $a kdbh.kdbhavsp = /" #echo verify dba $a| rlbbed | grep -B1 "code 6111$" | grep "avsp" | sed -e "s/^\s*//;s/ /;/g;s/$/;avsp+stb+fsc/"| bc -q | sed "s/^/ assign dba $a kdbh.kdbhtosp = /" --//测试在cygwin ,过滤出来的内容有1个\r字符,要删除掉. --//测试看看: 1.环境: SCOTT@test01p> @ver1 PORT_STRING                    VERSION        BANNER                                                                               CON_ID ------------------------------ -------------- -------------------------------------------------------------------------------- ---------- IBMPC/WIN_NT64-9.1.0           12.2.0.1.0     Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production              0 SCOTT@test01p> create table deptx as select * from dept; Table created. SCOTT@test01p> select rowid,deptx.* from deptx where rownum=1; ROWID                  DEPTNO DNAME                LOC ------------------ ---------- -------------------- ------------- AAAHZ8AALAAABLTAAA         10 ACCOUNTING           NEW YORK SCOTT@test01p> @ rowid AAAHZ8AALAAABLTAAA     OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT ---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------      30332         11       4819          0  0x2C012D3           11,4819              alter system dump datafile 11 block 4819 SCOTT@test01p> delete from deptx where deptno = 10; 1 row deleted. SCOTT@test01p> commit ; Commit complete. SCOTT@test01p> alter system checkpoint; System altered. 2.尝试恢复看看: BBED> x /rncc dba 11,4820 *kdbr[0] rowdata[66]                                 @8162 ----------- flag@8162: 0x3c (KDRHFL, KDRHFF, KDRHFD, KDRHFH) lock@8163: 0x02 cols@8164:    0 BBED> assign dba 11,4820 offset 8162=0x2c; ub1 rowdata[0]                              @8162     0x2c BBED> x /rncc dba 11,4820 *kdbr[0] rowdata[66]                                 @8162 ----------- flag@8162: 0x2c (KDRHFL, KDRHFF, KDRHFH) lock@8163: 0x02 cols@8164:    3 col    0[2] @8165: 10 col   1[10] @8168: ACCOUNTING col    2[8] @8179: NEW YORK BBED> sum apply dba 11,4820 Check value for File 11, Block 4820: current = 0x1c09, required = 0x1c09 BBED> verify dba 11,4820 DBVERIFY - Verification starting FILE = D:\APP\ORACLE\ORADATA\TEST\TEST01P\USERS01.DBF BLOCK = 4819 Block Checking: DBA = 46142163, Block Type = KTB-managed data block data header at 0x2b7027c kdbchk: the amount of space used is not equal to block size         used=118 fsc=24 avsp=7946 dtl=8064 --// assign kdbh.kdbhavsp = 7922 Block 4819 failed with check code 6110 DBVERIFY - Verification complete $ ./bbed1011.sh 11,4820 6110 ; ./bbed1011x.sh 11,4820 6110 assign dba 11,4820 kdbh.kdbhavsp = 7922 assign dba 11,4820 kdbh.kdbhavsp = 7922 --//ok!! BBED> assign dba 11,4820 kdbh.kdbhavsp = 7922 b2 kdbhavsp                                 @134      7922 BBED> sum apply dba 11,4820 Check value for File 11, Block 4820: current = 0x1df1, required = 0x1df1 BBED> verify dba 11,4820 DBVERIFY - Verification starting FILE = D:\APP\ORACLE\ORADATA\TEST\TEST01P\USERS01.DBF BLOCK = 4819 Block Checking: DBA = 46142163, Block Type = KTB-managed data block data header at 0x2b7027c kdbchk: space available on commit is incorrect         tosp=7972 fsc=24 stb=0 avsp=7922 --// assign kdbh.kdbhtosp = 7946 Block 4819 failed with check code 6111 DBVERIFY - Verification complete $ ./bbed1011.sh 11,4820 6110 ; ./bbed1011x.sh 11,4820 6111 assign dba 11,4820 kdbh.kdbhtosp = 7946 assign dba 11,4820 kdbh.kdbhtosp = 7946 BBED> assign dba 11,4820 kdbh.kdbhtosp = 7946 b2 kdbhtosp                                 @136      7946 BBED> sum apply dba 11,4820 Check value for File 11, Block 4820: current = 0x1ddf, required = 0x1ddf BBED> verify dba 11,4820 DBVERIFY - Verification starting FILE = D:\APP\ORACLE\ORADATA\TEST\TEST01P\USERS01.DBF BLOCK = 4819 DBVERIFY - Verification complete --//OK!修复完成. SCOTT@test01p> alter system flush BUFFER_CACHE; System altered. SCOTT@test01p> select rowid,deptx.* from deptx ; ROWID                  DEPTNO DNAME                LOC ------------------ ---------- -------------------- ------------- AAAHZ8AALAAABLTAAA         10 ACCOUNTING           NEW YORK AAAHZ8AALAAABLTAAB         20 RESEARCH             DALLAS AAAHZ8AALAAABLTAAC         30 SALES                CHICAGO AAAHZ8AALAAABLTAAD         40 OPERATIONS           BOSTON

相关推荐