Databases Reference
In-Depth Information
We can query the V$FIXED_TABLE view to get a list of all the V$ dynamic performance
views and X$ tables:
select name from V$FIXED_TABLE order by 1;
You can ind the deinition of each view we will use in the topic
in Appendix A , Dynamic Performance Views
How it works...
Data dictionary views are owned by the user SYS and there is a public synonym for each
of them. They expose data about database objects, for example, tables and indexes.
In Oracle Database 11 g R2 Enterprise Edition, the database installed from the DBCA template
will have more than 800 data dictionary views available. We will present the data dictionary
views that we need in our recipes when we have to query them.
Even dynamic performance views are owned by the user SYS ; they are synonyms to V_$*
views. Those views are based on X$ tables, which are undocumented structures populated
at instance start-up. The data dictionary view contains two kinds of data, namely, fields that
store information on the characteristics of the object, and other fields that collect information
dynamically from object usage.
For example, in the DBA_TABLES there are fields about the physical structure of the table
(such as TABLESPACE_NAME , PCT_FREE , INITIAL_EXTENT ) and other fields which expose
statistics on the table contents (such as NUM_ROWS , AVG_SPACE , AVG_ROW_LEN) .
To collect these statistical data we have to perform the ANALYZE statement. For a table, we
will execute the following statement:
ANALYZE TABLE hr.employees COMPUTE STATISTICS;
To speed up and automate the analysis of many objects, we can use DBMS_UTILITY.
analyze_schema or DBMS_UTILITY.analyze_database to analyze all the objects in
a schema in the first case, or in the database in the latter. To analyze the objects of the HR
schema, we will execute the following statement:
EXEC DBMS_UTILITY.analyze_schema('HR','COMPUTE');
For both the ANALYZE command and the DBMS_UTILITY functions,
we have two choices, which are either to compute the statistics or
to estimate these values based on the analysis of a restricted set of
data. When ESTIMATE is chosen, we have to specify the number of
rows to use for the sample or a percentage.
 
Search WWH ::




Custom Search