[20190531]ORA-600 kokasgi1故障模拟与恢复(后续).txt

--//http://blog.itpub.net/267265/viewspace-2646340/=>[20190531]ORA-600 kokasgi1故障模拟与恢复.txt
--//后续有一些恢复没做,补充测试看看.

--//先更正链接http://blog.itpub.net/267265/viewspace-2646340/的一些错误:
--//1.前面做坏块恢复时,少写了执行步骤:.
BBED> assign kcbh.seq_kcbh = 0x01
--//2.使用system用户登录时:
SYS@book> connect system/oracle
ERROR:
ORA-00604: error occurred at recursive SQL level 1
ORA-00607: Internal error occurred while making a change to a data block
ORA-00600: internal error code, arguments: [kdBlkCheckError], [1], [209], [6110], [], [], [], [], [], [], [], []
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
--//主要原因是口令不对(注:我恢复最原始的口令),导致要更新user$相应记录,而块没有完全恢复,所以报错.如果口令正确,不会出现以
--//上错误.

1.环境:
SYS@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
-------------------------- ------------------------------------------------------------- ------------- ------------- ------------
_db_always_check_system_ts Always perform block check and checksum for System tablespace FALSE         FALSE         FALSE

2.修复块dba=1,209看看.
--//user$的用户SYS,SYSTEM改名.修正回来后dba 1,209存在问题.

BBED> set dba 1,209
        DBA             0x004000d1 (4194513 1,209)

BBED> verify
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 209

Block Checking: DBA = 4194513, Block Type = KTB-managed data block
data header at 0x7fa51592825c
kdbchk: the amount of space used is not equal to block size
        used=2548 fsc=1 avsp=5515 dtl=8096
Block 209 failed with check code 6110
--//修改口令看看.

SYS@book> password system
Changing password for system
New password:
Retype new password:
Password changed
--//这也证明_db_always_check_system_ts=false,块有一些瑕疵不会报错.

SYS@book> alter system checkpoint ;
System altered.

SYS@book> alter system checkpoint ;
System altered.

SYS@book> alter system checkpoint ;
System altered.

BBED> verify  dba 1,209
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 209

Block Checking: DBA = 4194513, Block Type = KTB-managed data block
data header at 0x7ffe7f88e25c
kdbchk: the amount of space used is not equal to block size
        used=2548 fsc=0 avsp=5516 dtl=8096
Block 209 failed with check code 6110
--//还是存在.连续执行2次sqlplus system/aaa,这样里面不成功登录计数改变,会导致记录长度变化,看看.

BBED> x /rcncnnttttncnnnnnccnnncct *kdbr[27]
rowdata[0]                                  @2113
----------
flag@2113: 0x6c (KDRHFL, KDRHFF, KDRHFH, KDRHFC)
lock@2114: 0x02
cols@2115:   22
ckix@2116:    5
col    0[6] @2117: SYSTEM
col    1[2] @2124: 1
col   2[16] @2127: 2D594E86F93B17A1
col    3[1] @2144: 0
col    4[2] @2146: 3
col    5[7] @2149: 2013-08-24 11:37:40
col    6[7] @2157: 2019-05-31 11:43:38
col    7[0] @2165: *NULL*
col    8[0] @2166: *NULL*
col    9[1] @2167: 0
col   10[0] @2169: *NULL*
col   11[2] @2170: 1
col   12[0] @2173: *NULL*
col   13[0] @2174: *NULL*
col   14[1] @2175: 0
col   15[2] @2177: 2
--// 2次不成功登录.
col  16[22] @2180: DEFAULT_CONSUMER_GROUP
col   17[0] @2203: *NULL*
col   18[1] @2204: 0
col   19[0] @2206: *NULL*
col   20[0] @2207: *NULL*
col  21[62] @2208: S:0CDF21806AF97030971BEB57BB609CA72A6DB6B1989178BC1CBF5A82C39C

BBED> verify  dba 1,209
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 209

Block Checking: DBA = 4194513, Block Type = KTB-managed data block
data header at 0x7f4cc456b25c
kdbchk: the amount of space used is not equal to block size
        used=2549 fsc=0 avsp=5515 dtl=8096
Block 209 failed with check code 6110

--//对比前面fsc=0已经发现变化.开始修复:
--//公式 dtl= used+fsc+avsp
--//dtl-used-fsc=  8096 - 2549 - 0 = 5547

BBED> p dba 1,209 kdbh
struct kdbh, 14 bytes                       @92
   ub1 kdbhflag                             @92       0x00 (NONE)
   sb1 kdbhntab                             @93       2
   sb2 kdbhnrow                             @94       43
   sb2 kdbhfrre                             @96      -1
   sb2 kdbhfsbo                             @98       108
   sb2 kdbhfseo                             @100      2021
   sb2 kdbhavsp                             @102      5515
   sb2 kdbhtosp                             @104      5515
--//assign kdbh.kdbhavsp=5547

BBED> assign kdbh.kdbhavsp=5547
sb2 kdbhavsp                                @102      5547

BBED> sum apply
Check value for File 1, Block 209:
current = 0x3ccd, required = 0x3ccd

BBED> verify  dba 1,209
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 209

Block Checking: DBA = 4194513, Block Type = KTB-managed data block
data header at 0x18e105c
kdbchk: avsp(5547) > tosp(5515)
Block 209 failed with check code 6128

--//assign kdbh.kdbhtosp = kdbh.kdbhavsp
BBED> assign kdbh.kdbhtosp = kdbh.kdbhavsp
sb2 kdbhtosp                                @104      5547

BBED> sum apply
Check value for File 1, Block 209:
current = 0x3ced, required = 0x3ced

BBED> verify  dba 1,209
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 209

--//OK dba=1,209已经恢复.

2.修复索引I_user1看看.

--//根据前面的修复,该索引在dba = 1,417 .
--//相关信息可以参考:http://blog.itpub.net/267265/viewspace-2637037/=>[20190226]删除tab$记录的恢复6.txt
--//参考:https://www.cnblogs.com/lfree/p/10438177.html=>[20190226]测试使用bbed恢复索引.txt

SYS@book> @ bbvi 1 417
BVI_COMMAND
----------------------------------------------------------------------------------------------------
bvi -b 3416064 -s 8192 /mnt/ramdisk/book/system01.dbf
xxd -c16 -g 2 -s 3416064 -l 8192 /mnt/ramdisk/book/system01.dbf
dd if=/mnt/ramdisk/book/system01.dbf bs=8192 skip=417 count=1 of=1_417.dd conv=notrunc 2>/dev/null
od -j 3416064 -N 8192 -t x1 -v /mnt/ramdisk/book/system01.dbf
hexdump -s 3416064 -n 8192 -C -v /mnt/ramdisk/book/system01.dbf
alter system dump datafile '/mnt/ramdisk/book/system01.dbf' block 417;
alter session set events 'immediate trace name set_tsn_p1 level 1';
alter session set events 'immediate trace name buffer level 4194721';
9 rows selected.

$ dd if=/mnt/ramdisk/book/system01.dbf bs=8192 skip=417 count=1 of=1_417.dd conv=notrunc
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000106025 seconds, 77.3 MB/s

$ strings -td -3 1_417.dd | egrep SYS
   5864 SYSDW
   5878 SYSTEMDW
   6005 JAVASYSPRIV
   6375 OWBSYS_AUDIT
   6396 OWBSYS
   6544 SYSMAN
   6780 OLAPSYS
   6835 MDSYS
   6911 ORDSYS
   7148 CTXSYS
   7163 EXFSYS
   7275 JAVASYSPRIV
   7357 WMSYS
   7370         APPQOSSYS
   7627 GATHER_SYSTEM_STATISTICS
   8027 SYSTEM
   8102 SYS

--//也就是修复指向原来的位置. 减去-9 对应 kd_off的偏移.
--//8102-9 = 8093
--//8027-9 = 8018

BBED> x /rc *kd_off[86]
rowdata[2242]                               @8093
-------------
flag@8093:     0x01 (KDXRDEL)
lock@8094:     0x02
keydata[6]:    0x00  0x40  0x00  0xd1  0x00  0x01
data key:
col    0[3] @8102: SYS

BBED> x /rc *kd_off[87]
rowdata[4]                                  @5855
----------
flag@5855:     0x00 (NONE)
lock@5856:     0x02
keydata[6]:    0x00  0x40  0x00  0xd1  0x00  0x01
data key:
col    0[5] @5864: SYSDW

BBED> x /rc *kd_off[88]
rowdata[684]                                @6535
------------
flag@6535:     0x00 (NONE)
lock@6536:     0x00
keydata[6]:    0x00  0x40  0x00  0xd4  0x00  0x0b
data key:
col    0[6] @6544: SYSMAN

BBED> x /rc *kd_off[89]
rowdata[2167]                               @8018
-------------
flag@8018:     0x01 (KDXRDEL)
lock@8019:     0x02
keydata[6]:    0x00  0x40  0x00  0xd1  0x00  0x06
data key:
col    0[6] @8027: SYSTEM

BBED> x /rc *kd_off[90]
rowdata[18]                                 @5869
-----------
flag@5869:     0x00 (NONE)
lock@5870:     0x02
keydata[6]:    0x00  0x40  0x00  0xd1  0x00  0x06
data key:
col    0[8] @5878: SYSTEMDW

--//注意看flag标识,删除标识是0x01 (KDXRDEL).对应rowid并没有变化(keydata).
--//另外注意索引的特点是块内无序,块间有序.可以看出修改并不改变行目录的顺序.
--//注意键值一定按照行目录排序的,oracle插入索引键值应该通过行目录二分法定位,然后行目录对应记录后移。

assign offset 8093 = 0x0;
assign offset 5855 = 0x1;
assign offset 8018 = 0x0;
assign offset 5869 = 0x1;

BBED> sum apply
Check value for File 1, Block 417:
current = 0x049d, required = 0x049d

BBED> verify
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 417

Block Checking: DBA = 4194721, Block Type = KTB-managed data block
**** actual free space credit for itl 2 = 35 != # in trans. hdr = 31
---- end index block validation
Block 417 failed with check code 6401

BBED> p /d ktbbh.ktbbhitl[1]._ktbitun
union _ktbitun, 2 bytes                     @86
   sb2 _ktbitfsc                            @86       31
   ub2 _ktbitwrp                            @86       31

BBED> assign ktbbh.ktbbhitl[1]._ktbitun._ktbitfsc=35
sb2 _ktbitfsc                               @86       35

BBED> p /d ktbbh.ktbbhitl[1]._ktbitun
union _ktbitun, 2 bytes                     @86
   sb2 _ktbitfsc                            @86       35
   ub2 _ktbitwrp                            @86       35

BBED> sum apply
Check value for File 1, Block 417:
current = 0x04a1, required = 0x04a1

--//OK.

3.修复禁用的索引.

BBED> set dba 1,522
        DBA             0x0040020a (4194826 1,522)

BBED> x /rnnc *kdbr[19]
rowdata[228]                                @1754
------------
flag@1754: 0x3c (KDRHFL, KDRHFF, KDRHFD, KDRHFH)
lock@1755: 0x01
cols@1756:    0

BBED> assign offset 1754=0x2c;
ub1 rowdata[0]                              @1754     0x2c

BBED> x /rnnc *kdbr[19]
rowdata[228]                                @1754
------------
flag@1754: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@1755: 0x01
cols@1756:    3

col    0[2] @1757: 46
col    1[2] @1760: 46
col  2[197] @1763: CREATE UNIQUE INDEX I_USER1 ON USER$(NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE (  INITIAL 64K NEXT 1024K MINEXTENTS 1 MAXEXTENTS
 2147483645 PCTINCREASE 0 OBJNO 46 EXTENTS (FILE 1 BLOCK 416))

BBED> sum apply
Check value for File 1, Block 522:
current = 0x1ee8, required = 0x1ee8

BBED> verify
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/system01.dbf
BLOCK = 522

--//OK,现在全部修复.重启数据库
SYS@book> startup                                                                                                                                                                                                                                                   [150/10484]
ORACLE instance started.
Total System Global Area  643084288 bytes
Fixed Size                  2255872 bytes
Variable Size             205521920 bytes
Database Buffers          427819008 bytes
Redo Buffers                7487488 bytes
Database mounted.
Database opened.

SYS@book> select /*+ full(a) */ name from user$ a minus select name from user$ ;
no rows selected

SYS@book> select name from user$ minus select /*+ full(a) */ name from user$ a;
no rows selected

SYS@book> validate index i_user1;
Index analyzed.

--//ok,已经全部修复.

4.收尾:
--//修改参数_db_always_check_system_ts=true.
--//alter system reset "_db_always_check_system_ts";
--//重启数据库略.

[20190531]ORA-600 kokasgi1故障模拟与恢复(后续).txt的更多相关文章

  1. [20190531]ORA-600 kokasgi1故障模拟与恢复.txt

    [20190531]ORA-600 kokasgi1故障模拟与恢复.txt --//昨天看链接:http://www.xifenfei.com/2019/05/ora-600-kokasgi1-rec ...

  2. PostgreSQL 三节点集群故障模拟及恢复

    PostgreSQL 三节点集群故障模拟及恢复 (postgreSQL9.5.1) 正常状态: 10.2.208.10:node1:master 10.2.208.11:node2:standby1同 ...

  3. [20190225]删除tab$记录的恢复5.txt

    [20190225]删除tab$记录的恢复5.txt --//昨天下午看了链接https://blog.csdn.net/Enmotech/article/details/87834503,大概知道对 ...

  4. [20190212]删除tab$记录的恢复3.txt

    [20190212]删除tab$记录的恢复3.txt --//春节前几天做了删除tan$记录的测试,链接:http://blog.itpub.net/267265/viewspace-2565245/ ...

  5. [20190130]删除tab$记录的恢复2.txt

    [20190130]删除tab$记录的恢复2.txt --//前面链接写好了脚本,开始测试删除后的恢复.千万不要在生产系统做这样的测试!!--//参考链接:http://blog.itpub.net/ ...

  6. [20180630]truncate table的另类恢复2.txt

    [20180630]truncate table的另类恢复2.txt --//上个星期做了truncate table的另类恢复,通过修改数据块的段号,再通过rowid定位收集数据,达到修复的目的.- ...

  7. [20190226]删除tab$记录的恢复6.txt

    [20190226]删除tab$记录的恢复6.txt --//春节前几天做了删除tan$记录的测试,链接:http://blog.itpub.net/267265/viewspace-2565245/ ...

  8. [20190226]测试使用bbed恢复索引.txt

    [20190226]测试使用bbed恢复索引.txt --//上午做tab$删除恢复测试时发现,tab$的索引i_tab1很小.可以尝试使用bbed解决这个问题.--//首先在普通表上做一个测试看看. ...

  9. DG环境恢复同步遇到报错ORA-00353ORA-00334以及ORA-00600[2619], [47745]

    问题说明 客户环境主库4节点RAC11.2.0.4,单实例DG环境,DG由于空间不足,导致同步中断,由于DG备库未应用的归档主库都再,本次恢复的方式,是开启dg mrp进程,自动同步追上主库. 以下遇 ...

随机推荐

  1. Winform中实现ZedGraph滚轮缩放后自动重新加载数据

    场景 Winforn中设置ZedGraph曲线图的属性.坐标轴属性.刻度属性: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/10 ...

  2. Initialize a Property After Creating an Object 创建对象后初始化属性 (XPO)

    In this lesson, you will learn how to set the default value for a particular property of a business ...

  3. arcgis api 4.x for js 基础工具篇之测距测面

    前言 在搭建好WebGIS应用框架的时候,相信大家首先开发的都会是基础功能,此篇文章我们主要讲述的是“测距”."测面"功能. 注* 在测量单位中常规都是基于"平面坐标系& ...

  4. Linux下使用 github+hexo 搭建个人博客03-hexo配置优化

    上两张文章,我们说了 hexo 部署.主题的切换.博文的创建.MarkDown 简单使用和 hexo 部署到 GitHub Pages. 也说了我们会使用 next 主题做为我们后期博客的使用和维护. ...

  5. [Go] go连接influxdb的库

    开启了influxdb后,会监听8086端口下载客户端代码git clone https://github.com/influxdata/influxdb1-client.git $GOPATH/sr ...

  6. ping测试丢包率

    测试环境:Centos 6.4 增加参数:-i 例如: #ping -i 0.01 172.16.3.1 则每隔0.01秒ping一次

  7. C++ 数据类型判断 typeid

    #include <iostream> // typeid testing //////////////////////////////////////////////////////// ...

  8. ClickHouse

    ClickHouse 是俄罗斯的Yandex于2016年开源的列式存储数据库(DBMS),主要用于在线分析处理查询(OLAP),能够使用SQL查询实时生成分析数据报告 1 安装前的准备1.1 Cent ...

  9. 一道常被人轻视的web前端常见面试题(JS)

    本文转载自站长之家,如有侵权问题,请联系我,马上删除. 面试题是招聘公司和开发者都非常关心的话题,公司希望通过它了解开发者的真实水平和细节处理能力,而开发者希望能够最大程度地展示自己的水平(甚至超常发 ...

  10. nui-app 笔记

    https://uniapp.dcloud.io