1. Create a single baseline template using the create_baseline_template stored procedure:
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
-- Create a single baseline template to generate a baseline based on the snapshot captured between five o'clock P.M., January 1, March 10, 2013 and.
Begin
Dbms_workload_repository.create_baseline_template (
Start_time => '2017-03-10 17:00:00 ',
End_time => '2017-03-10 20:00:00 ',
Baseline_name => 'baseline _ 000000 ',
Template_name => 'template _ 000000', expiration => 30,
Dbid => 220853307 );
End;
/
-- View the created baseline template through 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. Use the create_baseline_template stored procedure to create a repeating baseline template:
-- Create a repeating baseline template and generate a baseline between five o'clock P.M. and every Monday, January 1, 2013:
Begin
Dbms_workload_repository.create_baseline_template (
Day_of_week => 'monday', hour_in_day => 17,
Duration => 3, expiration => 30,
Start_time => '2017-03-10 17:00:00 ',
End_time => '2017-12-31 20:00:00 ',
Baseline_name_prefix => 'baseline _ 2013_mondays _',
Template_name => 'template _ 2013_mondays ',
Dbid => 220853307 );
End;
/
-- Compare single baseline template and 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 into _ 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. Delete the 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
For reprint, please indicate the author's source and original article link:
Http://blog.csdn.net/xiangsir/article/details/8655136