oracle 例項崩潰時啟動的驗證(low cache rba->on disk rba)

paulyibinyi發表於2008-03-21

檢查點的作用就是為了減少例項恢復的時間,以下是驗證過程

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

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-214920/,如需轉載,請註明出處,否則將追究法律責任。

相關文章