[20201231]RAC buffer states: XCUR, SCUR, PI,CR.txt
--//別人問及rac buffer狀態PI,按照文檔介紹就是past image.
■ Note If you have SYS privileges you can run the following query to see how many blocks you have in what
state: select state, count(*) from x$bh group by state; The commonest states are: 0—free, 1—XCUR
(exclusive current), 2—SCUR (shared current), 3—CR (available only for consistent read), 8—PI (past image). This
isn't a nice thing to do to your buffer cache, so resist the temptation to do it on a busy production system with a
large cache.
--//RAC涉及緩存融合以及資源掌控方面的問題,搞的比單實例的數據庫要複雜N多。
--//不過我找到一篇blog。http://www.dbi-services.com/index.php/blog/entry/rac-buffer-states-xcur-scur-pi-ci
--//注:後面的ci我估計做者筆誤,應該不是CI而是CR。我在本身的環境下重複測試,說明問題。
1.環境:
SYS@192.168.90.18:1521/fyhis/fyhis1> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
$ cat bhy.sql
SELECT inst_id
,class#
,status
,lock_element_addr
,dirty
,temp
,ping
,stale
,direct
,new
FROM gv$bh
WHERE objd = (SELECT data_object_id
FROM dba_objects
WHERE owner = 'SCOTT' AND object_name = 'DEPT')
AND status != 'free'
ORDER BY inst_id;
$ cat bh.sql
set echo off
--------------------------------------------------------------------------------
-- @name: bh
-- @author: dion cho
-- @note: show block header
-- @usage: @bh f# b# state
--------------------------------------------------------------------------------
col object_name format a20
col state format a10
select
b.inst_id,
b.hladdr,
b.dbarfil,
b.dbablk,
b.class,
decode(b.class,1,'data block',2,'sort block',3,'save undo block', 4,
'segment header',5,'save undo header',6,'free list',7,'extent map',
8,'1st level bmb',9,'2nd level bmb',10,'3rd level bmb', 11,'bitmap block',
12,'bitmap index block',13,'file header block',14,'unused',
15,'system undo header',16,'system undo block', 17,'undo header',
18,'undo block') class_type,
decode(state,0,'free',1,'xcur',2,'scur',3,'cr', 4,'read',5,'mrec',6,'irec',7,'write',8,'pi', 9,'memory',10,'mwrite',11,'donated') as state,
b.tch,
cr_scn_bas,
cr_scn_wrp,
cr_uba_fil,
cr_uba_blk,
cr_uba_seq,
ba,
b.LE_ADDR,
(select object_name from dba_objects where data_object_id = b.obj) as object_name
from x$bh b
where
dbarfil = &1 and
dbablk = &2
;
--//增長LE_ADDR,inst_id字段,我發如今單實例上LE_ADDR輸出是00.
SYS@192.168.90.18:1521/fyhis/fyhis1> select rowid from scott.dept where deptno=10;
ROWID
------------------
AAAVRCAAEAAAACHAAA
SYS@192.168.90.18:1521/fyhis/fyhis1> @ rowid AAAVRCAAEAAAACHAAA
OBJECT FILE BLOCK ROW ROWID_DBA DBA TEXT
---------- ---------- ---------- ---------- -------------------- -------------------- ----------------------------------------
87106 4 135 0 0x1000087 4,135 alter system dump datafile 4 block 135 ;
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
no rows selected
--//沒有輸出正常,由於並無訪問對應的數據塊。
2.測試:
--//session 1:
SYS@192.168.90.18:1521/fyhis/fyhis1> select * from scott.dept where rowid='AAAVRCAAEAAAACHAAA';
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
1 00000004E22F9FD8 4 135 1 data block scur 1 0 0 0 0 0 0000000461890000 0000000117F2B4D8 DEPT
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bhy 4 135
INST_ID CLASS# STATUS LOCK_ELEMENT_ADD D T P S D N
---------- ---------- ---------- ---------------- - - - - - -
1 1 scur 0000000117F2B4D8 N N N N N N
--//僅僅出如今1個數據庫實例上。
--//注意state=scur,而不是像單實例出現的是state=xcur.也許這個是RAC的特性.
--//session 2,執行呢?
SYS@192.168.90.18:1521/fyhis/fyhis2> select * from scott.dept where rowid='AAAVRCAAEAAAACHAAA';
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
2 00000004E239D750 4 135 1 data block scur 2 0 0 0 0 0 000000037465A000 0000000223FB8D68 DEPT
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bhy 4 135
INST_ID CLASS# STATUS LOCK_ELEMENT_ADD D T P S D N
---------- ---------- ---------- ---------------- - - - - - -
1 1 scur 0000000117F2B4D8 N N N N N N
2 1 scur 0000000223FB8D68 N N N N N N
--//沒有修改塊,兩邊都是共享的。state=scur.
3.繼續測試:
--//session 1,作一個修改,注個人測試與原連接不一樣,我沒有刷新數據緩存:
SYS@192.168.90.18:1521/fyhis/fyhis1> select * from scott.dept where rowid='AAAVRCAAEAAAACHAAA' for update;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
1 00000004E22F9FD8 4 135 1 data block xcur 2 0 0 0 0 0 00000000A076A000 0000000117F2B4D8 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 2 3703090073 7 0 0 0 0000000461890000 00 DEPT
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bhy
INST_ID CLASS# STATUS LOCK_ELEMENT_ADD D T P S D N
---------- ---------- ---------- ---------------- - - - - - -
1 1 xcur 0000000117F2B4D8 Y N N N N N
1 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
--//session 2:
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
2 00000004E239D750 4 135 1 data block cr 1 3703090072 7 0 0 0 000000037465A000 00 DEPT
--//看看在兩個實例上執行bh.sql腳本的輸出。
--//實例2的STATE從scur->CR,而CR_SCN_BAS從0變成了3703090072。
--//實例1的STATE從scur->CR,而CR_SCN_BAS從0變成了3703090073。也就是先要修改實例2的狀態在修改實例1的狀態們(從scn信息能夠看出來)。
--//實例1上生成新塊state=xcur.
--//在session 2繼續執行:
SYS@192.168.90.18:1521/fyhis/fyhis2> select * from scott.dept where rowid='AAAVRCAAEAAAACHAAA';
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
2 00000004E239D750 4 135 1 data block cr 1 3703090708 7 0 0 0 0000000384620000 00 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703090072 7 0 0 0 000000037465A000 00 DEPT
--//增長1行,state=cr.
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bhy
INST_ID CLASS# STATUS LOCK_ELEMENT_ADD D T P S D N
---------- ---------- ---------- ---------------- - - - - - -
1 1 xcur 0000000117F2B4D8 Y N N N N N
1 1 cr 00 N N N N N N
1 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
--//session 1:
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
1 00000004E22F9FD8 4 135 1 data block cr 0 3703090708 7 3 4278 36326 0000000190F96000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block xcur 2 0 0 0 0 0 00000000A076A000 0000000117F2B4D8 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 2 3703090073 7 0 0 0 0000000461890000 00 DEPT
--//你能夠發現如今實例1上構造出CR_SCN_BAS=3703090708,而後在傳輸到實例2上。
--//session 2,注意修改發生在實例1:
SYS@192.168.90.18:1521/fyhis/fyhis2> alter system checkpoint;
System altered.
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bhy
INST_ID CLASS# STATUS LOCK_ELEMENT_ADD D T P S D N
---------- ---------- ---------- ---------------- - - - - - -
1 1 xcur 0000000117F2B4D8 N N N N N N
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 1 cr 00 N N N N N N
1 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
--//dirty標識清除。發生在實例1.
4.測試STATE=PI的狀態如何出現:
--//session 1:
SYS@192.168.90.18:1521/fyhis/fyhis1> commit ;
Commit complete.
SYS@192.168.90.18:1521/fyhis/fyhis1> alter system checkpoint;
System altered.
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bhy
INST_ID CLASS# STATUS LOCK_ELEMENT_ADD D T P S D N
---------- ---------- ---------- ---------------- - - - - - -
1 1 xcur 0000000117F2B4D8 Y N N N N N
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 1 cr 00 N N N N N N
1 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
--//變成了髒塊.
--//session 2:
SYS@192.168.90.18:1521/fyhis/fyhis2> select * from scott.dept where rowid='AAAVRCAAEAAAACHAAA' for update;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bhy
INST_ID CLASS# STATUS LOCK_ELEMENT_ADD D T P S D N
---------- ---------- ---------- ---------------- - - - - - -
1 1 cr 00 N N N N N N
1 1 cr 00 N N N N N N
1 1 pi 0000000117F2B4D8 Y N N N N N
2 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
2 1 xcur 0000000223FB8D68 Y N N N N N
7 rows selected.
--//注意看dirty標識,兩個依舊標識爲Y。實例1原來的state 從xcur->pi,也就是post image.
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
2 00000004E239D750 4 135 1 data block xcur 1 0 0 0 0 0 00000003C8108000 0000000223FB8D68 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703092337 7 0 0 0 00000003B5A72000 00 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703090708 7 0 0 0 0000000384620000 00 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703090072 7 0 0 0 000000037465A000 00 DEPT
--//session 1查看:
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
1 00000004E22F9FD8 4 135 1 data block cr 0 3703090708 7 3 4278 36326 0000000190F96000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block pi 2 0 0 0 0 0 00000000A076A000 0000000117F2B4D8 DEPT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 00000004E22F9FD8 4 135 1 data block cr 2 3703090073 7 0 0 0 0000000461890000 00 DEPT
--//實例1的原來state=xcur 變成了 state = pi.
--//session 2:
SYS@192.168.90.18:1521/fyhis/fyhis2> alter system checkpoint;
System altered.
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bhy
INST_ID CLASS# STATUS LOCK_ELEMENT_ADD D T P S D N
---------- ---------- ---------- ---------------- - - - - - -
1 1 cr 00 N N N N N N
1 1 cr 00 N N N N N N
1 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
2 1 cr 00 N N N N N N
2 1 xcur 0000000223FB8D68 N N N N N N
7 rows selected.
--//state=pi標識清除,變成了cr,並且lock_element_addr=00.而且標識dirty變成Y->N(2個實例)
--//session 1:
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
1 00000004E22F9FD8 4 135 1 data block cr 0 3703090708 7 3 4278 36326 0000000190F96000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 1 3703092337 7 0 0 0 00000000A076A000 00 DEPT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 00000004E22F9FD8 4 135 1 data block cr 2 3703090073 7 0 0 0 0000000461890000 00 DEPT
--//特別注意下劃線的CR_SCN_BAS=3703092337.原來是0. 很奇怪的是TCH從2變成了1,LE_ADDR=00.
--//session 2:
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
2 00000004E239D750 4 135 1 data block xcur 1 0 0 0 0 0 00000003C8108000 0000000223FB8D68 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703092337 7 0 0 0 00000003B5A72000 00 DEPT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 00000004E239D750 4 135 1 data block cr 1 3703090708 7 0 0 0 0000000384620000 00 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703090072 7 0 0 0 000000037465A000 00 DEPT
--//注意看下劃線以及CR_SCN_BAS列的變化。你能夠猜想大概操做流程,先從實例1傳輸或者拷貝過來,而後在修改。
--//從實例1 CR_SCN_BAS=0 變成 3703092337,就能夠看出來。
5.繼續測試:
--//從實例2讀取特定scn的狀況。
--//7,3703090073 = scn(10): 33767861145 = scn(16): 0x7dcb8ab99
--//session 2:
SYS@192.168.90.18:1521/fyhis/fyhis2> commit ;
Commit complete.
SYS@192.168.90.18:1521/fyhis/fyhis2> select * from scott.dept as of scn 33767861145 where rowid='AAAVRCAAEAAAACHAAA' ;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
2 00000004E239D750 4 135 1 data block xcur 1 0 0 0 0 0 00000003C8108000 0000000223FB8D68 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703092337 7 0 0 0 00000003B5A72000 00 DEPT
2 00000004E239D750 4 135 1 data block cr 2 3703090708 7 0 0 0 0000000384620000 00 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703090072 7 0 0 0 000000037465A000 00 DEPT
--//session 1:
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
1 00000004E22F9FD8 4 135 1 data block cr 0 3703090708 7 3 4278 36326 0000000190F96000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 1 3703092337 7 0 0 0 00000000A076A000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 2 3703090073 7 0 0 0 0000000461890000 00 DEPT
--//沒有變化,甚至tch值。視乎這樣的查詢僅僅經過實例1傳輸過來。
--//session 1,重複上面的查詢:
SYS@192.168.90.18:1521/fyhis/fyhis1> select * from scott.dept as of scn 33767861145 where rowid='AAAVRCAAEAAAACHAAA' ;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
1 00000004E22F9FD8 4 135 1 data block cr 0 3703090708 7 3 4278 36326 0000000190F96000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 1 3703092337 7 0 0 0 00000000A076A000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 3 3703090073 7 0 0 0 0000000461890000 00 DEPT
--//能夠發現TCH從2 -> 3.
--//session 2,改變scn看看呢?
SYS@192.168.90.18:1521/fyhis/fyhis2> select * from scott.dept as of scn 33767861146 where rowid='AAAVRCAAEAAAACHAAA' ;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
--//33767861146 = scn_wrap,scn_base(10): 7,3703090074 = scn_wrap,scn_base(16): 0x7,0xdcb8ab9a
SYS@192.168.90.18:1521/fyhis/fyhis2> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
2 00000004E239D750 4 135 1 data block xcur 1 0 0 0 0 0 00000003C8108000 0000000223FB8D68 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703092337 7 0 0 0 00000003B5A72000 00 DEPT
2 00000004E239D750 4 135 1 data block cr 3 3703090708 7 0 0 0 0000000384620000 00 DEPT
2 00000004E239D750 4 135 1 data block cr 1 3703090072 7 0 0 0 000000037465A000 00 DEPT
--//若是你仔細觀察就能發現CR_SCN_BAS=3703090708的TCH從2->3.也就是構造從當前實例CR_SCN_BAS=3703090708 反向操做會 scn= 7,3703090074.
--//session 1:
SYS@192.168.90.18:1521/fyhis/fyhis1> @ bh 4 135
INST_ID HLADDR DBARFIL DBABLK CLASS CLASS_TYPE STATE TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA LE_ADDR OBJECT_NAME
---------- ---------------- ---------- ---------- ---------- ------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- ---------------- --------------------
1 00000004E22F9FD8 4 135 1 data block cr 0 3703090708 7 3 4278 36326 0000000190F96000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 1 3703092337 7 0 0 0 00000000A076A000 00 DEPT
1 00000004E22F9FD8 4 135 1 data block cr 3 3703090073 7 0 0 0 0000000461890000 00 DEPT
6.總結:
--//至於爲何出現PI,按照文檔介紹節省recovery的恢復時間,一些細節操做個人分析能力。
--//測試仍是有點亂....
--//http://www.dbi-services.com/index.php/blog/entry/rac-buffer-states-xcur-scur-pi-ci
Here are the states we have seen here:
XCUR: current version of the block - holding an exclusive lock for it
SCUR: current version of the block that can be share because no modification were done
CR: only valid for consistent read, after applying the necessary undo to get it back to requried SCN
PI: past image of a modified current block, kept until the latest version is checkpointed
and the other possible states:
FREE: The buffer is not currently in use.
READ: when the block is being read from disk
MREC: when the block is being recovered for media recovery
IREC: when the block is being recovered for crash recovery
--//實際上rac並不是是什麼好東西,處理很差比單實例要慢,特別是原來單實例就存在性能問題的狀況下,rac環境可能放大這樣的效果.
--//並且從上面測試也能夠看出幾點:
--//1.事務應該仍是儘量的快速提交.
--//2.內聯的網絡傳輸能力要儘可能的塊.儘量進行業務分割.相同的業務在1個實例處理.我還見過內聯網絡使用hub的狀況.
--// 這種網絡設備通常就是100M,全雙工也就是200M,最大傳輸能力就是20M/秒.這樣若是內聯流量很大,出現問題的可能性很大.
php