[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
[20191206]隐含参数_db_always_check_system_ts.txt的更多相关文章
- [20190417]隐含参数_SPIN_COUNT.txt
[20190417]隐含参数_SPIN_COUNT.txt--//在探究latch spin计数之前,先简单探究_SPIN_COUNT.实际上oracle现在版本latch spin的数量不再是200 ...
- [20190401]隐含参数_mutex_spin_count.txt
[20190401]隐含参数_mutex_spin_count.txt --//上午做了一些测试关于semtimedop函数调用,发现自己上个星期在一些问题上理解错误.--//相关链接:--//htt ...
- [20181108]12c sqlplus rowfetch参数4.txt
[20181108]12c sqlplus rowfetch参数4.txt --//12cR2 可以改变缺省rowfetch参数.11g之前缺省是1.通过一些测试说明问题.--//前几天做的测试有点乱 ...
- 转 rman-08120 以及查询隐含参数
rman-08120 We need RMAN to automatically purge archivelogs from the FRA once they are applied to the ...
- js的隐含参数(arguments,callee,caller)使用方法
在提到上述的概念之前,首先想说说javascript中函数的隐含参数: arguments arguments 该对象代表正在执行的函数和调用它的函数的参数.[function.]arguments[ ...
- paip.提升性能---mysql 性能 测试以及 参数调整.txt
paip.提升性能---mysql 性能 测试以及 参数调整.txt 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://b ...
- paip.提升性能----jvm参数调整.txt
paip.提升性能----jvm参数调整.txt 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.n ...
- 传递给函数的隐含参数:arguments及递归函数的实现
传递给函数的隐含参数:arguments当进行函数调用时,除了指定的参数外,还创建一个隐含的对象——arguments.arguments是一个类似数组但不是数组的对象,说它类似是因为它具有数组一样的 ...
- [20170927]hugepages与内核参数nr_overcommit_hugepages.txt
[20170927]hugepages与内核参数nr_overcommit_hugepages.txt /proc/sys/vm/nr_overcommit_hugepages specifies h ...
随机推荐
- day20191104笔记
MyBatis笔记: 一.MyBatis半自动ORM映射框架, 将数据库中的数据和程序中的数据进行自动映射的前提条件 1. 数据库中的字段必须和程序中的属性保持一致 2. 程序中属性的数据类型必须是基 ...
- MySQL8——源码安装
一.环境 ubuntu18.10(CentOS7由于gcc版本过低已经无法通过编译) 二.准备工作 1.安装依赖 apt-get install -y gcc g++ cmake build-esse ...
- for循环、while循环、break跳出循环、continue结束本次循环、exit退出整个脚本
7月13日任务 20.10 for循环20.11/20.12 while循环20.13 break跳出循环20.14 continue结束本次循环20.15 exit退出整个脚本扩展select用法 ...
- 《Windows内核安全与驱动开发》阅读笔记 -- 索引目录
<Windows内核安全与驱动开发>阅读笔记 -- 索引目录 一.内核上机指导 二.内核编程环境及其特殊性 2.1 内核编程的环境 2.2 数据类型 2.3 重要的数据结构 2.4 函数调 ...
- Java学习笔记(面向对象上)
面向对象(上) 面向对象的特点:封装性(是面向对象的核心思想,将对象的属性和行为封装起来).继承性(主要描述类与类之间的关系,通过继承,可以在无需重新编写原有类的情况下,对原有类的功能进行扩展)和多态 ...
- [Abp vNext 源码分析] - 13. 本地事件总线与分布式事件总线 (Rabbit MQ)
一.简要介绍 ABP vNext 封装了两种事件总线结构,第一种是 ABP vNext 自己实现的本地事件总线,这种事件总线无法跨项目发布和订阅.第二种则是分布式事件总线,ABP vNext 自己封装 ...
- 每个开发人员都应该知道的11个Linux命令
本文主要挑选出读者有必要首先学习的 11 个 Linux 命令,如果不熟悉的读者可以在虚拟机或云服务器上实操下,对于开发人员来说,能熟练掌握 Linux 做一些基本的操作是必要的! 事不宜迟,这里有 ...
- 矩阵解压,网络流UESTC-1962天才钱vs学霸周2
天才钱vs学霸周2 Time Limit: 500 MS Memory Limit: 128 MB Submit Status 由于上次的游戏中学霸周输了,因此学霸周想出个问题为难天才钱,问题 ...
- Pyhton表白代码——浪漫圣诞节
圣诞节即将到了,所以这回通过turtle模块来编写一个表白的小程序 开发时间:2019-12-15 开发工具:Sublime 开发模块:turtle 这里用到了turtle库的相关知识,如果不熟悉可以 ...
- ESP8266调试(UDP调试)
1.设置STA模式 AT+CWMODE=1 2.加入热点 AT+CWJAP="Admin_name","password" 3.开启单路连接 AT+CIPMUX ...