从oracle 10g开始,数据块中的SCN主要分为一下3类:
数据块变化时的SCN
数据块事务槽中的SCN
数据块中数据行的SCN
1、数据块变化时的SCN
有很多操作会引起数据块变化,如业务数据的变化、块清理等。数据块变化时的SCN保存在数据块OFFSET8-14中,占用6个字节。
数据块变化时的SCN
数据块事务槽中的SCN
数据块中数据行的SCN
1、数据块变化时的SCN
有很多操作会引起数据块变化,如业务数据的变化、块清理等。数据块变化时的SCN保存在数据块OFFSET8-14中,占用6个字节。
数据块的dump:
SQL> alter system dump datafile 1 block 16;
System altered.
SQL> select value from v$diag_info where name = 'Default Trace File';
VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/panda/panda/trace/panda_ora_9099.trc
SQL> ! vim /u01/app/oracle/diag/rdbms/panda/panda/trace/panda_ora_9099.trc
......
Start dump data blocks tsn: 0 file#:1 minblk 16 maxblk 16
Block dump from cache:
Dump of buffer cache at level 4 for tsn=0, rdba=4194320
Block dump from disk:
buffer tsn: 0 rdba: 0x00400010 (1/16)
scn: 0x0000.00000025 seq: 0x01 flg: 0x04 tail: 0x00251e01
frmt: 0x02 chkval: 0x80ab type: 0x1e=KTFB Bitmapped File Space Bitmap
Hex dump of block: st=0, typ_found=1
......
2、数据块事务槽中的SCN
如果一个数据块有多个事务槽,表明允许有多个事务对数据块进行并发更改,当其中一个事务发生变化时,会在相应的事务槽登记变化的SCN.
SQL> create table t(name varchar2(32));
Table created.
SQL> insert into t values('panda1');
1 row created.
SQL> insert into t values('panda2');
1 row created.
SQL> insert into t values('panda3');
1 row created.
SQL> select dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block# from t;
FILE# BLOCK#
---------- ----------
4 183
4 183
4 183
SQL> alter system dump datafile 4 block 183;
System altered.
SQL> select value from v$diag_info where name = 'Default Trace File';
VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/panda/panda/trace/panda_ora_10463.trc
SQL> ! vim /u01/app/oracle/diag/rdbms/panda/panda/trace/panda_ora_10463.trc
Trace file /u01/app/oracle/diag/rdbms/panda/panda/trace/panda_ora_10463.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.1