PL/SQL Packages and Types Reference 10g Release 1 (10.1) Part Number B10802-01 |
|
|
View PDF |
Note: With Oracle 10g Release 1 (10.1), the
|
The DBMS_OLAP
package, presented here for reasons of backward compatibility, provides a collection of materialized view analysis and advisory functions that are callable from any PL/SQL program. Some of the functions generate output tables.
See Also:
Oracle Data Warehousing Guide for more information. |
This chapter contains the following topics:
DBMS_OLAP
performs seven major functions, which include materialized view strategy recommendation, materialized view strategy evaluation, reporting and script generation, repository management, workload management, filter management, and dimension validation.
To perform materialized view strategy recommendation and evaluation functions, the workload information can either be provided by the user or synthesized by the Advisor engine. In the former case, cardinality information of all tables and materialized views referenced in the workload are required. In the latter case, dimension objects must be present and cardinality information for all dimension tables, fact tables, and materialized views are required. Cardinality information should be gathered with the DBMS_STATS.GATHER_TABLE_STATS
procedure. Once these functions are completed, the analysis results can be presented with the reporting and script generation function.
The workload management function handles three types of workload, which are user-specified workload, SQL cache workload, and Oracle Trace workload. To process the user-specified workload, a user-defined workload table must be present in the user's schema. To process Oracle Trace workload, the Oracle Trace formatter must be run to preprocess collected workload statistics into default V-tables in the user's schema.
Several views are created when using DBMS_OLAP
. All are in the SYSTEM
schema. To access these views, you must have a DBA role.
The DBMS_OLAP subprograms have been replaced with improved technology: see Chapter 12, "DBMS_ADVISOR", Chapter 32, "DBMS_DIMENSION" and Chapter 54, "DBMS_MVIEW". All DBMS_OLAP subprograms are obsolete with Oracle 10g Release 1 (10.1), and while Oracle will continue to support them, they are documented only for reasons of backward compatibility.
Note: The DBMS_OLAP subprograms have been replaced with improved technology:
|
Subprogram | Description |
---|---|
Filters the contents being used during the recommendation process [seeDeprecated Subprograms ] | |
Generates an internal ID used by a new workload collection, a new filter, or a new advisor run [seeDeprecated Subprograms ] | |
Estimates the size of a materialized view that you might create, in bytes and rows [seeDeprecated Subprograms ] | |
Measures the utilization of each existing materialized view [seeDeprecated Subprograms ] | |
Generates an HTML-based report on the given Advisor run [seeDeprecated Subprograms ] | |
Generates a simple script containing the SQL commands to implement Summary Advisor recommendations [seeDeprecated Subprograms ] | |
Obtains a SQL cache workload [seeDeprecated Subprograms ] | |
Loads a workload collected by Oracle Trace [seeDeprecated Subprograms ] | |
Loads a user-defined workload [seeDeprecated Subprograms ] | |
Deletes a specific filter or all filters [seeDeprecated Subprograms ] | |
Removes all results or those for a specific run [seeDeprecated Subprograms ] | |
Deletes all workloads or a specific collection [seeDeprecated Subprograms ] | |
Generates a set of recommendations about which materialized views should be created, retained, or dropped [seeDeprecated Subprograms ] | |
Stops the Advisor if it takes too long returning results [seeDeprecated Subprograms ] | |
Verifies that the relationships specified in a dimension are correct [seeDeprecated Subprograms ] | |
Validates the SQL Cache workload before performing load operations [seeDeprecated Subprograms ] | |
Validates the Oracle Trace workload before performing load operations [seeDeprecated Subprograms ] | |
Validates the user-supplied workload before performing load operations [seeDeprecated Subprograms ] |
This procedure adds a new filter item to an existing filter to make it more restrictive. It also creates a filter to restrict what is analyzed for the workload.
ADD_FILTER_ITEM ( filter_id IN NUMBER, filter_name IN VARCHAR2, string_list IN VARCHAR2, number_min IN NUMBER, number_max IN NUMBER, date_min IN VARCHAR2, date_max IN VARCHAR2);
This procedure creates a unique identifier, which is used to identify a filter, a workload or results of an advisor or dimension validation run.
CALL DBMS_OLAP.CREATE_ID ( id OUT NUMBER);
Parameter | Description |
---|---|
|
The unique identifier that can be used to identify a filter, a workload, or an Advisor run. |
This procedure estimates the size of a materialized view that you might create, in bytes and number of rows.
DBMS_OLAP.ESTIMATE_MVIEW_SIZE ( stmt_id IN VARCHAR2, select_clause IN VARCHAR2, num_rows OUT NUMBER, num_bytes OUT NUMBER);
This procedure measures the utilization of each existing materialized view based on the materialized view usage statistics collected from the workload. The workload_id is optional. If not provided, EVALUATE_MVIEW_STRATEGY
uses a hypothetical workload.
DBMS_OLAP.EVALUATE_MVIEW_STRATEGY ( run_id IN NUMBER, workload_id IN NUMBER, filter_id IN NUMBER);
Periodically, the unused results can be purged from the system by calling the DBMS_OLAP.PURGE_RESULTS
procedure.
This procedure generates an HTML-based report on the given Advisor run.
DBMS_OLAP.GENERATE_MVIEW_REPORT ( filename IN VARCHAR2, id IN NUMBER, flags IN NUMBER);
This procedure generates a simple script containing the SQL commands to implement Summary Advisor recommendations.
DBMS_OLAP.GENERATE_MVIEW_SCRIPT( filename IN VARCHAR2, id IN NUMBER, tspace IN VARCHAR2);
This procedure loads a SQL cache workload.
DBMS_OLAP.LOAD_WORKLOAD_CACHE ( workload_id IN NUMBER, flags IN NUMBER, filter_id IN NUMBER, application IN VARCHAR2, priority IN NUMBER);
This procedure loads an Oracle Trace workload.
DBMS_OLAP.LOAD_WORKLOAD_TRACE ( workload_id IN NUMBER, flags IN NUMBER, filter_id IN NUMBER, application IN VARCHAR2, priority IN NUMBER, owner_name IN VARCHAR2);
This procedure loads a user-defined workload.
DBMS_OLAP.LOAD_WORKLOAD_USER ( workload_id IN NUMBER, flags IN NUMBER, filter_id IN NUMBER, owner_name IN VARCHAR2, table_name IN VARCHAR2);
This procedure removes a filter at any time. You can delete a specific filter or all filters.
DBMS_OLAP.PURGE_FILTER ( filter_id IN NUMBER);
Parameter | Description |
---|---|
|
The parameter DBMS_OLAP.FILTER_ALL indicates all filters should be removed. |
Many procedures in the DBMS_OLAP
package generate output in system tables, such as recommendation results for RECOMMEND_MVIEW_STRATEGY
and evaluation results for EVALUATE_MVIEW_STRATEGY
, and dimension validation results for VALIDATE_DIMENSION
. When these outputs are no longer required, they should be removed using the procedure PURGE_RESULTS
. You can remove all results or those for a specific run.
DBMS_OLAP.PURGE_RESULTS ( run_id IN NUMBER);
This procedure removes workloads when they are no longer needed. You can delete all workloads or a specific collection.
DBMS_OLAP.PURGE_WORKLOAD ( workload_id IN NUMBER);
This procedure generates a set of recommendations about which materialized views should be created, retained, or dropped, based on information in the workload (gathered by Oracle Trace, the user workload, or the SQL cache), and an analysis of table and column cardinality statistics gathered by the DBMS_STATS.GATHER_TABLE_STATS
procedure.
RECOMMEND_MVIEW_STRATEGY
requires that you have run the GATHER_TABLE_STATS
procedure to gather table and column cardinality statistics and have collected and formatted the workload statistics.
The workload is aggregated to determine the count of each request in the workload, and this count is used as a weighting factor during the optimization process. If the workload_id is not provided, then RECOMMEND_MVIEW_STRATEGY
uses a hypothetical workload based on dimension definitions and other embedded statistics.
The space of all dimensional materialized views that include the specified fact tables identifies the set of materialized views that optimize performance across the workload. The recommendation results are stored in system tables, which can be accessed through the view SYSTEM.MVIEW_RECOMMENDATIONS
.
DBMS_OLAP.RECOMMEND_MVIEW_STRATEGY ( run_id IN NUMBER, workload_id IN NUMBER, filter_id IN NUMBER, storage_in_bytes IN NUMBER, retention_pct IN NUMBER, retention_list IN VARCHAR2, fact_table_filter IN VARCHAR2);
Periodically, the unused results can be purged from the system by calling the PURGE_RESULTS
procedure.
If the Summary Advisor takes too long to make its recommendations using the procedures RECOMMEND_MVIEW_STRATEGY
, you can stop it by calling the procedure SET_CANCELLED
and passing in the run_id
for this recommendation process.
DBMS_OLAP.SET_CANCELLED ( run_id IN NUMBER);
Parameter | Description |
---|---|
|
Id that uniquely identifies an advisor analysis operation. This call can be used to cancel a long running workload collection as well as an Advisor analysis session. |
This procedure verifies that the hierarchical and attribute relationships, and join relationships, specified in an existing dimension object are correct. This provides a fast way to ensure that referential integrity is maintained.
The validation results are stored in system tables, which can be accessed through the view SYSTEM.MVIEW_EXCEPTIONS
.
DBMS_OLAP.VALIDATE_DIMENSION ( dimension_name IN VARCHAR2, dimension_owner IN VARCHAR2, incremental IN BOOLEAN, check_nulls IN BOOLEAN, run_id IN NUMBER);
Periodically, the unused results can be purged from the system by calling the PURGE_RESULTS
procedure.
This procedure validates the SQL Cache workload before performing load operations.
DBMS_OLAP.VALIDATE_WORKLOAD_CACHE ( valid OUT NUMBER, error OUT VARCHAR2);
Parameter | Description |
---|---|
|
Return |
|
|
This procedure validates the Oracle Trace workload before performing load operations.
DBMS_OLAP.VALIDATE_WORKLOAD_TRACE ( owner_name IN VARCHAR2, valid OUT NUMBER, error OUT VARCHAR2);
Parameter | Description |
---|---|
|
Owner of the trace workload table. |
|
Return |
|
|
This procedure validates the user-supplied workload before performing load operations.
DBMS_OLAP.VALIDATE_WORKLOAD_USER ( owner_name IN VARCHAR2, table_name IN VARCHAR2, valid OUT NUMBER, error OUT VARCHAR2);