PL/SQL Packages and Types Reference 10g Release 1 (10.1) Part Number B10802-01 |
|
|
View PDF |
The DBMS_WORKLOAD_REPOSITORY
package lets you manage the Workload Repository, performing operations such as managing snapshots and baselines.
The chapter contains the following topic:
This table function displays the AWR report in HTML.
DBMS_WORKLOAD_REPOSITORY.AWR_REPORT_HTML( l_dbid IN NUMBER, l_inst_num IN NUMBER, l_bid IN NUMBER, l_eid IN NUMBER, l_options IN NUMBER DEFAULT 0) RETURN awrrpt_text_type_table PIPELINED;
The output will be one column of VARCHAR2(150)
.
You can call the function directly but Oracle recommends you use the awrrpt.sql
script which prompts users for the required information.
This table function displays the AWR report in text.
DBMS_WORKLOAD_REPOSITORY.AWR_REPORT_TEXT( l_dbid IN NUMBER, l_inst_num IN NUMBER, l_bid IN NUMBER, l_eid IN NUMBER, l_options IN NUMBER DEFAULT 0) RETURN awrrpt_text_type_table PIPELINED;
The output will be one column of VARCHAR2(80)
.
You can call the function directly but Oracle recommends you use the awrrpt.sql
script which prompts users for the required information.
This function and procedure creates a baseline.
DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE( start_snap_id IN NUMBER, end_snap_id IN NUMBER, baseline_name IN VARCHAR2, dbid IN NUMBER DEFAULT NULL); DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE( start_snap_id IN NUMBER, end_snap_id IN NUMBER, baseline_name IN VARCHAR2, dbid IN NUMBER DEFAULT NULL) RETURN NUMBER;
This example creates a baseline (named 'oltp_peakload_bl
') between snapshots 105 and 107 for the local database:
EXECUTE DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE (start_snap_id => 105, end_snap_id => 107, baseline_name => 'oltp_peakload_bl');
If you query the DBA_HIST_BASELINE
view after the Create Baseline action, you will see the newly created baseline in the Workload Repository.
This function and procedure create snapshots.In the case of the function, the snapshot ID is returned.
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT( flush_level IN VARCHAR2 DEFAULT 'TYPICAL'); DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT( flush_level IN VARCHAR2 DEFAULT 'TYPICAL') RETURN NUMBER;
Parameter | Description |
---|---|
|
The flush level for the snapshot is either ' |
This example creates a manual snapshot at the TYPICAL
level:
EXECUTE DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT();
If you query the DBA_HIST_SNAPSHOT
view after the CREATE_SNAPSHOT
action, you will see one more snapshot ID added to the Workload Repository.
This procedure drops a baseline.
DBMS_WORKLOAD_REPOSITORY.DROP_BASELINE( baseline_name IN VARCHAR2, cascade IN BOOLEAN DEFAULT false, dbid IN NUMBER DEFAULT NULL);
This example drops the baseline 'oltp_peakload_bl
' without dropping the underlying snapshots:
EXECUTE DBMS_WORKLOAD_REPOSITORY.DROP_BASELINE ( baseline_name => 'oltp_peakload_bl');
If you query the DBA_HIST_BASELINE
view after the DROP_BASELINE
action, you will see the specified baseline definition is removed. You can query the DBS_HIST_SNAPSHOT
view to find that the underlying snapshots are left intact.
This procedure drops a range of snapshots.
DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE( low_snap_id IN NUMBER, high_snap_id IN NUMBER dbid IN NUMBER DEFAULT NULL);
Parameter | Description |
---|---|
|
The low snapshot id of snapshots to drop. |
|
The high snapshot id of snapshots to drop. |
|
The database id (default to local DBID. |
This example drops the range of snapshots between snapshot id 102 to 105 for the local database:
EXECUTE DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(102, 105);
If you query the dba_hist_snapshot
view after the Drop Snapshot
action, you will see that snapshots 102 to 105 are removed from the Workload Repository.
This procedure controls two aspects of snapshot generation. The INTERVAL
setting affects how often snapshots are automatically captured while the RETENTION
setting affects how long snapshots are retained in the Workload Repository.
DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(( retention IN NUMBER DEFAULT NULL, interval IN NUMBER DEFAULT NULL, dbid IN NUMBER DEFAULT NULL);
This example changes the interval
setting to one hour and the retention
setting to two weeks for the local database:
execute dbms_workload_repository.modify_snapshot_settings(interval => 60, retention => 20160);
If you query the DBA_HIST_WR_CONTROL
table after this procedure is executed, you will see the changes to these settings.