[20231023]生成bbed的執行指令碼(bash shell).txt
[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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2992943/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20231021]生成bbed的執行指令碼.txt指令碼
- [20190107]生成bbed執行指令碼:指令碼
- [20210618]記錄bash shell執行的命令.txt
- [20210330]bash使用source or ..呼叫shell指令碼注意txt指令碼
- 生成 Linux 執行時間報告的 Bash 指令碼Linux指令碼
- 執行shell指令碼報錯:-bash: ./test1.sh: /bin/bash^M: ...指令碼
- [20231102]除錯bash shell指令碼遇到的問題.txt除錯指令碼
- [20210107]編寫bash shell指令碼遇到的問題.txt指令碼
- 詳解shell中source、sh、bash、./執行指令碼的區別指令碼
- 執行shell指令碼指令碼
- Linux shell:執行shell指令碼的幾種方式Linux指令碼
- [20180930]bash shell &.txt
- [20190126]從sqlplus執行結果返回bash shell變數.txtSQL變數
- shell和bash指令碼命令學習指令碼
- Mac 終端執行 shell 指令碼Mac指令碼
- bash shell多執行緒方案執行緒
- [20190510]快速建立執行指令碼.txt指令碼
- [20210913]bash shell $* and $@ 的區別.txt
- bash shell指令碼接受多個引數指令碼
- shell指令碼linux命令連續執行指令碼Linux
- Bash Shell指令碼中的陣列使用例項指令碼陣列
- [20210908]Reverse Shell with Bash.txt
- shell指令碼執行錯誤 $‘\r‘:command not found指令碼
- 執行 shell 指令碼 \r 問題解決指令碼
- shell指令碼頭,#!/bin/sh與#!/bin/bash的區別.指令碼
- Linux中執行Shell指令碼的方式(三種方法)Linux指令碼
- shell指令碼的三種執行方式和區別指令碼
- [20181212]bash shell 字串 補零.txt字串
- [20201116]bash shell IO重定向.txt
- 一個能夠生成 Markdown 表格的 Bash 指令碼指令碼
- [20220414]toad呼叫執行指令碼問題.txt指令碼
- [20181229]bash shell的算術運算 .txt
- LightDB/PostgreSQL 生成可重複執行的指令碼SQL指令碼
- 使用Mac自定義快捷鍵執行shell指令碼Mac指令碼
- php執行shell指令碼需要sudo許可權PHP指令碼
- shell指令碼命令 執行python檔案&python命令列執行python程式碼指令碼Python命令列
- Shell多執行緒備份資料庫的指令碼執行緒資料庫指令碼
- [20231123]函式與bash shell呼叫.txt函式