且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[20150228]DBMS_STATS Tracing.txt

更新时间:2022-09-13 10:36:54

[20150228]DBMS_STATS Tracing.txt

--这个是很久的链接,可以跟踪dbms_stats的操作过程,自己测试看看。
http://www.pythian.com/blog/options-for-tracing-oracle-dbms_stats/

Tracing is enabled by calling dbms_stats.set_global_prefs('trace',)

Following are the possible values for the trace flags:

1 = use dbms_output.put_line instead of writing into trace file
2 = enable dbms_stat trace only at session level
4 = trace table stats
8 = trace index stats
16 = trace column stats
32 = trace auto stats – logs to sys.stats_target$_log
64 = trace scaling
128 = dump backtrace on error
256 = dubious stats detection
512 = auto stats job
1024 = parallel execution tracing
2048 = print query before execution
4096 = partition prune tracing
8192 = trace stat differences
16384 = trace extended column stats gathering
32768 = trace approximate NDV (number distinct values) gathering

--自己测试如下:
SCOTT@test> @ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.3.0     Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

SCOTT@test> SELECT DBMS_STATS.get_prefs ('trace') trace from dual ;
TRACE
------
0

--可以发现缺省是关闭的。
1+ 2+ 4+ 8+ 16+ 32+ 64+ 128+ 256+ 512+ 1024+ 2048+ 4096+ 8192+ 16384+ 32768=65535
--全部相加是65535。

SCOTT@test> set serveroutput on
--注意要设置serveroutput on。

SCOTT@test> exec dbms_stats.set_global_prefs('TRACE',65535);
PL/SQL procedure successfully completed.

SCOTT@test> @stats emp
exec sys.dbms_stats.gather_table_stats ( OwnName => user,TabName => 'emp',Estimate_Percent => NULL,Method_Opt => 'FOR ALL COLUMNS SIZE 1 ',Cascade => True ,No_Invalidate => false)
DBMS_STATS: Start gather table stats -- tabname: emp
DBMS_STATS: Started table SCOTT.EMP. at 2015-02-28 15:42:26.498129000. Execution phase: 1 stattype: DATA
DBMS_STATS: Specified granularity = AUTO, Fixed granularity = GLOBAL AND PARTITION
DBMS_STATS: parameters ** pfix:  granularity: Z gIdxGranularity:  executionPhase: 1 pname:  stime: 02-28-2015 15:42:26 method_opt: FOR ALL COLUMNS SIZE 1
DBMS_STATS: Start construct analyze using SQL .. Execution Phase: 1 granularity: GLOBAL AND PARTITION global_requested:  pfix:
DBMS_STATS: (Baseline)
DBMS_STATS: STATISTIC                      LAST_QUERY SESSION_TOTAL
DBMS_STATS: ------------------------------ ---------- -------------
DBMS_STATS: Queries Parallelized                    0            0
DBMS_STATS: DML Parallelized                        0            0
DBMS_STATS: DDL Parallelized                        0            0
DBMS_STATS: DFO Trees                               0            0
DBMS_STATS: Server Threads                          0            0
DBMS_STATS: Allocation Height                       0            0
DBMS_STATS: Allocation Width                        0            0
DBMS_STATS: Local Msgs Sent                         0            0
DBMS_STATS: Distr Msgs Sent                         0            0
DBMS_STATS: Local Msgs Recv'd                       0            0
DBMS_STATS: Distr Msgs Recv'd                       0            0
DBMS_STATS: Start gather part -- conctx.global_requested:  gran: GLOBAL AND PARTITION execution phase: 1
DBMS_STATS: Start gather_stats.. pfix:  ownname: SCOTTtabname: EMP pname:  spname:  execution phase: 1
DBMS_STATS: Specified DOP=1 blocks=5 DOP used=1
DBMS_STATS: Specified DOP=1 blocks=5 DOP used=1
DBMS_STATS: Iteration 1, percentage  nblks: 5
DBMS_STATS:  NNV  NDV  AVG  MMX  HST  EP   RP   NNNP IND  CNDV HSTN HSTR  COLNAME
DBMS_STATS:        Y    Y    Y                   Y    Y              Y    EMPNO
DBMS_STATS:   Y    Y    Y    Y                   Y    Y              Y    ENAME
DBMS_STATS:   Y    Y    Y    Y                                       Y    JOB
DBMS_STATS:   Y    Y    Y    Y                                       Y    MGR
DBMS_STATS:   Y    Y         Y                   Y    Y              Y    HIREDATE
DBMS_STATS:   Y    Y    Y    Y                                       Y    SAL
DBMS_STATS:   Y    Y    Y    Y                                       Y    COMM
DBMS_STATS:   Y    Y    Y    Y                   Y                   Y    DEPTNO
DBMS_STATS: Specified DOP=1 blocks=5 DOP used=1
DBMS_STATS: Starting query at 2015-02-28 15:42:26.514520000
DBMS_STATS: select /*+  no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring no_substrb_pad  */count(*)
DBMS_STATS: , sum(sys_op_opnsize("EMPNO")), substrb(dump(min("EMPNO"),16,0,32),1,120), substrb(dump(max("EMPNO"),16,0,32),1,120), count("ENAME"), count(distinct "ENAME"), sum(sys_op_opnsize("ENAME")), substrb(dump(min("ENAME"),16,0,32),1,120),
substrb(dump(max("ENAME"),16,0,32),1,120), count("JOB"), count(distinct "JOB"), sum(sys_op_opnsize("JOB")), substrb(dump(min("JOB"),16,0,32),1,120), substrb(dump(max("JOB"),16,0,32),1,120), count("MGR"), count(distinct "MGR"),
sum(sys_op_opnsize("MGR")), substrb(dump(min("MGR"),16,0,32),1,120), substrb(dump(max("MGR"),16,0,32),1,120), count("HIREDATE"), count(distinct "HIREDATE"), substrb(dump(min("HIREDATE"),16,0,32),1,120), substrb(dump(max("HIREDATE"),16,0,32),1,120),
count("SAL"), count(distinct "SAL"), sum(sys_op_opnsize("SAL")), substrb(dump(min("SAL"),16,0,32),1,120), substrb(dump(max("SAL"),16,0,32),1,120), count("COMM"), count(distinct "COMM"), sum(sys_op_opnsize("COMM")),
substrb(dump(min("COMM"),16,0,32),1,120), substrb(dump(max("COMM"),16,0,32),1,120), count("DEPTNO"), count(distinct "DEPTNO"), sum(sys_op_opnsize("DEPTNO")), substrb(dump(min("DEPTNO"),16,0,32),1,120), substrb(dump(max("DEPTNO"),16,0,32),1,120)
DBMS_STATS:  from "SCOTT"."EMP" t
DBMS_STATS: Ending query at 2015-02-28 15:42:26.520232000
DBMS_STATS: STATISTIC                      LAST_QUERY SESSION_TOTAL
DBMS_STATS: ------------------------------ ---------- -------------
DBMS_STATS: Queries Parallelized                    0            0
DBMS_STATS: DML Parallelized                        0            0
DBMS_STATS: DDL Parallelized                        0            0
DBMS_STATS: DFO Trees                               0            0
DBMS_STATS: Server Threads                          0            0
DBMS_STATS: Allocation Height                       0            0
DBMS_STATS: Allocation Width                        0            0
DBMS_STATS: Local Msgs Sent                         0            0
DBMS_STATS: Distr Msgs Sent                         0            0
DBMS_STATS: Local Msgs Recv'd                       0            0
DBMS_STATS: Distr Msgs Recv'd                       0            0
DBMS_STATS:  no histogram: setting density to 1/ndv (.0714285714285714285714285714285714285714)
DBMS_STATS:  no histogram: setting density to 1/ndv (.0714285714285714285714285714285714285714)
DBMS_STATS:  no histogram: setting density to 1/ndv (.2)
DBMS_STATS:  no histogram: setting density to 1/ndv (.1666666666666666666666666666666666666667)
DBMS_STATS:  no histogram: setting density to 1/ndv (.0769230769230769230769230769230769230769)
DBMS_STATS:  no histogram: setting density to 1/ndv (.0833333333333333333333333333333333333333)
DBMS_STATS:  no histogram: setting density to 1/ndv (.25)
DBMS_STATS:  no histogram: setting density to 1/ndv (.3333333333333333333333333333333333333333)
DBMS_STATS: ====================================================================================================
DBMS_STATS: Statistics from clist:
DBMS_STATS: ====================================================================================================
DBMS_STATS: Number of rows in the table = 14
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: EMPNO                          3.929E+00 0         14        14        14        .07142857 0
DBMS_STATS:          min: Typ=2 Len=3: c2,4a,46
DBMS_STATS:          max: Typ=2 Len=3: c2,50,23
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: ENAME                          6         0         14        14        14        .07142857 0
DBMS_STATS:          min: Typ=1 Len=5: 41,44,41,4d,53
DBMS_STATS:          max: Typ=1 Len=4: 57,41,52,44
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: JOB                            7.857E+00 0         14        5         5         .2        0
DBMS_STATS:          min: Typ=1 Len=7: 41,4e,41,4c,59,53,54
DBMS_STATS:          max: Typ=1 Len=8: 53,41,4c,45,53,4d,41,4e
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: MGR                            3.786E+00 1         13        6         6         .16666666 0
DBMS_STATS:          min: Typ=2 Len=3: c2,4c,43
DBMS_STATS:          max: Typ=2 Len=3: c2,50,3
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: HIREDATE                       8         0         14        13        13        .07692307 0
DBMS_STATS:          min: Typ=12 Len=7: 77,b4,c,11,1,1,1
DBMS_STATS:          max: Typ=12 Len=7: 77,bb,5,17,1,1,1
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: SAL                            3.429E+00 0         14        12        12        .08333333 0
DBMS_STATS:          min: Typ=2 Len=2: c2,9
DBMS_STATS:          max: Typ=2 Len=2: c2,33
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COMM                           1.5       10        4         4         4         .25       0
DBMS_STATS:          min: Typ=2 Len=1: 80
DBMS_STATS:          max: Typ=2 Len=2: c2,f
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: DEPTNO                         3         0         14        3         3         .33333333 0
DBMS_STATS:          min: Typ=2 Len=2: c1,b
DBMS_STATS:          max: Typ=2 Len=2: c1,1f
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=SYS_NC00009$ part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=EMPNO part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=ENAME part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=JOB part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=MGR part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=HIREDATE part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=SAL part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=COMM part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: gather_ext_col_stats 1: tbl_owner=SCOTT tbl_name=EMP col_name=DEPTNO part_name= granularity=GLOBAL AND PARTITION
DBMS_STATS: End of construct analyze using sql.
DBMS_STATS: Started index SCOTT.I_EMP_HIREDATE at 2015-02-28 15:42:26.556757000 granularity: GLOBAL AND PARTITION gIdxGran:
DBMS_STATS: Specified granularity = , New granularity = GLOBAL AND PARTITION, Fixed granularity = GLOBAL AND PARTITION
DBMS_STATS: granularity GLOBAL AND PARTITION
DBMS_STATS: Specified DOP=1 blocks=1 DOP used=1
DBMS_STATS: Starting query at 2015-02-28 15:42:26.580511000
DBMS_STATS: select /*+  no_parallel_index(t, "I_EMP_HIREDATE")  dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring no_substrb_pad  no_expand index(t,"I_EMP_HIREDATE") */ count(*) as nrw,count(distinct
sys_op_lbid(285805,'L',t.rowid)) as nlb,count(distinct "HIREDATE") as ndk,sys_op_countchg(substrb(t.rowid,1,15),1) as clf from "SCOTT"."EMP" t where "HIREDATE" is not null
DBMS_STATS: Ending query at 2015-02-28 15:42:26.582820000
DBMS_STATS: STATISTIC                      LAST_QUERY SESSION_TOTAL
DBMS_STATS: ------------------------------ ---------- -------------
DBMS_STATS: Queries Parallelized                    0            0
DBMS_STATS: DML Parallelized                        0            0
DBMS_STATS: DDL Parallelized                        0            0
DBMS_STATS: DFO Trees                               0            0
DBMS_STATS: Server Threads                          0            0
DBMS_STATS: Allocation Height                       0            0
DBMS_STATS: Allocation Width                        0            0
DBMS_STATS: Local Msgs Sent                         0            0
DBMS_STATS: Distr Msgs Sent                         0            0
DBMS_STATS: Local Msgs Recv'd                       0            0
DBMS_STATS: Distr Msgs Recv'd                       0            0
DBMS_STATS: Finished index SCOTT.I_EMP_HIREDATE at 2015-02-28 15:42:26.611638000
DBMS_STATS: Started index SCOTT.IB_EMP_DNAME at 2015-02-28 15:42:26.612191000 granularity: GLOBAL AND PARTITION gIdxGran:
DBMS_STATS: Specified granularity = , New granularity = GLOBAL AND PARTITION, Fixed granularity = GLOBAL AND PARTITION
DBMS_STATS: granularity GLOBAL AND PARTITION
DBMS_STATS: Finished index SCOTT.IB_EMP_DNAME at 2015-02-28 15:42:26.690935000
DBMS_STATS: Started index SCOTT.I_EMP_ENAME at 2015-02-28 15:42:26.691332000 granularity: GLOBAL AND PARTITION gIdxGran:
DBMS_STATS: Specified granularity = , New granularity = GLOBAL AND PARTITION, Fixed granularity = GLOBAL AND PARTITION
DBMS_STATS: granularity GLOBAL AND PARTITION
DBMS_STATS: Specified DOP=1 blocks=1 DOP used=1
DBMS_STATS: Starting query at 2015-02-28 15:42:26.708643000
DBMS_STATS: select /*+  no_parallel_index(t, "I_EMP_ENAME")  dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring no_substrb_pad  no_expand index(t,"I_EMP_ENAME") */ count(*) as nrw,count(distinct
sys_op_lbid(282247,'L',t.rowid)) as nlb,count(distinct "ENAME") as ndk,sys_op_countchg(substrb(t.rowid,1,15),1) as clf from "SCOTT"."EMP" t where "ENAME" is not null
DBMS_STATS: Ending query at 2015-02-28 15:42:26.710804000
DBMS_STATS: STATISTIC                      LAST_QUERY SESSION_TOTAL
DBMS_STATS: ------------------------------ ---------- -------------
DBMS_STATS: Queries Parallelized                    0            0
DBMS_STATS: DML Parallelized                        0            0
DBMS_STATS: DDL Parallelized                        0            0
DBMS_STATS: DFO Trees                               0            0
DBMS_STATS: Server Threads                          0            0
DBMS_STATS: Allocation Height                       0            0
DBMS_STATS: Allocation Width                        0            0
DBMS_STATS: Local Msgs Sent                         0            0
DBMS_STATS: Distr Msgs Sent                         0            0
DBMS_STATS: Local Msgs Recv'd                       0            0
DBMS_STATS: Distr Msgs Recv'd                       0            0
DBMS_STATS: Finished index SCOTT.I_EMP_ENAME at 2015-02-28 15:42:26.713985000
DBMS_STATS: Started index SCOTT.PK_EMP_EMPNO at 2015-02-28 15:42:26.714501000 granularity: GLOBAL AND PARTITION gIdxGran:
DBMS_STATS: Specified granularity = , New granularity = GLOBAL AND PARTITION, Fixed granularity = GLOBAL AND PARTITION
DBMS_STATS: granularity GLOBAL AND PARTITION
DBMS_STATS: Specified DOP=1 blocks=1 DOP used=1
DBMS_STATS: Starting query at 2015-02-28 15:42:26.743991000
DBMS_STATS: select /*+  no_parallel_index(t, "PK_EMP_EMPNO")  dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring no_substrb_pad  no_expand index(t,"PK_EMP_EMPNO") */ count(*) as nrw,count(distinct
sys_op_lbid(274149,'L',t.rowid)) as nlb,null as ndk,sys_op_countchg(substrb(t.rowid,1,15),1) as clf from "SCOTT"."EMP" t where "EMPNO" is not null
DBMS_STATS: Ending query at 2015-02-28 15:42:26.746066000
DBMS_STATS: STATISTIC                      LAST_QUERY SESSION_TOTAL
DBMS_STATS: ------------------------------ ---------- -------------
DBMS_STATS: Queries Parallelized                    0            0
DBMS_STATS: DML Parallelized                        0            0
DBMS_STATS: DDL Parallelized                        0            0
DBMS_STATS: DFO Trees                               0            0
DBMS_STATS: Server Threads                          0            0
DBMS_STATS: Allocation Height                       0            0
DBMS_STATS: Allocation Width                        0            0
DBMS_STATS: Local Msgs Sent                         0            0
DBMS_STATS: Distr Msgs Sent                         0            0
DBMS_STATS: Local Msgs Recv'd                       0            0
DBMS_STATS: Distr Msgs Recv'd                       0            0
DBMS_STATS: Finished index SCOTT.PK_EMP_EMPNO at 2015-02-28 15:42:26.749132000
DBMS_STATS: Finished table SCOTT.EMP. at 2015-02-28 15:42:26.749503000

PL/SQL procedure successfully completed.

SCOTT@test> SELECT DBMS_STATS.get_prefs ('trace') trace from dual ;
TRACE
------
0

--很奇怪,trace依旧是0.

SCOTT@test> exec dbms_stats.set_global_prefs('TRACE',1+4);
PL/SQL procedure successfully completed.

SCOTT@test> SELECT DBMS_STATS.get_prefs ('trace') trace from dual ;
TRACE
-----
5

--这样倒是显示正确。
SCOTT@test> @stats emp
exec sys.dbms_stats.gather_table_stats ( OwnName => user,TabName => 'emp',Estimate_Percent => NULL,Method_Opt => 'FOR ALL COLUMNS SIZE 1 ',Cascade => True ,No_Invalidate => false)
DBMS_STATS: Start gather table stats -- tabname: emp
DBMS_STATS: Started table SCOTT.EMP. at 2015-02-28 15:47:09.643638000. Execution phase: 1 stattype: DATA
DBMS_STATS: Specified granularity = AUTO, Fixed granularity = GLOBAL AND PARTITION
DBMS_STATS: parameters ** pfix:  granularity: Z gIdxGranularity:  executionPhase: 1 pname:  stime: 02-28-2015 15:47:09 method_opt: FOR ALL COLUMNS SIZE 1
DBMS_STATS: Start construct analyze using SQL .. Execution Phase: 1 granularity: GLOBAL AND PARTITION global_requested:  pfix:
DBMS_STATS: Start gather part -- conctx.global_requested:  gran: GLOBAL AND PARTITION execution phase: 1
DBMS_STATS: Start gather_stats.. pfix:  ownname: SCOTTtabname: EMP pname:  spname:  execution phase: 1
DBMS_STATS: End of construct analyze using sql.
DBMS_STATS: Finished table SCOTT.EMP. at 2015-02-28 15:47:09.713614000
PL/SQL procedure successfully completed.

--信息明显减少。


SCOTT@test> exec dbms_stats.set_global_prefs('TRACE',1+4+16);
PL/SQL procedure successfully completed.

SCOTT@test> SELECT DBMS_STATS.get_prefs ('trace') trace from dual ;
TRACE
-------
21

SCOTT@test> @stats emp
exec sys.dbms_stats.gather_table_stats ( OwnName => user,TabName => 'emp',Estimate_Percent => NULL,Method_Opt => 'FOR ALL COLUMNS SIZE 1 ',Cascade => True ,No_Invalidate => false)
DBMS_STATS: Start gather table stats -- tabname: emp
DBMS_STATS: Started table SCOTT.EMP. at 2015-02-28 15:48:32.182285000. Execution phase: 1 stattype: DATA
DBMS_STATS: Specified granularity = AUTO, Fixed granularity = GLOBAL AND PARTITION
DBMS_STATS: parameters ** pfix:  granularity: Z gIdxGranularity:  executionPhase: 1 pname:  stime: 02-28-2015 15:48:32 method_opt: FOR ALL COLUMNS SIZE 1
DBMS_STATS: Start construct analyze using SQL .. Execution Phase: 1 granularity: GLOBAL AND PARTITION global_requested:  pfix:
DBMS_STATS: Start gather part -- conctx.global_requested:  gran: GLOBAL AND PARTITION execution phase: 1
DBMS_STATS: Start gather_stats.. pfix:  ownname: SCOTTtabname: EMP pname:  spname:  execution phase: 1
DBMS_STATS:  NNV  NDV  AVG  MMX  HST  EP   RP   NNNP IND  CNDV HSTN HSTR  COLNAME
DBMS_STATS:        Y    Y    Y                   Y    Y              Y    EMPNO
DBMS_STATS:   Y    Y    Y    Y                   Y    Y              Y    ENAME
DBMS_STATS:   Y    Y    Y    Y                                       Y    JOB
DBMS_STATS:   Y    Y    Y    Y                                       Y    MGR
DBMS_STATS:   Y    Y         Y                   Y    Y              Y    HIREDATE
DBMS_STATS:   Y    Y    Y    Y                                       Y    SAL
DBMS_STATS:   Y    Y    Y    Y                                       Y    COMM
DBMS_STATS:   Y    Y    Y    Y                   Y                   Y    DEPTNO
DBMS_STATS: ====================================================================================================
DBMS_STATS: Statistics from clist:
DBMS_STATS: ====================================================================================================
DBMS_STATS: Number of rows in the table = 14
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: EMPNO                          3.929E+00 0         14        14        14        .07142857 0
DBMS_STATS:          min: Typ=2 Len=3: c2,4a,46
DBMS_STATS:          max: Typ=2 Len=3: c2,50,23
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: ENAME                          6         0         14        14        14        .07142857 0
DBMS_STATS:          min: Typ=1 Len=5: 41,44,41,4d,53
DBMS_STATS:          max: Typ=1 Len=4: 57,41,52,44
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: JOB                            7.857E+00 0         14        5         5         .2        0
DBMS_STATS:          min: Typ=1 Len=7: 41,4e,41,4c,59,53,54
DBMS_STATS:          max: Typ=1 Len=8: 53,41,4c,45,53,4d,41,4e
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: MGR                            3.786E+00 1         13        6         6         .16666666 0
DBMS_STATS:          min: Typ=2 Len=3: c2,4c,43
DBMS_STATS:          max: Typ=2 Len=3: c2,50,3
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: HIREDATE                       8         0         14        13        13        .07692307 0
DBMS_STATS:          min: Typ=12 Len=7: 77,b4,c,11,1,1,1
DBMS_STATS:          max: Typ=12 Len=7: 77,bb,5,17,1,1,1
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: SAL                            3.429E+00 0         14        12        12        .08333333 0
DBMS_STATS:          min: Typ=2 Len=2: c2,9
DBMS_STATS:          max: Typ=2 Len=2: c2,33
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COMM                           1.5       10        4         4         4         .25       0
DBMS_STATS:          min: Typ=2 Len=1: 80
DBMS_STATS:          max: Typ=2 Len=2: c2,f
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: COL_NAME                       ACL       NV        SNNVDV    NDV       SNDV      DENS      CCNT
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: DEPTNO                         3         0         14        3         3         .33333333 0
DBMS_STATS:          min: Typ=2 Len=2: c1,b
DBMS_STATS:          max: Typ=2 Len=2: c1,1f
DBMS_STATS: ----------------------------------------------------------------------------------------------------
DBMS_STATS: End of construct analyze using sql.
DBMS_STATS: Finished table SCOTT.EMP. at 2015-02-28 15:48:32.274965000

PL/SQL procedure successfully completed.

-- 收尾工作:
SCOTT@test> exec dbms_stats.set_global_prefs('TRACE',0);
PL/SQL procedure successfully completed.

SCOTT@test> SELECT DBMS_STATS.get_prefs ('trace') trace from dual ;
TRACE
------
0