[20201231] single instance data buffer states.txt

Time:2021-4-9

[20201231] single instance data buffer states.txt

–//What is the status of Pi? PI represents past image. It is a unique status of Rac environment and will not appear in single instance database.
–//Now that this problem is mentioned, today is to explore an example of data buffer states.

1. Environment:
[email protected]> @ 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 bh.sql
set echo off
——————————————————————————–
— @name: bh
— @author: dion cho
— @note: show block header
— @usage: @bh f# b#
——————————————————————————–

col object_name format a20
col state format a10

select
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,
  (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
;

2. Test:
–//Restart the database.
–//session 1:
[email protected]> select rowid from dept where deptno=10;
ROWID
——————
AAAVRCAAEAAAACHAAA

[email protected]> @ rowid AAAVRCAAEAAAACHAAA
    OBJECT       FILE      BLOCK        ROW ROWID_DBA            DBA                  TEXT
———- ———- ———- ———- ——————– ——————– —————————————-
     87106          4        135          0  0x1000087           4,135                alter system dump datafile 4 block 135 ;

–//session 2:    
[email protected]> @ bh 4 135
no rows selected

–//Now it’s normal that no information is queried. My previous query only outputs ROWID, which can be located through the primary key index, and does not access the corresponding data block DBA = 4135
–//session 1:
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
    DEPTNO DNAME          LOC
———- ————– ————-
        10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         xcur                1          0          0          0          0          0 0000000076D08000 DEPT
–//STATE=xcur,tch=1.

–//session 3:
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
DEPTNO DNAME          LOC
———- ————– ————-
        10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         xcur                2          0          0          0          0          0 0000000076D08000 DEPT
–//State = xcur, TCH = 2. As long as the interval between the execution of session 3 and the front is 3 seconds, TCH will increase.

3. Continue testing:
–//session 1:
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’ for update;
    DEPTNO DNAME          LOC
———- ————– ————-
        10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         xcur                2          0          0          0          0          0 000000007484C000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424785950          3          0          0          0 0000000076D08000 DEPT
–//Pay attention to the Ba data block address, you can find that the original state has become CR. Add a new cache, state = xcur. That is, the current state.

–//Session 1, how about executing the query again?
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
    DEPTNO DNAME          LOC
———- ————– ————-
        10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424785950          3          0          0          0 0000000076D08000 DEPT
–//Notice the Ba and TCH fields. When TCH is increased to 2, you can see that you are actually accessing the data cache of Ba = 000000007484c00.
–//Session 3. What if the block is accessed at this time?
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
    DEPTNO DNAME          LOC
———- ————– ————-
        10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         cr                  1  424786276          3          3        620      18543 0000000073C72000 DEPT
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424785950          3          0          0          0 0000000076D08000 DEPT
–//Add a data cache, state = Cr, which is a data cache block constructed by state = xcur and undo.
–//Session 3, what if it is executed again?
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
    DEPTNO DNAME          LOC
———- ————– ————-
        10 ACCOUNTING     NEW YORK

[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         cr                  1  424786450          3          3        620      18543 00000000738D0000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786276          3          3        620      18543 0000000073C72000 DEPT
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424785950          3          0          0          0 0000000076D08000 DEPT
–//Add another data cache block. Of course, it won’t increase indefinitely. It’s affected by the hidden parameters_ db_ block_ max_ cr_ DBA control.
[email protected]> @ hide _db_block_max_cr_dba
NAME                 DESCRIPTION                                  DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE ISSES ISSYS_MOD
——————– ——————————————– ————- ————- ———— —– ———
_db_block_max_cr_dba Maximum Allowed Number of CR buffers per dba TRUE          6             6            FALSE FALSE

–//session 3:
[email protected]> select dbms_flashback.get_system_change_number,dept.* from dept where rowid=’AAAVRCAAEAAAACHAAA’;
GET_SYSTEM_CHANGE_NUMBER     DEPTNO DNAME          LOC
———————— ———- ————– ————-
              1.3310E+10         10 ACCOUNTING     NEW YORK

[email protected]> set numw 12
[email protected]> select dbms_flashback.get_system_change_number,dept.* from dept where rowid=’AAAVRCAAEAAAACHAAA’;
GET_SYSTEM_CHANGE_NUMBER       DEPTNO DNAME          LOC
———————— ———— ————– ————-
             13309689283           10 ACCOUNTING     NEW YORK
–//13309689283 = scn_wrap,scn_base(10): 3,424787395 = scn_wrap,scn_base(16): 0x3,0x1951bdc3

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         cr                  1  424787394          3          3        620      18543 0000000073A82000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787384          3          3        620      18543 0000000073D5C000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786450          3          3        620      18543 00000000738D0000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786276          3          3        620      18543 0000000073C72000 DEPT
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424785950          3          0          0          0 0000000076D08000 DEPT
6 rows selected.
–//Pay attention to cr_ SCN_ The bas column is actually just the same as the query DBMS above_ flashback.get_ system_ change_ Number is 1.
–//3,424787394 = scn(10): 13309689282 = scn(16): 0x31951bdc2

–//Session 3, what is the state of SCN = 3424787384?
–//3,424787384 = scn(10): 13309689272 = scn(16): 0x31951bdb8
[email protected]> select * from dept as of scn 13309689272 where rowid=’AAAVRCAAEAAAACHAAA’;
      DEPTNO DNAME          LOC
———— ————– ————-
          10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         cr                  1  424787394          3          3        620      18543 0000000073A82000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424787384          3          3        620      18543 0000000073D5C000 DEPT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0000000084D25320          4        135          1 data block         cr                  1  424786450          3          3        620      18543 00000000738D0000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786276          3          3        620      18543 0000000073C72000 DEPT
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
–//Note that the underlined line shows that there is no record added, but TCH of this line becomes 2

4. Continue testing:
–//Session 3, continue:
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
      DEPTNO DNAME          LOC
———— ————– ————-
          10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         cr                  1  424787921          3          3        620      18543 0000000073AB8000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787394          3          3        620      18543 0000000073A82000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424787384          3          3        620      18543 0000000073D5C000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786450          3          3        620      18543 00000000738D0000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786276          3          3        620      18543 0000000073C72000 DEPT
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
6 rows selected.

–//Session 3, continue:
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
      DEPTNO DNAME          LOC
———— ————– ————-
          10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         cr                  1  424787951          3          3        620      18543 0000000073ADE000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787921          3          3        620      18543 0000000073AB8000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787394          3          3        620      18543 0000000073A82000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424787384          3          3        620      18543 0000000073D5C000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786450          3          3        620      18543 00000000738D0000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786276          3          3        620      18543 0000000073C72000 DEPT
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
7 rows selected.

–//Session 3, continue:
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
      DEPTNO DNAME          LOC
———— ————– ————-
          10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         cr                  1  424787987          3          3        620      18543 0000000073EE4000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787951          3          3        620      18543 0000000073ADE000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787921          3          3        620      18543 0000000073AB8000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787394          3          3        620      18543 0000000073A82000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424787384          3          3        620      18543 0000000073D5C000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786450          3          3        620      18543 00000000738D0000 DEPT
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
7 rows selected.
–//It can be found that the row with state = Cr is no longer added and Cr is deleted_ SCN_ The smallest line of bas.

5. What about the dirty disk?
–//session 2:
[email protected]> alter system checkpoint;
System altered.
–//It can be executed many times to avoid the influence of IMU.

[email protected]> @ bh 4 135
HLADDR              DBARFIL     DBABLK      CLASS CLASS_TYPE         STATE             TCH CR_SCN_BAS CR_SCN_WRP CR_UBA_FIL CR_UBA_BLK CR_UBA_SEQ BA               OBJECT_NAME
—————- ———- ———- ———- —————— ———- ———- ———- ———- ———- ———- ———- —————- ——————–
0000000084D25320          4        135          1 data block         cr                  1  424787987          3          3        620      18543 0000000073EE4000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787951          3          3        620      18543 0000000073ADE000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787921          3          3        620      18543 0000000073AB8000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424787394          3          3        620      18543 0000000073A82000 DEPT
0000000084D25320          4        135          1 data block         cr                  2  424787384          3          3        620      18543 0000000073D5C000 DEPT
0000000084D25320          4        135          1 data block         cr                  1  424786450          3          3        620      18543 00000000738D0000 DEPT
0000000084D25320          4        135          1 data block         xcur                3          0          0          0          0          0 000000007484C000 DEPT
7 rows selected.
–//You can see that the state has not changed. Write the dirty block to disk, you can find that the state will not change.
–//How about refreshing the data cache?
[email protected]> alter system flush BUFFER_CACHE;
System altered.

[email protected]> @ bh 4 135
HLADDR                DBARFIL       DBABLK        CLASS CLASS_TYPE         STATE               TCH   CR_SCN_BAS   CR_SCN_WRP   CR_UBA_FIL   CR_UBA_BLK   CR_UBA_SEQ BA               OBJECT_NAME
—————- ———— ———— ———— —————— ———- ———— ———— ———— ———— ———— ———— —————- ——————–
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073EE4000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073ADE000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073AB8000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073A82000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073D5C000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 00000000738D0000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 000000007484C000 DEPT
7 rows selected.
–//flush BUFFER_ After cache, the state table becomes free.

6. Continue:
–//Session 1, note that I did not submit:
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
    DEPTNO DNAME          LOC
———- ————– ————-
        10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR                DBARFIL       DBABLK        CLASS CLASS_TYPE         STATE               TCH   CR_SCN_BAS   CR_SCN_WRP   CR_UBA_FIL   CR_UBA_BLK   CR_UBA_SEQ BA               OBJECT_NAME
—————- ———— ———— ———— —————— ———- ———— ———— ———— ———— ———— ———— —————- ——————–
0000000084D25320            4          135            1 data block         xcur                  1            0            0            0            0            0 0000000074290000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073EE4000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073ADE000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073AB8000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073A82000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073D5C000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 00000000738D0000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 000000007484C000 DEPT
8 rows selected.

[email protected]> alter system flush BUFFER_CACHE;
System altered.

[email protected]> @ bh 4 135
HLADDR                DBARFIL       DBABLK        CLASS CLASS_TYPE         STATE               TCH   CR_SCN_BAS   CR_SCN_WRP   CR_UBA_FIL   CR_UBA_BLK   CR_UBA_SEQ BA               OBJECT_NAME
—————- ———— ———— ———— —————— ———- ———— ———— ———— ———— ———— ———— —————- ——————–
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000074290000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073EE4000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073ADE000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073AB8000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073A82000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 0000000073D5C000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 00000000738D0000 DEPT
0000000084D25320            4          135            1 data block         free                  0            0            0            0            0            0 000000007484C000 DEPT
8 rows selected.

–//How about session 3 instead of session 3?
[email protected]> select * from dept where rowid=’AAAVRCAAEAAAACHAAA’;
      DEPTNO DNAME          LOC
———— ————– ————-
          10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR                DBARFIL       DBABLK        CLASS CLASS_TYPE         STATE               TCH   CR_SCN_BAS   CR_SCN_WRP   CR_UBA_FIL   CR_UBA_BLK   CR_UBA_SEQ BA               OBJECT_NAME
—————- ———— ———— ———— —————— ———- ———— ———— ———— ———— ———— ———— —————- ——————–
0000000084D25320            4          135            1 data block         cr                    1    424789613            3            3          620        18543 000000007435C000 DEPT
0000000084D25320            4          135            1 data block         xcur                  0            0            0            0            0            0 00000000748DE000 DEPT
–//It can be found that two records are generated. First, read the block from the data file, and then construct a new block through undo, two lines of records appear.

–//session 3
[email protected]> select CURRENT_SCN,dept.* from dept,v$database where dept.rowid=’AAAVRCAAEAAAACHAAA’;
 CURRENT_SCN       DEPTNO DNAME          LOC
———— ———— ————– ————-
 13309691673           10 ACCOUNTING     NEW YORK

–//13309691673  = scn_wrap,scn_base(10): 3,424789785 = scn_wrap,scn_base(16): 0x3,0x1951c719

[email protected]> @ bh 4 135
HLADDR                DBARFIL       DBABLK        CLASS CLASS_TYPE         STATE               TCH   CR_SCN_BAS   CR_SCN_WRP   CR_UBA_FIL   CR_UBA_BLK   CR_UBA_SEQ BA               OBJECT_NAME
—————- ———— ———— ———— —————— ———- ———— ———— ———— ———— ———— ———— —————- ——————–
0000000084D25320            4          135            1 data block         cr                    1    424789783            3            3          620        18543 0000000077012000 DEPT
0000000084D25320            4          135            1 data block         cr                    1    424789613            3            3          620        18543 000000007435C000 DEPT
0000000084D25320            4          135            1 data block         xcur                  0            0            0            0            0            0 00000000748DE000 DEPT
–//3,424789783 = scn(10): 13309691671 = scn(16): 0x31951c717
–//By accessing V $database’s current_ SCN field, can be found to add 2. Note: access the current of V $database view_ SCN each visit will increase by 1. You can test by yourself.

7. Supplementary test:
–//Session 1. Note that the transaction in my session is not committed.
[email protected]> @ xid
XIDUSN_XIDSLOT_XIDSQN
——————————
10.4.82650

C70                                                                        XIDUSN    XIDSLOT     XIDSQN     UBAFIL     UBABLK     UBASQN     UBAREC STATUS            USED_UBLK  USED_UREC XID              ADDR             START_DATE                FLAG
———————————————————————- ———- ———- ———- ———- ———- ———- ———- —————- ———- ———- —————- —————- ——————- ———-
ALTER SYSTEM DUMP UNDO BLOCK ‘_SYSSMU10_1197734989$’ XID 10 4 82650;           10          4      82650          3        620      18543          1 ACTIVE                    1          1 0A000400DA420100 0000000081CE1568 2020-12-31 09:00:14       3587
ALTER SYSTEM DUMP UNDO HEADER ‘_SYSSMU10_1197734989$’;
ALTER SYSTEM DUMP DATAFILE 3 BLOCK 620;

[email protected]> ALTER SYSTEM DUMP UNDO HEADER ‘_SYSSMU10_1197734989$’;
System altered.

********************************************************************************
Undo Segment:  _SYSSMU10_1197734989$ (10)
********************************************************************************
  Extent Control Header
  —————————————————————–
  Extent Header:: spare1: 0      spare2: 0      #extents: 4      #blocks: 271
                  last map  0x00000000  #maps: 0      offset: 4080
      Highwater::  0x00c0026c  ext#: 2      blk#: 108    ext size: 128
  #blocks in seg. hdr’s freelists: 0
  #blocks below: 0
  mapblk  0x00000000  offset: 2
                   Unlocked
     Map Header:: next  0x00000000  #extents: 4    obj#: 0      flag: 0x40000000
  Extent Map
  —————————————————————–
   0x00c00111  length: 7
   0x00c000c8  length: 8
   0x00c00200  length: 128
   0x00c00b00  length: 128

 Retention Table
  ———————————————————–
 Extent Number:0  Commit Time: 1609369220
 Extent Number:1  Commit Time: 1609369220
 Extent Number:2  Commit Time: 1609369220
 Extent Number:3  Commit Time: 1609369220

  TRN CTL:: seq: 0x486f chd: 0x0001 ctl: 0x001d inc: 0x00000000 nfb: 0x0000
            mgc: 0xb000 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
            uba: 0x00c0026c.486f.01 scn: 0x0003.1951b4d0
–//0x0003.1951b4d0 = scn(10): 13309686992 = scn(16): 0x31951b4d0
Version: 0x01
  FREE BLOCK POOL::
    uba: 0x00000000.486f.26 ext: 0x2  spc: 0x2f6
    uba: 0x00000000.486f.49 ext: 0x2  spc: 0x420
    uba: 0x00000000.486f.03 ext: 0x2  spc: 0x1760
    uba: 0x00000000.2ec6.04 ext: 0x2  spc: 0x1e02
    uba: 0x00000000.0000.00 ext: 0x0  spc: 0x0
  TRN TBL::

  index  state cflags  wrap#    uel         scn            dba            parent-xid    nub     stmt_num    cmt
  ————————————————————————————————
   0x00    9    0x00  0x142e6  0x000e  0x0003.1951b61e  0x00c00263  0x0000.000.00000000  0x00000003   0x00000000  1609375975
   0x01    9    0x00  0x142f3  0x0011  0x0003.1951b4d6  0x00c00261  0x0000.000.00000000  0x00000001   0x00000000  1609375949
   0x02    9    0x00  0x142fd  0x0009  0x0003.1951b545  0x00c00261  0x0000.000.00000000  0x00000001   0x00000000  1609375975
   0x03    9    0x00  0x142ed  0x0000  0x0003.1951b566  0x00c00261  0x0000.000.00000000  0x00000001   0x00000000  1609375975
   0x04   10    0x80  0x142da  0x0002  0x0003.1951b736  0x00c0026c  0x0000.000.00000000  0x00000001   0x00000000  0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
   0x05    9    0x00  0x142f0  0x001a  0x0003.1951b759  0x00c0026b  0x0000.000.00000000  0x00000001   0x00000000  1609376224
….
   0x20    9    0x00  0x142dd  0x0007  0x0003.1951b656  0x00c00269  0x0000.000.00000000  0x00000003   0x00000000  1609375975
   0x21    9    0x00  0x13d82  0x0016  0x0003.1951b4de  0x00c00261  0x0000.000.00000000  0x00000001   0x00000000  1609375949

–// 0x00c0026c= set dba 3,620 = alter system dump datefile 3 block 620 = 12583532
–// 0x3.1951b736 = scn(10): 13309687606 = scn(16): 0x31951b736
–// 13309687606 = scn_wrap,scn_base(10): 3,424785718 = scn_wrap,scn_base(16): 0x3,0x1951b736

[email protected]> SELECT *  FROM x$bh WHERE dbarfil=4 AND dbablk = 135 and state=1
  2  @ prxx
==============================
ADDR                          : 00007F7120754080
INDX                          : 7139
INST_ID                       : 1
HLADDR                        : 0000000084D25320
BLSIZ                         : 8192
NXT_HASH                      : 0000000084D260C0
PRV_HASH                      : 00000000743F6BA8
NXT_REPL                      : 00000000844F5630
PRV_REPL                      : 00000000787DD128
FLAG                          : 33554433
FLAG2                         : 0
LOBID                         : 0
RFLAG                         : 0
SFLAG                         : 0
LRU_FLAG                      : 0
TS#                           : 4
FILE#                         : 4
DBARFIL                       : 4
DBABLK                        : 135
CLASS                         : 1
STATE                         : 1
MODE_HELD                     : 0
CHANGES                       : 1
CSTATE                        : 0
LE_ADDR                       : 00
DIRTY_QUEUE                   : 0
SET_DS                        : 00000000844F5148
OBJ                           : 87106
BA                            : 00000000748DE000
CR_SCN_BAS                    : 0
CR_SCN_WRP                    : 0
CR_XID_USN                    : 0
CR_XID_SLT                    : 0
CR_XID_SQN                    : 0
CR_UBA_FIL                    : 0
CR_UBA_BLK                    : 0
CR_UBA_SEQ                    : 0
CR_UBA_REC                    : 0
CR_SFL                        : 0
CR_CLS_BAS                    : 0
CR_CLS_WRP                    : 0
LRBA_SEQ                      : 1891
LRBA_BNO                      : 10967
HSCN_BAS                      : 424789783
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Only the highest SCN number accessed is recorded.
HSCN_WRP                      : 3
HSUB_SCN                      : 1
US_NXT                        : 0000000074BDE648
US_PRV                        : 0000000074BDE648
WA_NXT                        : 0000000074BDE658
WA_PRV                        : 0000000074BDE658
OQ_NXT                        : 000000007D281650
OQ_PRV                        : 000000007D281650
AQ_NXT                        : 000000007D281630
AQ_PRV                        : 000000007D281630
OBJ_FLAG                      : 242
TCH                           : 0
TIM                           : 0
CR_RFCNT                      : 0
SHR_RFCNT                     : 0
PL/SQL procedure successfully completed.

–//What about submission?
–//session 1:
[email protected]> commit ;
Commit complete.

[email protected]> @ bh 4 135
HLADDR                DBARFIL       DBABLK        CLASS CLASS_TYPE         STATE               TCH   CR_SCN_BAS   CR_SCN_WRP   CR_UBA_FIL   CR_UBA_BLK   CR_UBA_SEQ BA               OBJECT_NAME
—————- ———— ———— ———— —————— ———- ———— ———— ———— ———— ———— ———— —————- ——————–
0000000084D25320            4          135            1 data block         cr                    1    424791676            3            3          620        18543 0000000071C3A000 DEPT
0000000084D25320            4          135            1 data block         cr                    1    424789783            3            3          620        18543 0000000077012000 DEPT
0000000084D25320            4          135            1 data block         cr                    1    424789613            3            3          620        18543 000000007435C000 DEPT
0000000084D25320            4          135            1 data block         xcur                  0            0            0            0            0            0 00000000748DE000 DEPT
–//Note: before submitting, I execute one more query in session 3 to determine the hscn with state = 1_ Whether bas records the highest SCN during query.
–//Session 3, how about querying again?
[email protected]> select CURRENT_SCN,dept.* from dept,v$database where dept.rowid=’AAAVRCAAEAAAACHAAA’;
 CURRENT_SCN       DEPTNO DNAME          LOC
———— ———— ————– ————-
 13309693848           10 ACCOUNTING     NEW YORK

–//session 2:
[email protected]> @ bh 4 135
HLADDR                DBARFIL       DBABLK        CLASS CLASS_TYPE         STATE               TCH   CR_SCN_BAS   CR_SCN_WRP   CR_UBA_FIL   CR_UBA_BLK   CR_UBA_SEQ BA               OBJECT_NAME
—————- ———— ———— ———— —————— ———- ———— ———— ———— ———— ———— ———— —————- ——————–
0000000084D25320            4          135            1 data block         cr                    1    424791676            3            3          620        18543 0000000071C3A000 DEPT
0000000084D25320            4          135            1 data block         cr                    1    424789783            3            3          620        18543 0000000077012000 DEPT
0000000084D25320            4          135            1 data block         cr                    1    424789613            3            3          620        18543 000000007435C000 DEPT
0000000084D25320            4          135            1 data block         xcur                  1            0            0            0            0            0 00000000748DE000 DEPT

–//Note that you are accessing the block of star = xcur, TCH from 0 – > 1

[email protected]> SELECT HSCN_BAS,HSCN_WRP  FROM x$bh WHERE dbarfil=4 AND dbablk = 135 and state=1;
    HSCN_BAS     HSCN_WRP
———— ————
   424791721            3

–//It can be determined that this SCN is the SCN number at the time of submission.
[email protected]> alter system checkpoint;
System altered.

–//By bbed observation, it can be determined.
BBED> p /d kcbh dba 4,135
struct kcbh, 20 bytes                       @0
   ub1 type_kcbh                            @0        6
   ub1 frmt_kcbh                            @1        162
   ub1 spare1_kcbh                          @2        0
   ub1 spare2_kcbh                          @3        0
   ub4 rdba_kcbh                            @4        16777351
   ub4 bas_kcbh                             @8        424791721
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ub2 wrp_kcbh                             @12       3
   ub1 seq_kcbh                             @14       1
   ub1 flg_kcbh                             @15       6 (KCBHFDLC, KCBHFCKV)
   ub2 chkval_kcbh                          @16       37837
   ub2 spare3_kcbh                          @18       0

–// 16777351 = set dba 4,135 = alter system dump datefile 4 block 135 = 0x1000087

Conclusion:
1. The test is a bit messy, but if you follow the test, many concepts can be understood clearly.
2. I hope this test is useful for us to understand the basic concepts of Oracle.
3. We checked some data last night and found that: 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