[20191206]隱含引數_db_always_check_system_ts.txt
[20191206]隱含引數_db_always_check_system_ts.txt
--//今年年頭我做tab$刪除恢復時,遇到的問題,就是遇到延遲塊清除的問題.參考連結:
http://blog.itpub.net/267265/viewspace-2564716/
http://blog.itpub.net/267265/viewspace-2564717/
--//當時測試如果發生延遲塊清除,修復刪除記錄的塊,再讀取時如果是系統表空間時報錯,一般使用者的表空間是沒有問題.
--//一直想知道系統表空間有什麼隱含引數可以繞過這個問題,畢竟修復資料庫如果錯誤太多,無法一塊一塊來修復.
--//昨天才知道有一個隱含引數_db_always_check_system_ts可以繞過這個錯誤.今天測試看看.
1.環境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SYS@book> @ hide _db_always_check_system_ts
NAME DESCRIPTION DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE ISSES ISSYS_MOD
-------------------------- ------------------------------------------------------------- ------------- ------------- ------------ ----- ---------
_db_always_check_system_ts Always perform block check and checksum for System tablespace TRUE TRUE TRUE FALSE IMMEDIATE
--//預設_db_always_check_system_ts=true.
2.測試:
SYS@book> create table t tablespace system as select rownum id,'test' name from dual connect by level<=2;
Table created.
SYS@book> select rowid,t.* from t;
ROWID ID NAME
------------------ ---------- ----
AAAWEgAABAAAAl5AAA 1 test
AAAWEgAABAAAAl5AAB 2 test
SYS@book> @ rowid AAAWEgAABAAAAl5AAA
OBJECT FILE BLOCK ROW ROWID_DBA DBA TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
90400 1 2425 0 0x400979 1,2425 alter system dump datafile 1 block 2425
-//建立在system表空間.
SYS@book> delete from t where id=1;
1 row deleted.
SYS@book> alter system flush buffer_cache;
System altered.
SYS@book> alter system flush buffer_cache;
System altered.
SYS@book> @ bh 1 2425
HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA OBJECT_NAME
---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- --------------------
0000000084DEACF8 1 2425 1 data block free 0 0 0 0 0 0 00000000772C2000 T
0000000084DEACF8 1 2425 1 data block free 0 0 0 0 0 0 00000000772C4000 T
--//確定該塊不在資料庫快取.
SYS@book> commit ;
Commit complete.
--//這個時候不會寫塊提交到塊中,因為資料塊已經不在資料快取了.
3.使用bbed修復該記錄看看:
BBED> set dba 1,2425
DBA 0x00400979 (4196729 1,2425)
BBED> x /rnc *kdbr[1]
rowdata[0] @8166
----------
flag@8166: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8167: 0x00
cols@8168: 2
col 0[2] @8169: 2
col 1[4] @8172: test
BBED> x /rnc *kdbr[0]
rowdata[11] @8177
-----------
flag@8177: 0x3c (KDRHFL, KDRHFF, KDRHFD, KDRHFH)
lock@8178: 0x02
cols@8179: 0
--//第1條記錄已經刪除,flag=0x3c.
BBED> assign offset 8177 =0x2c;
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub1 rowdata[0] @8177 0x2c
BBED> x /rnc *kdbr[0]
rowdata[11] @8177
-----------
flag@8177: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8178: 0x02
cols@8179: 2
col 0[2] @8180: 1
col 1[4] @8183: test
--//ok,現在已經恢復.lock=0x02,使用itl槽1(從0開始)
BBED> sum apply
Check value for File 1, Block 2425:
current = 0xff20, required = 0xff20
BBED> verify
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 2425
Block Checking: DBA = 4196729, Block Type = KTB-managed data block
data header at 0x7f344dbba274
kdbchk: the amount of space used is not equal to block size
used=44 fsc=9 avsp=8028 dtl=8072
Block 2425 failed with check code 6110
--//注:這個報錯不必理會在select讀取時.
BBED> p ktbbh.ktbbhitl[1]
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x000a
ub2 kxidslt @70 0x0013
ub4 kxidsqn @72 0x00004d92
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x00c00288
ub2 kubaseq @80 0x0f0a
ub1 kubarec @82 0x0e
ub2 ktbitflg @84 0x0002 (NONE)
union _ktbitun, 2 bytes @86
sb2 _ktbitfsc @86 9
ub2 _ktbitwrp @86 0x0009
ub4 ktbitbas @88 0x00000000
--//可以發現ktbitflg=0x0002,表示沒有提交.有點奇怪為什麼是0x0002,應該是0x0001(因為我僅僅刪除1條記錄)
--//注:關於這點我在以前blog提到參考連結http://blog.itpub.net/267265/viewspace-2564779/,視乎使用表空間型別是mssm就能看到
--//這樣的情況.
--//ktbitbas=0x00000000,也就是沒有scn相關資訊寫入.
--//如果我這時讀取該塊就會遇到連結測試遇到的情況:連結http://blog.itpub.net/267265/viewspace-2564717/
ORA-00607: Internal error occurred while making a change to a data block
ORA-00600: internal error code, arguments: [kdBlkCheckError], [1], [2537], [6110], [], [], [], [], [], [], [], []
--//注意錯誤號6110,與bbed的錯誤號一致.
--//因為延遲塊清除,在讀取該塊時要寫入itl槽scn號.設定提交標識.這樣對於system表空間這樣的塊就會報錯(bbed verify沒有透過)
--//現在修改引數:
SYS@book> alter system set "_db_always_check_system_ts"=false scope=memory ;
System altered.
SYS@book> @ hide "_db_always_check_system_ts"
NAME DESCRIPTION DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE ISSES ISSYS_MOD
-------------------------- ------------------------------------------------------------- ------------- ------------- ------------ ----- ---------
_db_always_check_system_ts Always perform block check and checksum for System tablespace TRUE FALSE FALSE FALSE IMMEDIATE
--//按照介紹該引數是立即生效ISSYS_MOD=IMMEDIATE.保險起見還是退出會話在登入看看.
SYS@book> select rowid,t.* from t;
ROWID ID NAME
------------------ --- -----
AAAWEgAABAAAAl5AAA 1 test
AAAWEgAABAAAAl5AAB 2 test
--//OK,現在讀取就沒有問題.再次透過bbed觀察:
BBED> set dba 1,2425
DBA 0x00400979 (4196729 1,2425)
BBED> p ktbbh.ktbbhitl[1]
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x000a
ub2 kxidslt @70 0x0013
ub4 kxidsqn @72 0x00004d92
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x00c00288
ub2 kubaseq @80 0x0f0a
ub1 kubarec @82 0x0e
ub2 ktbitflg @84 0xa000 (KTBFUPB, KTBFCOM)`
union _ktbitun, 2 bytes @86
sb2 _ktbitfsc @86 3
ub2 _ktbitwrp @86 0x0003
ub4 ktbitbas @88 0x17600426
--//可以發現ktbitflg=0xa000(KTBFUPB, KTBFCOM),表示提交.
--//ktbitbas=0x17600426,也就是scn相關資訊已經寫入.
BBED> verify
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 2425
Block Checking: DBA = 4196729, Block Type = KTB-managed data block
data header at 0x1f09e74
kdbchk: the amount of space used is not equal to block size
used=44 fsc=0 avsp=8037 dtl=8072
Block 2425 failed with check code 6110
--//還是報6110錯誤.但是該塊的讀取是沒有問題的.
SYS@book> alter system set "_db_always_check_system_ts"=true scope=memory ;
System altered.
SYS@book> select rowid,t.* from t;
ROWID ID NAME
------------------ ---------- ----
AAAWEgAABAAAAl5AAA 1 test
AAAWEgAABAAAAl5AAB 2 test
--//讀取沒有問題,如果修改該記錄現在就會報錯(注意"_db_always_check_system_ts"=true),驗證看看.
SYS@book> update t set name='TEST' where id=2;
update t set name='TEST' where id=2
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [kdBlkCheckError], [1], [2425], [6110], [], [], [], [], [], [], [], []
SYS@book> alter system set "_db_always_check_system_ts"=false scope=memory ;
System altered.
SYS@book> update t set name='TEST' where id=2;
update t set name='TEST' where id=2
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 1, block # 2425)
ORA-01110: data file 1: '/mnt/ramdisk/book/system01.dbf'
SYS@book> alter system flush buffer_cache;
System altered.
SYS@book> update t set name='TEST' where id=2;
1 row updated.
--//ok現在沒有問題.
SYS@book> commit ;
Commit complete.
SYS@book> select rowid,t.* from t;
ROWID ID NAME
------------------ --- -----
AAAWEgAABAAAAl5AAA 1 test
AAAWEgAABAAAAl5AAB 2 TEST
--//實際上這個時候使用bbed verify檢查還是報錯.
BBED> set dba 1,2425
DBA 0x00400979 (4196729 1,2425)
BBED> verify
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 2425
Block Checking: DBA = 4196729, Block Type = KTB-managed data block
data header at 0x7f756ceee274
kdbchk: the amount of space used is not equal to block size
used=44 fsc=0 avsp=8037 dtl=8072
Block 2425 failed with check code 6110
4.總結:
--//設定_db_always_check_system_ts=false,可以繞過一些資料庫塊錯誤,實際上遇到這樣的情況,最佳的方式設定read only.
--//採用exp或者expdp方式儘快取出資料重新建庫.
5.補充如何修復該塊:
BBED> verify dba 1,2425
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 2425
Block Checking: DBA = 4196729, Block Type = KTB-managed data block
data header at 0x15b9e74
kdbchk: the amount of space used is not equal to block size
used=44 fsc=0 avsp=8037 dtl=8072
Block 2425 failed with check code 6110
--//avsp= dtl-used-fsc = 8072-0 -44 = 8028
BBED> assign kdbh.kdbhavsp=8028
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
sb2 kdbhavsp @126 8116
BBED> assign kdbh.kdbhavsp=8028
sb2 kdbhavsp @126 8028
BBED> sum apply
Check value for File 1, Block 2425:
current = 0x8014, required = 0x8014
BBED> verify dba 1,2425
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 2425
Block Checking: DBA = 4196729, Block Type = KTB-managed data block
data header at 0x16d5e74
kdbchk: space available on commit is incorrect
tosp=8039 fsc=0 stb=0 avsp=8028
Block 2425 failed with check code 6111
--// tosp = avsp+stb+fsc= 8028+0+0 = 8028
BBED> assign kdbh.kdbhtosp=8028
sb2 kdbhtosp @128 8028
BBED> sum apply
Check value for File 1, Block 2425:
current = 0x802f, required = 0x802f
BBED> verify dba 1,2425
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 2425
--//現在設定"_db_always_check_system_ts"=true,在執行dml就不錯報錯了.
SYS@book> alter system set "_db_always_check_system_ts"=true scope=memory ;
System altered.
SYS@book> update t set name='Tttt' where id=2;
1 row updated.
SYS@book> commit ;
Commit complete.
SYS@book> select rowid,t.* from t;
ROWID ID NAME
------------------ ---------- ----
AAAWEgAABAAAAl5AAA 1 test
AAAWEgAABAAAAl5AAB 2 Tttt
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2667200/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20190417]隱含引數_SPIN_COUNT.txt
- 常用指令碼:獲取隱含引數指令碼
- Oracle direct path read相關隱含引數Oracle
- [20190401]隱含引數_mutex_spin_count.txtMutex
- v$parameter gv$parameter 檢視 DDL 與隱含引數
- Oracle 11G 隱含引數“_controlfile_autobackup_delay”Oracle
- 【PARANETERS】Oracle異常恢復相關的隱含引數Oracle
- 使用隱含引數testMappingSpeed排查GoldenGate抽取慢的步驟APPGo
- [20200420]V$SES_OPTIMIZER_ENV 查不到剛修改的隱含引數.txt
- 日誌損壞時,加入隱含引數開啟資料庫的總結資料庫
- histb 引導核心 boot_cmd 引數含義boot
- SpringDataJpa列印Sql詳情(含引數)SpringSQL
- [20220913]hugepage相關引數含義.txt
- [20191204]hugepage相關引數含義.txt
- php引數3個點的含義PHP
- Python中key引數的含義及用法Python
- Python 中 key 引數的含義及用法Python
- 檢視oralce10g,11g隱含引數,並在SQLPLUS視窗格式化輸出SQL
- 關於隱藏引數:_no_recovery_through_resetlogs
- git merge合併程式碼時各引數含義Git
- 10.使用隱含規則
- SAP Fiori 應用 url 中的 DraftUUID 引數的含義RaftUI
- 含兩個引數的三元函式的高階偏導數函式
- SAP Fiori Launchpad url 引數 sap-app-origin-hint 的含義APP
- 電腦顯示器各項引數的含義科普大全:買液晶顯示器主要看哪些引數?
- [20191206]nvl與非空約束.txt
- Jmeter分散式壓測實戰及踩坑處理(含引數化)JMeter分散式
- 記一下rgb螢幕時序引數對應的含義
- 好程式設計師大資料教程Scala系列之隱式轉換和隱式引數程式設計師大資料
- 隱藏程式命令列引數,例如輸入密碼等高危操作命令列密碼
- 關於 SAP UI5 引數 $$updateGroupId 前面兩個 $ 符號的含義UI符號
- [高頻面試]解釋執行緒池的各個引數含義面試執行緒
- 坑坑坑,刪庫跑路的多種隱含命令
- 什麼是請求引數、表單引數、url引數、header引數、Cookie引數?一文講懂HeaderCookie
- 查閱linux tcp核心引數kernel parameter tcp_max_syn_backlog含義之一LinuxTCP
- №20191206簡易操作1~7(今期:上=下=6)
- PHP雙引號的小隱患PHP
- python疑問5:位置引數,預設引數,可變引數,關鍵字引數,命名關鍵字引數區別Python