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 BA
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