statown - The schema containing stattab if different then ownname Output arguments: numrows - Number of rows in the table partition numblks - Number of blocks the table partition occupi
Trang 1Input arguments:
ownname - The name of the schema
tabname - The name of the table to which this column belongs
partname - The name of the table partition from which to get the statistics If the table is partitioned and partname
is null, the statistics will be retrieved from the global table level
stattab - The user statistics table identifier describing from where to retrieve the statistics If stattab is null, the statistics will be retrieved directly from the dictionary
statid - The (optional) identifier to associate with these statistics within stattab (Only pertinent if stattab is not NULL)
statown - The schema containing stattab (if different then ownname)
Output arguments:
numrows - Number of rows in the table (partition)
numblks - Number of blocks the table (partition) occupies
avgrlen - Average row length for the table (partition)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges or no statistics have been stored for requested object
DELETE_COLUMN_STATS
The purpose of the delete_column_stats procedure is to delete column-related statistics for a specified table
Input arguments:
ownname - The name of the schema
tabname - The name of the table to which this column belongs
colname - The name of the column
Trang 2P 46
partname - The name of the table partition for which to delete the statistics If the table is partitioned and partname is null, global column statistics will be deleted
stattab - The user statistics table ideentifier describing from where to delete the statistics If stattab is null, the statistics will be deleted directly from the dictionary
statid - The (optional) identifier to associate with these statistics within stattab (Only pertinent if stattab is not NULL)
cascade_parts - If the table is partitioned and partname is null, setting this to true will cause the deletion of statistics for this column for all underlying partitions as well
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
DELETE_INDEX_STATS
The purpose of the delete_index_stats procedure is to deletes index-related statistics for the specified index
Input arguments:
ownname - The name of the schema
indname - The name of the index
partname - The name of the index partition for which to delete the statistics If the index is partitioned and partname is null, index statistics will be deleted at the global level
stattab - The user statistics table identifier describing from where to delete the statistics If stattab is null, the statistics will be deleted directly from the dictionary
statid - The (optional) identifier to associate with these statistics within stattab (Only pertinent if stattab is not NULL)
cascade_parts - If the index is partitioned and partname is null, setting this to true will cause the deletion of statistics for this index for all underlying partitions as well
statown - The schema containing stattab (if different then ownname)
Trang 3Exceptions:
ORA-20000: Object does not exist or insufficient privileges
DELETE_TABLE_STATS
The purpose of the procedure delete_table_stats is to delete table-related statistics from the specified table
Input arguments:
ownname - The name of the schema
tabname - The name of the table to which this column belongs
colname - The name of the column
partname - The name of the table partition from which to get the statistics If the table is partitioned and partname is null, the statistics will
be retrieved from the global table level
stattab - The user statistics table identifier describing from where to retrieve the statistics If stattab is null, the statistics will be retrieved directly from the dictionary
statid - The (optional) identifier to associate with these statistics within stattab (Only pertinent if stattab is not NULL)
cascade_parts - If the table is partitioned and partname is null, setting this to true will cause the deletion of statistics for this table for all underlying partitions as well
cascade_columns - Indicates that delete_column_stats should be called for all underlying columns (passing the cascade_parts parameter)
cascade_indexes - Indicates that delete_index_stats should be called for all underlying indexes (passing the cascade_parts parameter)
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
Trang 4P 48
DELETE_SCHEMA_STATS
The purpose of the delete_schema_stats procedure is to delete statistics for a specified schema
Input arguments:
ownname - The name of the schema
stattab - The user statistics table identifier describing from where to delete the statistics If stattab is null, the statistics will be deleted directly
in the dictionary
statid - The (optional) identifier to associate with these statistics within stattab (Only pertinent if stattab is not NULL)
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
DELETE_DATABASE_STATS
The purpose of the delete_database_stats procedure is to delete statistics for an entire database
Input arguments:
stattab - The user statistics table identifier describing from where to delete the statistics If stattab is null, the statistics will be deleted directly
in the dictionary
statid - The (optional) identifier to associate with these statistics within stattab (Only pertinent if stattab is not NULL)
statown - The schema containing stattab If stattab is not null and statown is null, it is assumed that every schema in the database contains
a user statistics table with the name stattab
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
Trang 5The set of procedures that enable the transference of statistics from the dictionary to a user statistics table (export_*) and from a user statistics table to the dictionary (import_*) are:
CREATE_STAT_TABLE
The purpose of the create_stat_table procedure is to create a table with name 'stattab' in 'ownname' schema which is capable of holding statistics The columns and types that compose this table are not relevant as it should be accessed solely through the procedures in this package
Input arguments:
ownname - The name of the schema
stattab - The name of the table to create This value should be passed
as the 'stattab' argument to other procedures when the user does not wish to modify the dictionary statistics directly
tblspace - The tablespace in which to create the statistics tables If none
is specified, they will be created in the user's default tablespace
Exceptions:
ORA-20000: Table already exists or insufficient privileges
ORA-20001: Tablespace does not exist
DROP_STAT_TABLE
The purpose of the drop_stat_table procedure is to drop a user statistics table for
a specified user (schema.)
Input arguments:
ownname - The name of the schema
stattab - The user statistics table identifier
Exceptions:
ORA-20000: Table does not exists or insufficient privileges
Trang 6P 50
EXPORT_COLUMN_STATS
The purpose of the export_column_stats procedure is to retrieve statistics for a particular column and store them in the user statistics table identified by the value of stattab
Input arguments:
ownname - The name of the schema
tabname - The name of the table to which this column belongs
colname - The name of the column
partname - The name of the table partition If the table is partitioned and partname is null, global and partition column statistics will be exported stattab - The user statistics table identifier describing where to store the statistics
statid - The (optional) identifier to associate with these statistics within stattab
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
EXPORT_INDEX_STATS
The purpose of the export_index_stats procedure is to retrieve statistics for a particular index and store them in the user statistics table identified by the value
of stattab
Input arguments:
ownname - The name of the schema
indname - The name of the index
partname - The name of the index partition If the index is partitioned and partname is null, global and partition index statistics will be exported
stattab - The user statistics table identifier describing where to store the statistics
Trang 7statid - The (optional) identifier to associate with these statistics within stattab
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
EXPORT_TABLE_STATS
The purpose of the export_table_stats is to retrieve statistics for a particular table and store them in the user statistics table (stattab.) Cascade will result in all index and column stats associated with the specified table being exported as well
Input arguments:
ownname - The name of the schema
tabname - The name of the table
partname - The name of the table partition If the table is partitioned and partname is null, global and partition table statistics will be exported stattab - The user statistics table identifier describing where to store the statistics
statid - The (optional) identifier to associate with these statistics within stattab
cascade - If true, column and index statistics for this table will also be exported
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
EXPORT_SCHEMA_STATS
The purpose of the export_shema_stats procedure is to retrieve statistics for all objects in the schema identified by ownname and store them in the user statistics table identified by stattab
Trang 8P 52
Input arguments:
ownname - The name of the schema
stattab - The user statistics table identifier describing where to store the statistics
statid - The (optional) identifier to associate with these statistics within stattab
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
EXPORT_DATABASE_STATS
Retrieves statistics for all objects in the database and stores them in the user statistics tables identified by statown.stattab
Input arguments:
stattab - The user statistics table identifier describing where to store the statistics
statid - The (optional) identifier to associate with these statistics within stattab
statown - The schema containing stattab If statown is null, it is assumed that every schema in the database contains a user statistics table with the name stattab
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
IMPORT_COLUMN_STATS
Retrieves statistics for a particular column from the user statistics table identified
by stattab and stores them in the dictionary
Input arguments:
ownname - The name of the schema
Trang 9tabname - The name of the table to which this column belongs
colname - The name of the column
partname - The name of the table partition If the table is partitioned and partname is null, global and partition column statistics will be imported stattab - The user statistics table identifier describing from where to retrieve the statistics
statid - The (optional) identifier to associate with these statistics within stattab
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
ORA-20001: Invalid or inconsistent values in the user statistics table
IMPORT_INDEX_STATS
The purpose of the import_index_stats procedure is to retrieve statistics for a particular index from the user statistics table identified by stattab and store them
in the dictionary of the target database
Input arguments:
ownname - The name of the schema
indname - The name of the index
partname - The name of the index partition If the index is partitioned and partname is null, global and partition index statistics will be imported
stattab - The user statistics table identifier describing from where to retrieve the statistics
statid - The (optional) identifier to associate with these statistics within stattab
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
Trang 10P 54
ORA-20001: Invalid or inconsistent values in the user statistics table
IMPORT_TABLE_STATS
The purpose of the import_table_stats procedure is to retrieve statistics for a particular table from the user statistics table identified by stattab and store them
in the dictionary Cascade will result in all index and column statistics associated with the specified table being imported as well
Input arguments:
ownname - The name of the schema
tabname - The name of the table
partname - The name of the table partition If the table is partitioned and partname is null, global and partition table statistics will be imported stattab - The user statistics table identifier describing from where to retrieve the statistics
statid - The (optional) identifier to associate with these statistics within stattab
cascade - If true, column and index statistics for this table will also be imported
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
ORA-20001: Invalid or inconsistent values in the user statistics table
IMPORT_SCHEMA_STATS
The purpose of the import_schema_stats procedure is to retrieve statistics for all objects in the schema identified by ownname from the user statistics table and store them in the dictionary
Input arguments:
ownname - The name of the schema
stattab - The user stat table identifier describing from where to retrieve the statistics
Trang 11statid - The (optional) identifier to associate with these statistics within stattab
statown - The schema containing stattab (if different then ownname)
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
ORA-20001: Invalid or inconsistent values in the user statistics table
IMPORT_DATABASE_STATS
The purpose of the import_database_stats procedure is to retrieve statistics for all objects in the database from the user statistics table(s) and store them in the dictionary
Input arguments:
stattab - The user stat table identifier describing from where to retrieve the statistics
statid - The (optional) identifier to associate with these statistics within stattab
statown - The schema containing stattab If statown is null, it is assumed that every schema in the database contains a user statistics table with the name stattab
Exceptions:
ORA-20000: Object does not exist or insufficient privileges
ORA-20001: Invalid or inconsistent values in the user statistics table
The next set of procedures enable the gathering of certain classes of optimizer statistics with possible performance improvements over the ANALYZE command The procedures are:
GATHER_INDEX_STATS
The purpose of this procedure is to gather index statistics It is equivalent to running: