Database Reference
In-Depth Information
By default, the
dbms_stats
package modifies the data dictionary directly. Nevertheless, with many of its
procedures and functions, it's also possible to work on a user-defined table stored outside the data dictionary.
This is what I call the
backup table
.
Because managing statistics means much more than simply gathering them, the
dbms_stats
package provides
the following key features (see Figure
8-1
):
•
Gathering object statistics and, optionally, storing the current statistics in a backup table
before overwriting them
•
Locking and unlocking object statistics stored in the data dictionary
•
Copying object statistics from one partition or subpartition to another
•
Restoring object statistics in the data dictionary
•
Deleting object statistics stored in the data dictionary or a backup table
•
Exporting object statistics from the data dictionary to a backup table
•
Importing object statistics from a backup table to the data dictionary
•
Getting (extracting) object statistics stored in the data dictionary or a backup table
•
Setting (modifying) object statistics stored in the data dictionary or a backup table
Figure 8-1.
The
dbms_stats
package provides a comprehensive set of features to manage object statistics
Note that moving statistics between databases is performed by means of a generic data movement utility (for
example, Data Pump), not with the
dbms_stats
package itself.
Depending on the granularity and the operation you want to execute, Table
8-1
shows that the
dbms_stats
package provides different procedures and functions. For example, if you want to operate on a single schema, the
dbms_stats
package provides
gather_schema_stats
,
delete_schema_stats
,
lock_schema_stats
,
unlock_schema_stats
,
restore_schema_stats
,
export_schema_stats
, and
import_schema_stats
.