Daily baseline template from sqlplus

If you want to create repeating baseline template from sqlplus you might struggle if you want to set the frequency to daily (every day in the week).
This is because in the documentation it is not specified what you should specify for the day_of_week parameter of the dbms_workload_repository.crete_baseline_template function.

What is specified is this:
http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_workload_repos.htm#ARPLS69130

Parameter: day_of_week
Description: Day of week that the baseline should repeat on. Specify one of the following values: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY

If you want the baseline for specific day, then great just specify one of the available values.

But if you want day_of_week to be set to daily then you’ll have to specify ALL

begin
 DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE_TEMPLATE(day_of_week => 'ALL',
                                                   hour_in_day => 10,
                                                   duration    => 6,
                                                   start_time  => next_day(sysdate,'MONDAY'),
                                                   end_time    => to_date('01012015','ddmmyyyy'),
                                                   baseline_name_prefix  => 'TEST_',
                                                   template_name => 'TEMPLATE_FOR_TESTING',
                                                   expiration   => NULL,
                                                   dbid         => null);
end;
/
PL/SQL procedure successfully completed.

Leave a Reply