Oracle11gEnhancementsinAWRBaselines(二)

2015-07-24 09:10:47 · 作者: · 浏览: 1
=> 2490,
end_snap_id => 2491,
baseline_name => 'test1_bl',
expiration => 60);
DBMS_WORKLOAD_REPOSITORY.create_baseline(
start_time => TO_DATE('09-JUL-2008 17:00', 'DD-MON-YYYY HH24:MI'),
end_time => TO_DATE('09-JUL-2008 18:00', 'DD-MON-YYYY HH24:MI'),
baseline_name => 'test2_bl',
expiration => NULL);
-- Using functions.
l_return := DBMS_WORKLOAD_REPOSITORY.create_baseline(
start_snap_id => 2492,
end_snap_id => 2493,
baseline_name => 'test3_bl',
expiration => 30);
DBMS_OUTPUT.put_line('Return: ' || l_return);
l_return := DBMS_WORKLOAD_REPOSITORY.create_baseline(
start_time => TO_DATE('09-JUL-2008 19:00', 'DD-MON-YYYY HH24:MI'),
end_time => TO_DATE('09-JUL-2008 20:00', 'DD-MON-YYYY HH24:MI'),
baseline_name => 'test4_bl',
expiration => NULL);
DBMS_OUTPUT.put_line('Return: ' || l_return);
END;
/
Return: 8
Return: 9
PL/SQL procedure successfully completed.
The new baselines are visible in DBA_HIST_BASELINE view.
COLUMN baseline_name FORMAT A15
SELECT baseline_id, baseline_name, START_SNAP_ID,
TO_CHAR(start_snap_time, 'DD-MON-YYYY HH24:MI') AS start_snap_time,
END_SNAP_ID,
TO_CHAR(end_snap_time, 'DD-MON-YYYY HH24:MI') AS end_snap_time
FROM dba_hist_baseline
WHERE baseline_type = 'STATIC'
ORDER BY baseline_id;
BASELINE_ID BASELINE_NAME START_SNAP_ID START_SNAP_TIME END_SNAP_ID END_SNAP_TIME
----------- --------------- ------------- ----------------- ----------- -----------------
6 test1_bl 2490 09-JUL-2008 17:00 2491 09-JUL-2008 18:00
7 test2_bl 2490 09-JUL-2008 17:00 2491 09-JUL-2008 18:00
8 test3_bl 2492 09-JUL-2008 19:00 2493 09-JUL-2008 20:00
9 test4_bl 2492 09-JUL-2008 19:00 2493 09-JUL-2008 20:00
4 rows selected.

The DBA_HIST_BASELINE_DETAILS view shows details about all AWR baselines.
SQL> desc dba_hist_baseline_details
Name Null? Type
------------------------------ -------- --------------
DBID NUMBER
INSTANCE_NUMBER NUMBER
BASELINE_ID NUMBER
BASELINE_NAME VARCHAR2(64)
BASELINE_TYPE VARCHAR2(13)
START_SNAP_ID NUMBER
START_SNAP_TIME TIMESTAMP(3)
END_SNAP_ID NUMBER
END_SNAP_TIME TIMESTAMP(3)
SHUTDOWN VARCHAR2(3)
ERROR_COUNT NUMBER
PCT_TOTAL_TIME NUMBER
LAST_TIME_COMPUTED DATE
MOVING_WINDOW_SIZE NUMBER
CREATION_TIME DATE
EXPIRATION NUMBER
TEMPLATE_NAME VARCHAR2(64)

SHUTDOWN: Indicates whether the database was shut down during this time period. The possible values are YES, NO, and NULL.PCT_TOTAL_TIME: The amount of time spanned by the snapshots divided by the total possible time for the baseline.ERROR_COUNT: Number of errors in the snapshots in the baseline snapshot range.BASELINE_TYPE: The possible values are STATIC, MOVING_WINDOW, and GENERATED. Static windows are other ones that you manually created. The start and end snapshot IDs are dynamic for a moving window baseline. The generated baselines are the ones automatically created by the database based on a template. MOVING_WINDOW_SIZE: The value of this attribute depends on the value of the BASELINE_TYPE attribute. If BASELINE_TYPE is NULL, the moving window size is the same as the value of the AWR retention period. If the BASELINE_TYPE is MOVING_WINDOW, then the value of the MOVING_WINDOW_SIZE attribute is the same number of days as the moving window.

Information about a specific baseline can be displayed by using the BASELINE_ID with the SELECT_BASELINE_DETAILS pipelined table function
SELECT *
FROM TABLE(DBMS_WORKLOAD_REPOSITORY.select_baseline_details(6));
Baselines are rename