oracle block資料塊結構續(一)
/**********檢視254條記錄以上的資料塊**********/
SQL> select dbms_rowid.rowid_block_number(rowid),count(*) from t_block group by dbms_rowid.rowid_block_number(rowid) having count(*)>250;
DBMS_ROWID.ROWID_BLOCK_NUMBER( COUNT(*)
------------------------------ ----------
50398 484
/***********dump上述一個資料塊**************/
SQL> alter system dump datafile 5 block 50535;
System altered
/**********定位trc檔案******************/
SQL> select * from v$diag_info;
INST_ID NAME VALUE
---------- ---------------------------------------------------------------- --------------------------------------------------------------------------------
1 Default Trace File d:\oracle11g_64bit\diag\rdbms\second\second\trace\second_ora_17324.trc
11 rows selected
/***********未刪除此資料塊前的dump*************/
Start dump data blocks tsn: 5 file#:5 minblk 50535 maxblk 50535
Block dump from cache:
Dump of buffer cache at level 4 for tsn=5, rdba=21022055
BH (0x000007FF41FBC528) file#: 5 rdba: 0x0140c567 (5/50535) class: 1 ba: 0x000007FF41918000
set: 3 pool 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 979,28
dbwrid: 0 obj: 72971 objn: 72971 tsn: 5 afn: 5 hint: f
hash: [0x000007FF607493B8,0x000007FF607493B8] lru: [0x000007FF41FBC740,0x000007FF41FBC4E0]
obj-flags: object_ckpt_list
ckptq: [0x000007FF41FBC2C8,0x000007FF41FBC788] fileq: [0x000007FF41FBC2D8,0x000007FF41FBC798] objq: [0x000007FF41FBC768,0x000007FF41FBC508]
st: XCURRENT md: NULL tch: 3
flags: buffer_dirty redo_since_read
LRBA: [0xc2.283c.0] LSCN: [0x0.5b1fe9] HSCN: [0x0.5b1ff8] HSUB: [1]
cr pin refcnt: 0 sh pin refcnt: 0
Block dump from disk:
buffer tsn: 5 rdba: 0x0140c567 (5/50535)
scn: 0x0000.00000000 seq: 0x01 flg: 0x05 tail: 0x00000001
frmt: 0x02 chkval: 0x6327 type: 0x00=unknown
Hex dump of block: st=0, typ_found=0
Dump of memory from 0x000000001B978200 to 0x000000001B97A200
01B978200 0000A200 0140C567 00000000 05010000 [....g.@.........]
01B978210 00006327 00000000 00000000 00000000 ['c..............]
01B978220 00000000 00000000 00000000 00000000 [................]
Repeat 508 times
01B97A1F0 00000000 00000000 00000000 00000001 [................]
Dump of memory from 0x000000001B978214 to 0x000000001B97A1FC
01B978210 00000000 00000000 00000000 [............]
01B978220 00000000 00000000 00000000 00000000 [................]
Repeat 508 times
01B97A1F0 00000000 00000000 00000000 [............]
End dump data blocks tsn: 5 file#: 5 minblk 50535 maxblk 50535
SQL> delete from t_block where dbms_rowid.rowid_block_number(rowid)=50535;
484 rows deleted
SQL> alter system dump datafile 5 block 50535;
System altered
/***********刪除資料塊後的dump********/
Start dump data blocks tsn: 5 file#:5 minblk 50535 maxblk 50535
Block dump from cache:
Dump of buffer cache at level 4 for tsn=5, rdba=21022055
BH (0x000007FF41FA4208) file#: 5 rdba: 0x0140c567 (5/50535) class: 1 ba: 0x000007FF4168C000
set: 3 pool 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 979,28
dbwrid: 0 obj: 72971 objn: 72971 tsn: 5 afn: 5 hint: f
hash: [0x000007FF41FBC5D8,0x000007FF607493B8] lru: [0x000007FF43F98620,0x000007FF41FA41C0]
obj-flags: object_ckpt_list
ckptq: [0x000007FF41FBC2C8,0x000007FF41FBC788] fileq: [0x000007FF41FBC2D8,0x000007FF41FBC798] objq: [0x000007FF41FBC768,0x000007FF41FBC508]
st: XCURRENT md: NULL tch: 2
flags: buffer_dirty redo_since_read
LRBA: [0xc2.283c.0] LSCN: [0x0.5b1fe9] HSCN: [0x0.5b2176] HSUB: [1]
cr pin refcnt: 0 sh pin refcnt: 0
BH (0x000007FF41FBC528) file#: 5 rdba: 0x0140c567 (5/50535) class: 1 ba: 0x000007FF41918000
set: 3 pool 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 979,28
dbwrid: 0 obj: 72971 objn: 72971 tsn: 5 afn: 5 hint: f
hash: [0x000007FF607493B8,0x000007FF41FA42B8] lru: [0x000007FF607C46F0,0x000007FF43F7BF50]
lru-flags: moved_to_tail
ckptq: [NULL] fileq: [NULL] objq: [NULL]
st: CR md: NULL tch: 2
cr: [scn: 0x0.5b2174],[xid: 0x0.0.0],[uba: 0x0.0.0],[cls: 0x0.5b2174],[sfl: 0x0],[lc: 0x0.5b1ff8]
flags: redo_since_read
cr pin refcnt: 0 sh pin refcnt: 0
Block dump from disk:
buffer tsn: 5 rdba: 0x0140c567 (5/50535)
scn: 0x0000.00000000 seq: 0x01 flg: 0x05 tail: 0x00000001 ----發現即便修改了資料塊,資料塊的scn沒有變化
frmt: 0x02 chkval: 0x6327 type: 0x00=unknown
Hex dump of block: st=0, typ_found=0
Dump of memory from 0x000000001B978200 to 0x000000001B97A200
01B978200 0000A200 0140C567 00000000 05010000 [....g.@.........]
01B978210 00006327 00000000 00000000 00000000 ['c..............]
01B978220 00000000 00000000 00000000 00000000 [................]
Repeat 508 times
01B97A1F0 00000000 00000000 00000000 00000001 [................]
Dump of memory from 0x000000001B978214 to 0x000000001B97A1FC
01B978210 00000000 00000000 00000000 [............]
01B978220 00000000 00000000 00000000 00000000 [................]
Repeat 508 times
01B97A1F0 00000000 00000000 00000000 [............]
End dump data blocks tsn: 5 file#: 5 minblk 50535 maxblk 50535
SQL> --提交commit看下block scn是否發生變化
SQL> commit;
Commit complete
SQL> alter system dump datafile 5 block 50535;
System altered
buffer tsn: 5 rdba: 0x0140c567 (5/50535)
scn: 0x0000.00000000 seq: 0x01 flg: 0x05 tail: 0x00000001 --提交commit後的scn沒有發生變化
SQL> --發生檢查點我們看下是否發生變化
SQL> alter system checkpoint;
System altered
SQL> alter system dump datafile 5 block 50535;
System altered
scn: 0x0000.005b2211 seq: 0x01 flg: 0x06 tail: 0x22110601 --發生檢查點後資料塊的scn確實發生了變化
小結:1,block scn是指發生檢查點後已經寫入到資料檔案中的scn
2,如果未發生檢查點,block scn一直是不變化的
/*********測試下對同一個資料塊變化多次scn及seq如何變化的,試著找到一點兒知識***********/
SQL> delete from t_block where dbms_rowid.rowid_block_number(rowid)=49475 and rownum=1;--僅刪除資料塊的一條記錄
1 row deleted
SQL> commit;
Commit complete
SQL> alter system dump datafile 5 block 49475;
System altered
SQL> select * from v$diag_info;
INST_ID NAME VALUE
---------- ---------------------------------------------------------------- --------------------------------------------------------------------------------
1 Default Trace File d:\oracle11g_64bit\diag\rdbms\second\second\trace\second_ora_17324.trc
11 rows selected
/********未更新前的trace dump*********/
scn: 0x0000.005b1ff8 seq: 0x01 flg: 0x06 tail: 0x1ff80601
scn: 0x0000.005b1ff8 seq: 0x01 flg: 0x06 tail: 0x1ff80601
scn: 0x0000.005b1ff8 seq: 0x01 flg: 0x06 tail: 0x1ff80601 --更新某個資料塊300條記錄後block scn沒有變化
小結:1,oracle11g r2上,對於某個資料塊不發生檢查點,更新這資料塊上面的所有表記錄,block scn不會發生變化
2,seq我沒發現有什麼變化,一直是01
scn: 0x0000.005b1ff8 seq: 0x01 flg: 0x06 tail: 0x1ff80601 --檢查點前的某塊scn
/****************作操作但不提交commit*****************/
SQL> delete from t_block where dbms_rowid.rowid_block_number(rowid)=50300 and rownum=1;
1 row deleted
/****************發生檢查點*************************/
SQL> alter system checkpoint;
System altered
/*********未提交commit發生檢查點後****************/
scn: 0x0000.005b1ff8 seq: 0x01 flg: 0x06 tail: 0x1ff80601 --發生檢查點後scn沒有變化
/*******提交************/
SQL> commit;
Commit complete
/*********提交檢查點scn發生變化**********/
小結:1,必須commit加上檢查點 block scn才會發生變化
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-758874/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle block資料塊結構之itcOracleBloC
- oracle block資料塊結構續(二)之dml_ckptq_fileq_objqOracleBloCOBJ
- Oracle資料塊blockOracleBloC
- oracle block資料塊itl小記OracleBloC
- zt_data block資料塊之物理結構初識BloC
- zt_oracle block資料塊精講OracleBloC
- oracle資料檔案內部BLOCK結構詳解OracleBloC
- oracle block header_tail資料塊頭與資料塊尾OracleBloCHeaderAI
- 比特幣原始碼研讀(2)資料結構-區塊Block比特幣原始碼資料結構BloC
- 區塊鏈(Block Chain)結構解析區塊鏈BloCAI
- 使用BBED幫助理解Oracle資料塊結構Oracle
- Oracle Data block 的物理結構OracleBloC
- 資料結構之Stack | 讓我們一塊來學習資料結構資料結構
- 資料結構之Queue | 讓我們一塊來學習資料結構資料結構
- 資料結構之Set | 讓我們一塊來學習資料結構資料結構
- BBED (Oracle Block Brower and EDitor Tool) :資料塊修復工具OracleBloC
- ORACLE 使用records_per_block降低表資料塊熱塊機率OracleBloC
- 資料結構之LinkedList | 讓我們一塊來學習資料結構資料結構
- Oracle Block Cleanouts 塊清除OracleBloC
- oracle壞塊Block CorruptionsOracleBloC
- Oracle的邏輯結構(表空間、段、區間、塊)——Oracle資料塊(二)Oracle
- oracle資料塊格式小結Oracle
- 用oracle 11g bbed copy替換同一個表資料塊block為另一個資料塊之系列八OracleBloC
- Oracle Data block 的物理結構-體系架構OracleBloC架構
- oracle內部原理_如何修改block資料塊大體流程_checkpointOracleBloC
- 【BLOCK】Oracle 塊管理常用SQLBloCOracleSQL
- 用bbed檢視資料檔案的資料塊block 0及block 1BloC
- RMAN備份效率之-oracle block internal(block 內部結構分解)OracleBloC
- 檢查資料塊損壞(Block Corruption)BloC
- Oracle (block clean out) oracle的塊清除OracleBloC
- 【原創】Oracle 資料結構知多少(一)Oracle資料結構
- Oracle 資料庫 結構Oracle資料庫
- oracle block cleanout塊清除_延遲塊清除OracleBloC
- 原創:oracle data block 內部結構分析OracleBloC
- 資料塊內部結構dump解析
- oracle asm 資料塊重構恢復OracleASM
- 持續更新,檢視dump oracle資料塊檢視Oracle
- oracle的塊 db_block_sizeOracleBloC