oracle 实例崩溃时启动的验证(low cache rba->on disk rba)
oracle 实例崩溃时启动的验证(low cache rba->on disk rba)
检查点的作用就是为了减少实例恢复的时间,以下是验证过程
sql>alter system checkpoint;
此时记录日志中如下:
Beginning global checkpoint up to RBA [0x13.62.10], SCN: 0x0000.00073778
Completed checkpoint up to RBA [0x13.62.10], SCN: 0x0000.00073778
此时插入数据
SQL> insert into test select * from test where rownum<100;
99 rows created.
SQL> insert into test select * from test where rownum<100;
99 rows created.
SQL> insert into test select * from test where rownum<100;
99 rows created.
--此时模拟发生实例崩溃
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 101785252 bytes
Fixed Size 454308 bytes
Variable Size 75497472 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
转储控制文件
SQL> oradebug setmypid
Statement processed.
SQL> oradebug dump controlf 4;
Statement processed.
***************************************************************************
CHECKPOINT PROGRESS RECORDS
***************************************************************************
(blkno = 0x4, size = 104, max = 1, in-use = 1, last-recid= 0)
THREAD #1 - status:0x2 flags:0x0 dirty:11
low cache rba:(0x13.64.0) on disk rba:(0x13.a3.0)
rba的组成:
Recent entries in the redo thread of an Oracle instance are addressed using a 3-part redo byte address, or RBA. An RBA is comprised of
the log file sequence number (4 bytes)
the log file block number (4 bytes)
the byte offset into the block at which the redo record starts (2 bytes)
SQL> alter database open;
Database altered.
将16进制转换为10进制
SQL> select to_number('&A','XXXXXXXX') from dual;
Enter value for a: 64
old 1: select to_number('&A','XXXXXXXX') from dual
new 1: select to_number('64','XXXXXXXX') from dual
TO_NUMBER('64','XXXXXXXX')
--------------------------
100
SQL> select to_number('&A','XXXXXXXX') from dual;
Enter value for a: a3
old 1: select to_number('&A','XXXXXXXX') from dual
new 1: select to_number('a3','XXXXXXXX') from dual
TO_NUMBER('A3','XXXXXXXX')
--------------------------
163
SQL> select to_number('&A','XXXXXXXX') from dual;
Enter value for a: 13
old 1: select to_number('&A','XXXXXXXX') from dual
new 1: select to_number('13','XXXXXXXX') from dual
TO_NUMBER('13','XXXXXXXX')
--------------------------
19 代表sequence 号
在数据库启动日志中可以看到恢复时也是从这个范围开始的
Completed first pass scan
63 redo blocks read, 11 data blocks need recovery
Fri Mar 21 14:09:25 2008
Started recovery at
Thread 1: logseq 19, block 100, scn 0.0
Recovery of Online Redo Log: Thread 1 Group 3 Seq 19 Reading mem 0
Mem# 0 errs 0: D:\ORACLE\ORADATA\PUBTEST\REDO03.LOG
Fri Mar 21 14:09:25 2008
Completed redo application
Fri Mar 21 14:09:25 2008
Ended recovery at
Thread 1: logseq 19, block 163, scn 0.513205
11 data blocks read, 11 data blocks written, 63 redo blocks read
Crash recovery completed successfully