如何对Oracle的index的block进行dump
如何对index 的block进行dump-oracle
1,新建一个表test
SYS@127.0.0.1:1521/oracle12cpdb> create table test as select object_id from dba_objects;
Table created.
2,新建一个表以后,在这个表的列上新建一个索引
SYS@127.0.0.1:1521/oracle12cpdb> create index ind_test on test(object_id);
Index created.
把buffer_cache刷新回磁盘上
SYS@127.0.0.1:1521/oracle12cpdb> alter system flush buffer_cache;
System altered.
3,通过查询dba_objects表,得到index的object_id
SYS@127.0.0.1:1521/oracle12cpdb> select object_id from dba_objects where OBJECT_NAME='IND_TEST' and OBJECT_TYPE='INDEX';
OBJECT_ID
73204
4,对index tree进行dump,
SYS@127.0.0.1:1521/oracle12cpdb> alter system set events 'immediate trace name treedump level 73204';
System altered.
5.查询进程的跟踪文件,得到如下信息;
----- begin tree dump
branch: 0x407a51 4225617 (0: nrow: 161, level: 1)
leaf: 0x407a52 4225618 (-1: row:485.485 avs:823)
leaf: 0x407a53 4225619 (0: row:479.479 avs:816)
leaf: 0x407a54 4225620 (1: row:479.479 avs:816)
leaf: 0x407a55 4225621 (2: row:479.479 avs:816)
leaf: 0x407a56 4225622 (3: row:479.479 avs:816)
leaf: 0x407a57 4225623 (4: row:478.478 avs:830)
......
----- end tree dump
创新互联建站是一家专业提供黄岩企业网站建设,专注与成都做网站、成都网站设计、H5网站设计、小程序制作等业务。10年已为黄岩众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。
6,使用dbms_utility找出index的file和block numer;
SYS@127.0.0.1:1521/oracle12cpdb> select dbms_utility.data_block_address_file(4225617),dbms_utility.data_block_address_block(4225617) from dual;
DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE(4225617)
DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK(4225617)
1
31313
7,由以上的查询得知,index的在文件1中,block为31313,对这个block进行dump;
SYS@127.0.0.1:1521/oracle12cpdb> alter system dump datafile 1 block 31313;
System altered.
生成dump文件,通过这个文件就可以知道了index key和rowid在block上是如何存放了。
文章名称:如何对Oracle的index的block进行dump
路径分享:http://scyanting.com/article/psjosp.html