介绍了DUMP buffer cache中全部数据块及指定RDBA的数据块方法。
1.DUMP buffer cache中全部数据块
ALTER SESSION SET EVENTS ‘immediate trace name buffers level n’;
1 buffer header
2 level 1 + block header
3 level 2 + block contents
4 level 1 + hash chain
5 level 2 + hash chain
6 level 3 + hash chain
8 level 4 + users/waiters
9 level 5 + users/waiters
10 level 6 + users/waiters
###############################
2.DUMP buffer cache中指定RDBA的数据块方法
BYS@ bys3>select dbms_rowid.rowid_relative_fno(rowid) fileid,dbms_rowid.rowid_object(rowid) obj#,dbms_rowid.rowid_block_number(rowid) block#,deptno from dept;
FILEID OBJ# BLOCK# DEPTNO
---------- ---------- ---------- ----------
4 22327 251 10
4 22327 251 20
4 22327 251 40
4 22327 251 99
BYS@ bys3>select dbms_utility.make_data_block_address(4,251) from dual; --使用此函数算出rdba--就是rowid中的rfile#+block#
DBMS_UTILITY.MAKE_DATA_BLOCK_ADDRESS(4,251)
-------------------------------------------
16777467
BYS@ bys3>alter session set events 'immediate trace name set_tsn_p1 level 5'; --这里的5是表空间号加1得到的。也就是TS#+1。select ts#,name from v$tablespace;
Session altered.
BYS@ bys3>alter session set events 'immediate trace name buffer level16777467';
Session altered.
BYS@ bys3>select value from v$diag_info where name like 'De%';
VALUE
---------------------------------------------------
/u01/diag/rdbms/bys3/bys3/trace/bys3_ora_21011.trc
###########################