用bbed修改数据文件头,跳过丢失的归档

kscnbas/kcvcptim/kcvfhcpc/kcvfhccc
一般数据库启动会校验如下4个地方来验证数据库一致性:
1.kscnbas 数据文件最后一次检查点的SCN
2.kcvcptim 数据文件最后一次检查点的时间
3.kcvfhcpc ,检查点计数
4.kcvfhccc ,总是比检查点计数小1

BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x0007f694 521876
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x2f2c5b2d
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000001c
ub4 kcrbabno @504 0x00000002
ub2 kcrbabof @508 0x0000
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00

BBED>
BBED> p kcvfhcpc
ub4 kcvfhcpc @140 0x00000013 19 v$datafile_header.checkpoint_count

BBED> p kcvfhccc
ub4 kcvfhccc @148 0x00000012 18

BBED>

set linesize 112
set pages 999
col LHNAM for a35
col LHRLS for a15
col LHRLC for a20
select LHSEQ,LHNAM,LHRLS,LHRLC from x$kcclh;

SQL> select LHSEQ,LHNAM,LHRLS,LHRLC from x$kcclh;

     LHSEQ LHNAM                               LHRLS           LHRLC
---------- ----------------------------------- --------------- --------------------
         1 /u01/archive/1_1_805858745.dbf      330515          01/28/2013 01:39:05
         2 /u01/archive/1_2_805858745.dbf      330515          01/28/2013 01:39:05
         3 /u01/archive/1_3_805858745.dbf      330515          01/28/2013 01:39:05
         4 /u01/archive/1_4_805858745.dbf      330515          01/28/2013 01:39:05
         5 /u01/archive/1_5_805858745.dbf      330515          01/28/2013 01:39:05
         6 /u01/archive/1_6_805858745.dbf      330515          01/28/2013 01:39:05
         7 /u01/archive/1_7_805858745.dbf      330515          01/28/2013 01:39:05
         8 /u01/archive/1_8_805858745.dbf      330515          01/28/2013 01:39:05
         9 /u01/archive/1_9_805858745.dbf      330515          01/28/2013 01:39:05
        10 /u01/archive/1_10_805858745.dbf     330515          01/28/2013 01:39:05
        11 /u01/archive/1_11_805858745.dbf     330515          01/28/2013 01:39:05
        12 /u01/archive/1_12_805858745.dbf     330515          01/28/2013 01:39:05
        13 /u01/archive/1_13_805858745.dbf     330515          01/28/2013 01:39:05
        14 /u01/archive/1_14_805858745.dbf     330515          01/28/2013 01:39:05
        15 /u01/archive/1_15_805858745.dbf     330515          01/28/2013 01:39:05
        16 /u01/archive/1_16_805858745.dbf     330515          01/28/2013 01:39:05
        17 /u01/archive/1_17_805858745.dbf     330515          01/28/2013 01:39:05
        18 /u01/archive/1_18_805858745.dbf     330515          01/28/2013 01:39:05
        19 /u01/archive/1_19_805858745.dbf     330515          01/28/2013 01:39:05
        20 /u01/archive/1_20_805858745.dbf     330515          01/28/2013 01:39:05
        21 /u01/archive/1_21_805858745.dbf     330515          01/28/2013 01:39:05
        22 /u01/archive/1_22_805858745.dbf     330515          01/28/2013 01:39:05
        23 /u01/archive/1_23_805858745.dbf     330515          01/28/2013 01:39:05
        24 /u01/archive/1_24_805858745.dbf     330515          01/28/2013 01:39:05
        25 /u01/archive/1_25_805858745.dbf     330515          01/28/2013 01:39:05
        26 /u01/archive/1_26_805858745.dbf     330515          01/28/2013 01:39:05
        27 /u01/archive/1_27_805858745.dbf     330515          01/28/2013 01:39:05
        28 /u01/archive/1_28_805858745.dbf     330515          01/28/2013 01:39:05
        29 /u01/archive/1_29_805858745.dbf     330515          01/28/2013 01:39:05
        30 /u01/archive/1_30_805858745.dbf     330515          01/28/2013 01:39:05
        31 /u01/archive/1_31_805858745.dbf     330515          01/28/2013 01:39:05

31 rows selected.

SQL>
SQL> col rtckp for a10
SQL> col rtenb for a10
SQL> l
1* select RTCKP_SCN,RTCKP_RBA_SEQ,RTCKP_RBA_BNO,RTCKP_RBA_BOF,RTSEQ,RTENB from x$kccrt
SQL> /

RTCKP_SCN                        RTCKP_RBA_SEQ RTCKP_RBA_BNO RTCKP_RBA_BOF      RTSEQ RTENB
-------------------------------- ------------- ------------- ------------- ---------- ----------
522089                                      32             2            16         32 330515

SQL>
SQL> select SEQUENCE#, RESETLOGS_CHANGE# , FIRST_CHANGE# ,NEXT_CHANGE#,NEXT_CHANGE# from v$archived_log;

 SEQUENCE# RESETLOGS_CHANGE# FIRST_CHANGE# NEXT_CHANGE# NEXT_CHANGE#

---------- ----------------- ------------- ------------ ------------
         1            330515        330515       337841       337841
         2            330515        337841       341520       341520
         3            330515        341520       346876       346876
         4            330515        346876       368713       368713
         5            330515        368713       374648       374648
         6            330515        374648       381043       381043
         7            330515        381043       387102       387102
         8            330515        387102       389802       389802
         9            330515        389802       394303       394303
        10            330515        394303       400362       400362
        11            330515        400362       405241       405241
        12            330515        405241       411904       411904
        13            330515        411904       418076       418076
        14            330515        418076       422666       422666
        15            330515        422666       445513       445513
        16            330515        445513       474666       474666
        17            330515        474666       495145       495145
        18            330515        495145       517364       517364
        19            330515        517364       520726       520726
        20            330515        520726       520773       520773
        21            330515        520773       520780       520780
        22            330515        520780       520783       520783
        23            330515        520783       520875       520875
        24            330515        520875       521331       521331
        25            330515        521331       521334       521334
        26            330515        521334       521337       521337
        27            330515        521337       521876       521876
        28            330515        521876       521884       521884
        29            330515        521884       521887       521887
        30            330515        521887       522050       522050
        31            330515        522050       522089       522089

31 rows selected.

SQL> select SEQUENCE#, RESETLOGS_CHANGE# , FIRST_CHANGE# ,NEXT_CHANGE#,NEXT_CHANGE#
from v$$archived_log where sequence#>=28;

SQL> select SEQUENCE#, RESETLOGS_CHANGE# , FIRST_CHANGE# ,NEXT_CHANGE#,NEXT_CHANGE#
2 from v$archived_log
3 where sequence#>=28;

 SEQUENCE# RESETLOGS_CHANGE# FIRST_CHANGE# NEXT_CHANGE# NEXT_CHANGE#
---------- ----------------- ------------- ------------ ------------
        28            330515        521876       521884       521884
        29            330515        521884       521887       521887
        30            330515        521887       522050       522050
        31            330515        522050       522089       522089

SQL>

BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x0007f694 521876 改为 521884=0007F69C 9CF60700
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x2f2c5b2d
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000001c 28 改为29=1D
ub4 kcrbabno @504 0x00000002 2
ub2 kcrbabof @508 0x0000
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00

BBED>
BBED> p kcvfhcpc
ub4 kcvfhcpc @140 0x00000013 19 v$datafile_header.checkpoint_count

BBED> p kcvfhccc
ub4 kcvfhccc @148 0x00000012 18

BBED>

BBED> m /x 9CF60700 OFFSET 484
BBED-00209: invalid number (9CF60700)

BBED> m /x 9cf6 offset 484
File: /test/clonedb/roger01.dbf (5)
Block: 1 Offsets: 484 to 995 Dba:0x01400001

9cf60700 00000000 2d5b2c2f 01000000 1c000000 02000000 0000097f 02000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0d000d00 0d000100 00000000 00000000 00000000 02004001 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> m /x 0700 offset 486
File: /test/clonedb/roger01.dbf (5)
Block: 1 Offsets: 486 to 997 Dba:0x01400001

07000000 00002d5b 2c2f0100 00001c00 00000200 00000000 097f0200 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000d00
0d000d00 01000000 00000000 00000000 00000200 40010000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x0007f69c
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x2f2c5b2d
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000001c
ub4 kcrbabno @504 0x00000002
ub2 kcrbabof @508 0x0000
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00

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

BBED>
BBED> set count 16
COUNT 16

BBED> d
File: /test/clonedb/roger01.dbf (5)

 Block: 1                Offsets:  500 to  515           Dba:0x01400001
------------------------------------------------------------------------
 1c000000 02000000 0000097f 02000000 

<32 bytes per line>

BBED> m /x 1d

 File: /test/clonedb/roger01.dbf (5)
 Block: 1                Offsets:  500 to  515           Dba:0x01400001
------------------------------------------------------------------------
 1d000000 02000000 0000097f 02000000 

<32 bytes per line>

BBED> d

 File: /test/clonedb/roger01.dbf (5)
 Block: 1                Offsets:  500 to  515           Dba:0x01400001
------------------------------------------------------------------------
 1d000000 02000000 0000097f 02000000 

<32 bytes per line>

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

BBED>
BBED> verify
DBVERIFY - Verification starting
FILE = /test/clonedb/roger01.dbf
BLOCK = 1

DBVERIFY - Verification complete

Total Blocks Examined : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 0
Total Blocks Influx : 0
Message 531 not found; product=RDBMS; facility=BBED

BBED>
SQL> recover datafile 5;
ORA-00279: change 521884 generated at 08/16/2012 03:21:17 needed for thread 1
ORA-00289: suggestion : /u01/archive/1_29_805858745.dbf
ORA-00280: change 521884 for thread 1 is in sequence #29

Specify log: {=suggested | filename | AUTO | CANCEL}
auto
Log applied.
Media recovery complete.
SQL> alter database datafile 5 online;

Database altered.

SQL> alter database open;

Database altered.
转自:http://m.blog.csdn.net/lunar2000/article/details/8570856
https://blog.csdn.net/u011616400/article/details/39967105

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值