步骤1:找到索引的object_id.
SQL> select object_id,object_name from dba_objects where object_name='IDX_TB_TEST_N1';
OBJECT_ID OBJECT_NAME
---------- ---------------------------------------------
51786 IDX_TB_TEST_N1
步骤2:生成treedump文件,文件位置在udump下
alter session set events 'immediate trace name treedump level 51786'
步骤3:查看trc文件内容
[oracle@hxl udump]$ more oracl_ora_2679.trc
/u01/app/oracle/admin/oracl/udump/oracl_ora_2679.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
System name: Linux
Node name: hxl
Release: 2.6.9-42.0.0.0.1.ELhugemem
Version: #1 SMP Sun Oct 15 14:06:18 PDT 2006
Machine: i686
Instance name: oracl
Redo thread mounted by this instance: 1
Oracle process number: 18
Unix process pid: 2679, image: (TNS V1-V3)
*** 2012-01-04 18:23:29.845
*** SERVICE NAME:(SYS$USERS) 2012-01-04 18:23:29.791
*** SESSION ID:(144.20) 2012-01-04 18:23:29.789
----- begin tree dump
branch: 0x1400494 20972692 (0: nrow: 2, level: 1)
leaf: 0x1400497 20972695 (-1: nrow: 540 rrow: 540)
leaf: 0x1400498 20972696 (0: nrow: 23 rrow: 23)
----- end tree dump
B*Tree Index的dump文件,解释一下:
branch/leaf代表该行是分支节点还是页节点(第一行的branch其实是root节点)随后是该节点的rdba,前面是16进制的,后面是10进制的.括号里的第一个数字是同一个level的节点位置计数,root节点从0开始,其他的level从-1开始.nrow:节点中曾经有过的index entry数,rrow:节点中当前的index entry数,从这两个值可以分析出index的空间使用效率.对于branch节点,后面还有个level,叶节点隐含level为0,向上计数直到root.
阅读(3044) | 评论(0) | 转发(0) |