1.使用 CREATE_BASELINE_TEMPLATE 預存程序建立 single baseline template:
col BASELINE_NAME for a30
TEMPLATE_NAME for a30
select DBID,BASELINE_ID,BASELINE_NAME,BASELINE_TYPE,EXPIRATION,TEMPLATE_NAME from dba_hist_baseline;
DBID BASELINE_ID BASELINE_NAME BASELINE_TYPE EXPIRATION TEMPLATE_NAME
---------- ----------- ------------------------------ ------------- ---------- ------------------------------
220853307 1 peak maomi STATIC 30
220853307 0 SYSTEM_MOVING_WINDOW MOVING_WINDOW
--建立一個 single baseline template 以在 2013年3月10號下午 5 點到晚上 8 點之間捕獲的快照基礎上產生一個 baseline
BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE_TEMPLATE (
start_time => '2013-03-10 17:00:00',
end_time => '2013-03-10 20:00:00',
baseline_name => 'baseline_130310',
template_name => 'template_130310', expiration => 30,
dbid => 220853307);
END;
/
--通過 dba_hist_baseline_template 查看剛剛建立的基準模板
select DBID,TEMPLATE_ID,TEMPLATE_NAME,TEMPLATE_TYPE,DURATION,EXPIRATION,REPEAT_INTERVAL from dba_hist_baseline_template;
DBID TEMPLATE_ID TEMPLATE_NAME TEMPLATE_ DURATION EXPIRATION REPEAT_INTERVAL
---------- ----------- ------------------------------ --------- ---------- ---------- --------------------
220853307 1 template_130310 SINGLE 30
2.使用 CREATE_BASELINE_TEMPLATE 預存程序建立 repeating baseline template:
--建立一個 repeating baseline template,在 2013 年每周星期一下午5點到晚上8點之間產生一個 baseline:
BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE_TEMPLATE (
day_of_week => 'monday', hour_in_day => 17,
duration => 3, expiration => 30,
start_time => '2013-03-10 17:00:00',
end_time => '2013-12-31 20:00:00',
baseline_name_prefix => 'baseline_2013_mondays_',
template_name => 'template_2013_mondays',
dbid => 220853307);
END;
/
-- 對比 single baseline template 和 repeating baseline template
select * from dba_hist_baseline_template;
DBID TEMPLATE_ID TEMPLATE_NAME TEMPLATE_TYPE BASELINE_NAME_PREFIX START_TIME END_TIME DAY_OF_WEEK HOUR_IN_DAY DURATION EXPIRATION REPEAT_INTERVAL LAST_GENERATED
---------- ----------- ------------------------------ ------------- ------------------------------ ----------- ----------- ----------- ----------- ---------- ---------- -------------------------------------------------------------------------------- --------------
220853307 1 template_130310 SINGLE baseline_130310 2013-3-10 1 2013-3-10 2 30
220853307 2 template_2013_mondays REPEATING baseline_2013_mondays_ 2013-3-10 1 2013-12-31 MONDAY 17 3 30 FREQ=WEEKLY;INTERVAL=1;BYDAY=MON;BYHOUR=17;BYMINUTE=0;BYSECOND=0 2013-3-10
17:0
3.刪除 baseline template
BEGIN
DBMS_WORKLOAD_REPOSITORY.DROP_BASELINE_TEMPLATE (
template_name => 'template_2013_mondays',
dbid => 220853307);
END;
/
select * from dba_hist_baseline_template;
DBID TEMPLATE_ID TEMPLATE_NAME TEMPLATE_TYPE BASELINE_NAME_PREFIX START_TIME END_TIME DAY_OF_WEEK HOUR_IN_DAY DURATION EXPIRATION REPEAT_INTERVAL LAST_GENERATED
---------- ----------- ------------------------------ ------------- ------------------------------ ----------- ----------- ----------- ----------- ---------- ---------- -------------------------------------------------------------------------------- --------------
220853307 1 template_130310 SINGLE baseline_130310 2013-3-10 1 2013-3-10 2 30
轉載請註明作者出處及原文連結:
http://blog.csdn.net/xiangsir/article/details/8655136