_minimum_giga_scn=n的含义是把datafile header里的checkpoint SCN往前推进到nG,但请注意,只有在datafile header的checkpoint SCN小于nG的时候才会用到这个隐含参数,反之则oracle会置这个隐含参数于不顾。
我们来看一个实际的例子:
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> p kcvfhckp.kcvcpscn
struct kcvcpscn, 8 bytes @140
ub4 kscnbas @140 0x000ed811
ub2 kscnwrp @144 0x0000
BBED> set file 1 block 122
FILE# 1
BLOCK# 122
BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0x06
ub1 frmt_kcbh @1 0x02
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x0040007a
ub4 bas_kcbh @8 0x000f2631
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x06 (KCBHFDLC, KCBHFCKV)
ub2 chkval_kcbh @16 0x686f
ub2 spare3_kcbh @18 0x0000
BBED> p ktbbh
struct ktbbh, 48 bytes @20
ub1 ktbbhtyp @20 0x01 (KDDBTDATA)
union ktbbhsid, 4 bytes @24
ub4 ktbbhsg1 @24 0x00000012
ub4 ktbbhod1 @24 0x00000012
struct ktbbhcsc, 8 bytes @28
ub4 kscnbas @28 0x000f2630
ub2 kscnwrp @32 0x0000
b2 ktbbhict @36 1
ub1 ktbbhflg @38 0x02 (NONE)
ub1 ktbbhfsl @39 0x00
ub4 ktbbhfnx @40 0x00000000
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0x0010
ub2 kxidslt @46 0x002a
ub4 kxidsqn @48 0x0000010a
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x02c00444
ub2 kubaseq @56 0x002a
ub1 kubarec @58 0x0e
ub2 ktbitflg @60 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @62
b2 _ktbitfsc @62 0
ub2 _ktbitwrp @62 0x0000
ub4 ktbitbas @64 0x000f2631
现在这个库是启不起来的:
SQL_testdb>startup pfile=/dras20/testdb/inittestdb.ora
ORACLE instance started.
Total System Global Area 504858456 bytes
Fixed Size 743256 bytes
Variable Size 285212672 bytes
Database Buffers 218103808 bytes
Redo Buffers 798720 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
[P550_04_LA:oracle@:/cadrasu01/app/oracle/admin/testdb/bdump]#tail -n 200 alert_testdb.log
CKPT started with pid=5
......省略显示部分内容
SMON: enabling cache recovery
Mon Dec 6 14:24:59 2010
Errors in file /cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_1851540.trc:
ORA-00600: internal error code, arguments: [4000], [16], [], [], [], [], [], []
Mon Dec 6 14:25:00 2010
Errors in file /cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_1851540.trc:
ORA-00600: internal error code, arguments: [16513], [1403], [4], [], [], [], [], []
Mon Dec 6 14:25:00 2010
Errors in file /cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_1851540.trc:
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [16513], [1403], [4], [], [], [], [], []
Mon Dec 6 14:25:00 2010
Error 704 happened during db open, shutting down database
USER: terminating instance due to error 704
Instance terminated by USER, pid = 1851540
ORA-1092 signalled during: ALTER DATABASE OPEN...
当我启用_minimum_giga_scn后,上述库可以open:
[P550_04_LA:oracle@:/cadrasu01/app/oracle/admin/testdb/bdump]#cat /dras20/testdb/inittestdb.ora
*.aq_tm_processes=1
CKPT started with pid=5
......省略显示部分内容
SMON: enabling cache recovery
event = "10513 trace name context forever, level 2:10231 trace name context forever, level 10"
*._minimum_giga_scn=1
SQL_testdb>startup pfile=/dras20/testdb/inittestdb.ora
ORACLE instance started.
Total System Global Area 504858456 bytes
Fixed Size 743256 bytes
Variable Size 285212672 bytes
Database Buffers 218103808 bytes
Redo Buffers 798720 bytes
Database mounted.
Database opened.
现在我们再去看一下datafile header里记录的checkpoint SCN:
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> p kcvfhckp.kcvcpscn
struct kcvcpscn, 8 bytes @140
ub4 kscnbas @140 0x40000088
ub2 kscnwrp @144 0x0000
我们可以清晰的看到现在datafile header里记录的checkpoint SCN确实向前推进到了大于1个G:
SQL> select to_number('40000088','XXXXXXXXXXXX')/(1024*1024*1024) from dual;
TO_NUMBER('40000088','XXXXXXXX
------------------------------
1.00000012665987
现在我们保留上述隐含参数后再次启库:
SQL_testdb>startup pfile=/dras20/testdb/inittestdb.ora
ORACLE instance started.
Total System Global Area 504858456 bytes
Fixed Size 743256 bytes
Variable Size 285212672 bytes
Database Buffers 218103808 bytes
Redo Buffers 798720 bytes
Database mounted.
Database opened.
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> p kcvfhckp.kcvcpscn
struct kcvcpscn, 8 bytes @140
ub4 kscnbas @140 0x400000fc
ub2 kscnwrp @144 0x0000
很明显,因为现在的checkpoint SCN已经大于1G了,所以oracle置上述隐含参数于不顾。
这里我把_minimum_giga_scn改为2后再启库:
[P550_04_LA:oracle@:/cadrasu01/app/oracle/product/9.2.0/bin]#cat /dras20/testdb/inittestdb.ora
*.aq_tm_processes=1
......省略显示部分内容
*.log_archive_start=TRUE
*._minimum_giga_scn=2
SQL_testdb>startup pfile=/dras20/testdb/inittestdb.ora
ORACLE instance started.
Total System Global Area 504858456 bytes
Fixed Size 743256 bytes
Variable Size 285212672 bytes
Database Buffers 218103808 bytes
Redo Buffers 798720 bytes
Database mounted.
Database opened.
SQL_testdb>show parameter scn;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
_minimum_giga_scn integer 2
BBED> set file 1 block 1
FILE# 1
BLOCK# 1
BBED> p kcvfhckp.kcvcpscn
struct kcvcpscn, 8 bytes @140
ub4 kscnbas @140 0x8000008d
ub2 kscnwrp @144 0x0000
SQL> select to_number('8000008d','XXXXXXXXXXXX')/(1024*1024*1024) from dual;
TO_NUMBER('8000008D','XXXXXXXX
------------------------------
2.00000013131648