检查点的作用就是为了减少实例恢复的时间,以下是验证过程
sql>alter system checkpoint;
此时记录日志中如下:
Beginning global checkpoint up to RBA [0x13.62.10], SCN: 0x0000.00073778
r3r(u@6x*j0Completed 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;ITPUB个人空间 M1PMf-Lb(]n.H
ORACLE instance shut down.
?7Ppk
P1g
nLq0SQL> startup mountITPUB个人空间WdWj-GF
ORACLE instance started.
Total System Global Area 101785252 bytesITPUB个人空间/Mg'rd'eQ
Fixed Size 454308 bytesITPUB个人空间8I9cX.[u"dx
Variable Size 75497472 bytes
/jF,?P\{'J0Database Buffers 25165824 bytesITPUB个人空间Qy.k1bV9rn
Redo Buffers 667648 bytesITPUB个人空间1b[ ?1Si
Database mounted.
u,Wc"Y#~0
转储控制文件
SQL> oradebug setmypidITPUB个人空间-bWVO Y6J/M
t
Statement processed.
s%oTg%BB#C1SF0SQL> oradebug dump controlf 4;
Sh)z1Lg+[]3a0Statement processed.
***************************************************************************ITPUB个人空间-mx)\3W;}5C
CHECKPOINT PROGRESS RECORDSITPUB个人空间]&N:H
C8?O)cY
***************************************************************************ITPUB个人空间O'zWe!x:k7z'HN
(blkno = 0x4, size = 104, max = 1, in-use = 1, last-recid= 0)ITPUB个人空间4w8n&u$G(|;Vb8V0?A
THREAD #1 - status:0x2 flags:0x0 dirty:11ITPUB个人空间0_F:h.k&_w%h$jK
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
1i.Jv
V"@&s&N0the log file sequence number (4 bytes)
1W3r/|WF0the log file block number (4 bytes)
x"V-`nJ3}){W0the byte offset into the block at which the redo record starts (2 bytes)
ITPUB个人空间)z[,V.^
J{F
SQL> alter database open;
Database altered.
将16进制转换为10进制
SQL> select to_number('&A','XXXXXXXX') from dual;ITPUB个人空间1z+Pu0Zsa#hq4d
Enter value for a: 64
D*NFp,XM0old 1: select to_number('&A','XXXXXXXX') from dualITPUB个人空间 C+R6EWh9h[8lp
new 1: select to_number('64','XXXXXXXX') from dual
TO_NUMBER('64','XXXXXXXX')
K:s1\~T
C0--------------------------ITPUB个人空间1In]5o&r!y
100
SQL> select to_number('&A','XXXXXXXX') from dual;ITPUB个人空间p5\
WKM3KE:w[q
Enter value for a: a3
/R4ss;m%i#|3K#J|,z0old 1: select to_number('&A','XXXXXXXX') from dualITPUB个人空间UaUYz1]yL/K
new 1: select to_number('a3','XXXXXXXX') from dual
TO_NUMBER('A3','XXXXXXXX')ITPUB个人空间-_g*~$t,i+d:W.[/?.\Z
--------------------------
&t(Xz.U%N3j]~5d0 163
SQL> select to_number('&A','XXXXXXXX') from dual;
&?(D!DX6Y,_0Enter value for a: 13
;{1t-x$s0F-Gv3zJD$~0old 1: select to_number('&A','XXXXXXXX') from dualITPUB个人空间7e-E3p-bw#[
new 1: select to_number('13','XXXXXXXX') from dual
TO_NUMBER('13','XXXXXXXX')ITPUB个人空间7p|d s\/s-e
--------------------------
X&p$jZ"X+NC$K0 19 代表sequence 号
在数据库启动日志中可以看到恢复时也是从这个范围开始的
Completed first pass scanITPUB个人空间d D,{H?#S
63 redo blocks read, 11 data blocks need recoveryITPUB个人空间UI&}OM
Fri Mar 21 14:09:25 2008ITPUB个人空间)B!V.g0J.tah
Started recovery atITPUB个人空间L9I%_v\^
Thread 1: logseq 19, block 100, scn 0.0ITPUB个人空间.GMD)T4e
C"atB p
Recovery of Online Redo Log: Thread 1 Group 3 Seq 19 Reading mem 0ITPUB个人空间^@PVVlQ
Mem# 0 errs 0: D:\ORACLE\ORADATA\PUBTEST\REDO03.LOG
^%a"dU~&Wy1oD0Fri Mar 21 14:09:25 2008
\,DaURN-G0Completed redo applicationITPUB个人空间9])r
I!Zy8q
Fri Mar 21 14:09:25 2008ITPUB个人空间u-n#u%O0arw
O
Ended recovery at
|O:`(AU[0 Thread 1: logseq 19, block 163, scn 0.513205
%bO4i,`vK
{Jh#{0x0 11 data blocks read, 11 data blocks written, 63 redo blocks readITPUB个人空间V)MO5Q"Z
Crash recovery completed successfully
iJr.fA$R0