ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 通过修改SCN来骗过ORACLE启动验证

通过修改SCN来骗过ORACLE启动验证

原创 Linux操作系统 作者:wei-xh 时间:2012-05-11 13:14:13 0 删除 编辑
实验过程的整理,还没有添加解释说明,后面有时间再整理。
 
 
sys>create tablespace users datafile '/data1/oracle/crmd/users01.dbf' size 20m;
Tablespace created.
sys>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 
cp /data1/oracle/crmd/users01.dbf /data1/oracle/crmd/users01.dbf.bak
 
@>startup
ORACLE instance started.
Total System Global Area 1.5049E+10 bytes
Fixed Size                  2110032 bytes
Variable Size            2281704880 bytes
Database Buffers         1.2751E+10 bytes
Redo Buffers               14663680 bytes
Database mounted.
Database opened.
@>conn test/test
Connected.
 
test>create table test(id number) tablespace users;
Table created.

sys>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 
cp /data1/oracle/crmd/users01.dbf.bak /data1/oracle/crmd/users01.dbf

@>startup
ORACLE instance started.
Total System Global Area 1.5049E+10 bytes
Fixed Size                  2110032 bytes
Variable Size            2281704880 bytes
Database Buffers         1.2751E+10 bytes
Redo Buffers               14663680 bytes
Database mounted.
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/data1/oracle/crmd/users01.dbf'
一般数据库启动会校验如下4个地方来验证数据库一致性:
1.kscnbas(在偏移量484处) 数据文件最后一次检查点的SCN
2.kcvcptim(在偏移量492处)数据文件最后一次检查点的时间
3.kcvfhcpc(在偏移量140处),检查点计数
4.kcvfhccc(在偏移量148处),总是比检查点计数小1

BBED> set dba 1,1
        DBA             0x00400001 (4194305 1,1)
 
BBED> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x000006b1
BBED> p kcvfhccc
ub4 kcvfhccc                                @148      0x000006b0
 
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484    
   struct kcvcpscn, 8 bytes                 @484    
      ub4 kscnbas                           @484      0x001b1d78
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x2eaaf271
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500    
      struct kcvcprba, 12 bytes             @500    
         ub4 kcrbaseq                       @500      0x00000320
         ub4 kcrbabno                       @504      0x000001a2
         ub2 kcrbabof                       @508      0x0010
   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> set dba 4,1
        DBA             0x01000001 (16777217 4,1)

BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484    
   struct kcvcpscn, 8 bytes                 @484    
      ub4 kscnbas                           @484      0x001b1c02
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x2eaaf213
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500    
      struct kcvcprba, 12 bytes             @500    
         ub4 kcrbaseq                       @500      0x0000031f
         ub4 kcrbabno                       @504      0x000000ec
         ub2 kcrbabof                       @508      0x0010
   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> dump /v offset 484
 File: /data1/oracle/crmd/users01.dbf (4)
 Block: 1       Offsets:  484 to  995  Dba:0x01000001
-------------------------------------------------------
 021c1b00 00000000 13f2aa2e 01000160 l ...............`
 
BBED>  m /x 781d
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y
 File: /data1/oracle/crmd/users01.dbf (4)
 Block: 1                Offsets:  484 to  995           Dba:0x01000001
------------------------------------------------------------------------
 781d1b00 00000000 13f2aa2e 01000160 1f030000 ec000000 10000000 02000000
 
BBED> d /v offset 492
 File: /data1/oracle/crmd/users01.dbf (4)
 Block: 1       Offsets:  492 to 1003  Dba:0x01000001
-------------------------------------------------------
 13f2aa2e 01000160 1f030000 ec000000 l .......`........
 
BBED> m /x 71f2
 File: /data1/oracle/crmd/users01.dbf (4)
 Block: 1                Offsets:  492 to 1003           Dba:0x01000001
------------------------------------------------------------------------
 71f2aa2e 01000160 1f030000 ec000000 10000000 02000000 00000000 00000000
 
 
BBED> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x00000005
BBED> d /v offset 140
 File: /data1/oracle/crmd/users01.dbf (4)
 Block: 1       Offsets:  140 to  651  Dba:0x01000001
-------------------------------------------------------
 05000000 00000000 04000000 00000000 l ................
 
BBED> m /x b106
 File: /data1/oracle/crmd/users01.dbf (4)
 Block: 1                Offsets:  140 to  651           Dba:0x01000001
------------------------------------------------------------------------
 b1060000 00000000 04000000 00000000 00000000 00000000 00000000 00000000
 
BBED> d /v offset 148
 File: /data1/oracle/crmd/users01.dbf (4)
 Block: 1       Offsets:  148 to  659  Dba:0x01000001
-------------------------------------------------------
 04000000 00000000 00000000 00000000 l ................
BBED> m /x b006
 File: /data1/oracle/crmd/users01.dbf (4)
 Block: 1                Offsets:  148 to  659           Dba:0x01000001
------------------------------------------------------------------------
 b0060000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 
BBED> sum dba 4,1 apply
Check value for File 4, Block 1:
current = 0xd1d9, required = 0xd1d9
 

BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484    
   struct kcvcpscn, 8 bytes                 @484    
      ub4 kscnbas                           @484      0x001b1d78
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x2eaaf271
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500    
      struct kcvcprba, 12 bytes             @500    
         ub4 kcrbaseq                       @500      0x0000031f
         ub4 kcrbabno                       @504      0x000000ec
         ub2 kcrbabof                       @508      0x0010
   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> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x000006b1
BBED> p kcvfhccc
ub4 kcvfhccc                                @148      0x000006b0
BBED> set dba 1,1
        DBA             0x00400001 (4194305 1,1)
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484    
   struct kcvcpscn, 8 bytes                 @484    
      ub4 kscnbas                           @484      0x001b1d78
      ub2 kscnwrp                           @488      0x0000
   ub4 kcvcptim                             @492      0x2eaaf271
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500    
      struct kcvcprba, 12 bytes             @500    
         ub4 kcrbaseq                       @500      0x00000320
         ub4 kcrbabno                       @504      0x000001a2
         ub2 kcrbabof                       @508      0x0010
   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> p kcvfhcpc
ub4 kcvfhcpc                                @140      0x000006b1
BBED> p kcvfhccc
ub4 kcvfhccc                                @148      0x000006b0
 

@>startup force
ORACLE instance started.
Total System Global Area 1.5049E+10 bytes
Fixed Size                  2110032 bytes
Variable Size            2281704880 bytes
Database Buffers         1.2751E+10 bytes
Redo Buffers               14663680 bytes
Database mounted.
ORA-01122: database file 4 failed verification check
ORA-01110: data file 4: '/data1/oracle/crmd/users01.dbf'
ORA-01207: file is more recent than control file - old control file
 
@>alter database backup controlfile to trace;
Database altered.
 
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "CRMD" NORESETLOGS FORCE LOGGING NOARCHIVELOG
    MAXLOGFILES 60
    MAXLOGMEMBERS 5
    MAXDATAFILES 2000
    MAXINSTANCES 1
    MAXLOGHISTORY 1168
LOGFILE
  GROUP 1 '/data1/oracle/crmd/redo7901.log'  SIZE 1020M,
  GROUP 2 '/data1/oracle/crmd/redo7902.log'  SIZE 1020M,
  GROUP 3 '/data1/oracle/crmd/redo7903.log'  SIZE 1020M
-- STANDBY LOGFILE
DATAFILE
  '/data1/oracle/crmd/system01.dbf',
  '/data1/oracle/crmd/undotbs01.dbf',
  '/data1/oracle/crmd/sysaux01.dbf',
  '/data1/oracle/crmd/users01.dbf'
CHARACTER SET UTF8
;
 
@>alter database open;
Database altered.
 

@>conn test/test
Connected.
test>select * from test;
select * from test
              *
ERROR at line 1:
ORA-08103: object no longer exists

test>drop table test;
Table dropped.

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22034023/viewspace-723340/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle ACE组成员,DBGeeK用户组发起人。曾在DTCC、ORACLE技术嘉年华、Gdevops等公开场合做过数据库技术专题分享,2017年应Oracle邀请在世界最大的数据库会议OOW上做技术分享。组织翻译了《拨云见日,解密Oracle ASM内核》一书。

注册时间:2009-07-04

  • 博文量
    422
  • 访问量
    2285504