L).
numrows : Number of rows in the table (partition).
numblks : Number of blocks the table (partition) occupies.
avgrlen : Average row length for the table (partition).
flags : For internal Oracle use (should be left as NULL).
statown : Schema containing stattab (if different than ownname).
Get Table Stats
DBMS_STATS.get_table_stats (
ownname VARCHAR2,
tabname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2 DEFAULT NULL,
statid VARCHAR2 DEFAULT NULL,
numrows OUT NUMBER,
numblks OUT NUMBER,
avgrlen OUT NUMBER,
statown VARCHAR2 DEFAULT NULL);
ownname : Name of the schema.
tabname : Name of the table to which this column belongs.
partname : Name of the table partition from which to get the statistics. If the table is partitioned and if partname is NULL, then the statistics are retrieved from the global table level.
stattab : User stat table identifier describing from where to retrieve the statistics. If stattab is NULL, then the statistics are retrieved directly from the dictionary.
statid : Identifier (optional) to associate with these statistics within stattab (Only pertinent if stattab is not NULL).
numrows : Number of rows in the table (partition).
numblks : Number of blocks the table (partition) occupies.
avgrlen : Average row length for the table (partition).
statown : Schema containing stattab (if different than ownname).
Get Index Stats
DBMS_STATS.GET_INDEX_STATS (
ownname VARCHAR2,
indname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2 DEFAULT NULL,
statid VARCHAR2 DEFAULT NULL,
numrows OUT NUMBER,
numlblks OUT NUMBER,
numdist OUT NUMBER,
avglblk OUT NUMBER,
avgdblk OUT NUMBER,
clstfct OUT NUMBER,
indlevel OUT NUMBER,
statown VARCHAR2 DEFAULT NULL);
ownname : Name of the schema.
indname : Name of the index.
partname : Name of the index partition for which to get the statistics. If the index is partitioned and if partname is NULL, then the statistics are retrieved for the global index level.
stattab : User stat table identifier describing from where to retrieve the statistics. If stattab is NULL, then the statistics are retrieved directly from the dictionary.
statid : Identifier (optional) to associate with these statistics within stattab (Only pertinent if stattab is not NULL).
numrows : Number of rows in the index (partition).
numlblks : Number of leaf blocks in the index (partition).
numdist : Number of distinct keys in the index (partition).
avglblk : Average integral number of leaf blocks in which each distinct key appears for this index (partition).
avgdblk : Average integral number of data blocks in the table pointed to by a distinct key for this index (partition).
clstfct : Clustering factor for the index (partition).
indlevel : Height of the index (partition).
statown : Schema containing stattab (if different than ownname).
Automated table monitoring and stale statistics gathering example
在oracle10g中 statistics_level 初始化参数作为一个全局设置影响对表的监控操作,本文下面涉及的alter_schema_tab_monitoring已经不再被使用,但是到我们调用这些过程时,不会报错,只是没有任何事情发生。
You can automatically gather statistics or create lists of tables that have stale or no statistics.
To automatically gather statistics, run the DBMS_STATS.GATHER_SCHEMA_STATS and DBMS_STATS.GATHER_DATABASE_STATS procedures with the OPTIONS and objlist parameters. Use the following values for the options parameter:
GATHER STALE : Gathers statistics on tables with stale statistics.
(通过*_tab_modifications视图)
GA