Tascha Task Scheduler


Package tascha_pkg

Package used to create/maintain/schedule tasks.


Field Summary
 NUMBERGC_sched_already_started
           Thrown when an attempt is made to start an already started scheduler
 VARCHAR2(255)GC_sched_already_started_txt
          
 NUMBERGC_sched_already_stopped
           Thrown when an attempt is made to stop an already stopped scheduler
 VARCHAR2(255)GC_sched_already_stopped_txt
          
 NUMBERGC_task_not_found
           Thrown when an attempt is made to change a non existant task
 VARCHAR2(255)GC_task_not_found_txt
          

Method Summary
 add_task_prm(i_sched_id NUMBER, i_prm_name VARCHAR2, i_prm_value VARCHAR2)
           Adds parameters to a task already scheduled using schedule_task.
 change_task(i_task_id NUMBER, i_procedure_name VARCHAR2 DEFAULT NULL, i_category VARCHAR2 DEFAULT NULL, i_title VARCHAR2 DEFAULT NULL, i_full_desc VARCHAR2 DEFAULT NULL)
           Used to change the attributes of a task.
 create_task(i_procedure_name VARCHAR2, i_category VARCHAR2 DEFAULT NULL, i_title VARCHAR2 DEFAULT NULL, i_full_desc VARCHAR2 DEFAULT NULL, i_success_email VARCHAR2 DEFAULT NULL, i_failure_email VARCHAR2 DEFAULT NULL, o_task_id OUT NUMBER)
           Used to create a task ready for scheduling later.
 disable_task(i_sched_id NUMBER)
           Disables a scheduled task Does NOT commit.
 drop_schedule(i_task_id NUMBER, i_sched_id NUMBER)
           Drops a task's schedule, task is a parameter to verify sched_id
 drop_task(i_task_id NUMBER)
           Drops a task and it's associated schedules
 enable_task(i_sched_id NUMBER)
           Enables a scheduled task Does NOT commit.
 reschedule_task(i_sched_id NUMBER, i_hour VARCHAR2 DEFAULT NULL, i_min VARCHAR2 DEFAULT NULL, i_dom NUMBER DEFAULT NULL, i_month NUMBER DEFAULT NULL, i_dow VARCHAR2 DEFAULT NULL, i_dow_first BOOLEAN DEFAULT NULL, i_dow_last BOOLEAN DEFAULT NULL, i_title VARCHAR2 DEFAULT NULL, i_sql_trace BOOLEAN DEFAULT NULL, i_ora_trace BOOLEAN DEFAULT NULL, i_run_stats BOOLEAN DEFAULT NULL, i_once_only BOOLEAN DEFAULT NULL, i_enabled BOOLEAN DEFAULT NULL)
           Reschedules a scheduled task Does NOT commit.
 reset_scheduler()
           Stops the task scheduler if it's running and resets the scheduler so it is sure it isn't running.
 schedule_task(i_task_id NUMBER, i_hour VARCHAR2 DEFAULT NULL, i_min VARCHAR2 DEFAULT NULL, i_dom NUMBER DEFAULT NULL, i_month NUMBER DEFAULT NULL, i_dow VARCHAR2 DEFAULT NULL, i_dow_first BOOLEAN DEFAULT FALSE, i_dow_last BOOLEAN DEFAULT FALSE, i_title VARCHAR2 DEFAULT NULL, i_sql_trace BOOLEAN DEFAULT FALSE, i_ora_trace BOOLEAN DEFAULT FALSE, i_run_stats BOOLEAN DEFAULT TRUE, i_once_only BOOLEAN DEFAULT FALSE, i_enabled BOOLEAN DEFAULT TRUE, o_sched_id OUT NUMBER)
           Schedules a task already created using create_task.
 start_scheduler()
           Starts the task scheduler which wakes up every minute and checks for any jobs scheduled for that minute.
 stop_scheduler()
           Stops the task scheduler
 task_log_maint(i_older_than DATE DEFAULT NULL)
           Used to maintain the task_logs table.

Field Detail

GC_sched_already_started

  public NUMBER GC_sched_already_started
Thrown when an attempt is made to start an already started scheduler

GC_sched_already_started_txt

  public VARCHAR2(255) GC_sched_already_started_txt

GC_sched_already_stopped

  public NUMBER GC_sched_already_stopped
Thrown when an attempt is made to stop an already stopped scheduler

GC_sched_already_stopped_txt

  public VARCHAR2(255) GC_sched_already_stopped_txt

GC_task_not_found

  public NUMBER GC_task_not_found
Thrown when an attempt is made to change a non existant task

GC_task_not_found_txt

  public VARCHAR2(255) GC_task_not_found_txt

Method Detail

create_task

  public  create_task(i_procedure_name VARCHAR2, 
i_category VARCHAR2 DEFAULT NULL,
i_title VARCHAR2 DEFAULT NULL,
i_full_desc VARCHAR2 DEFAULT NULL,
i_success_email VARCHAR2 DEFAULT NULL,
i_failure_email VARCHAR2 DEFAULT NULL,
o_task_id OUT NUMBER)
Used to create a task ready for scheduling later. One task can therefore be run across multiple schedule entries for flexibility. Does NOT commit.
Parameters:
i_procedure_name - Name of procedure to be executed
i_category - Option category of task. Used purely for reporting/maintenance.
i_title - Task title
i_full_desc - Full task description. Used purely for your info.
i_success_email - Shortcut to call of add_task_email
i_failure_email - Shortcut to call of add_task_email
o_task_id - ID of newly created task

change_task

  public  change_task(i_task_id NUMBER, 
i_procedure_name VARCHAR2 DEFAULT NULL,
i_category VARCHAR2 DEFAULT NULL,
i_title VARCHAR2 DEFAULT NULL,
i_full_desc VARCHAR2 DEFAULT NULL)
Used to change the attributes of a task. Does NOT commit.
Parameters:
i_task_id - ID of task to be changed
i_procedure_name - Name of procedure to be executed
i_category - Option category of task. Used purely for reporting/maintenance.
i_title - Task title
i_full_desc - Full task description. Used purely for your info.

schedule_task

  public  schedule_task(i_task_id NUMBER, 
i_hour VARCHAR2 DEFAULT NULL,
i_min VARCHAR2 DEFAULT NULL,
i_dom NUMBER DEFAULT NULL,
i_month NUMBER DEFAULT NULL,
i_dow VARCHAR2 DEFAULT NULL,
i_dow_first BOOLEAN DEFAULT FALSE,
i_dow_last BOOLEAN DEFAULT FALSE,
i_title VARCHAR2 DEFAULT NULL,
i_sql_trace BOOLEAN DEFAULT FALSE,
i_ora_trace BOOLEAN DEFAULT FALSE,
i_run_stats BOOLEAN DEFAULT TRUE,
i_once_only BOOLEAN DEFAULT FALSE,
i_enabled BOOLEAN DEFAULT TRUE,
o_sched_id OUT NUMBER)
Schedules a task already created using create_task. Does NOT commit.
Parameters:
i_task_id - ID of task being scheduled
i_hour - Option hours of day to run task. Allows comma separated values. e.g "8,12,17" for 8am, 12pm and 5pm.
i_min - Optional minute of current hour to run task. Allows comma seperated values. e.g "0,15,30,45" to run every 15 mins
i_dom - Optional day of month to run task. e.g. "1" for 1st of month Negative numbers wrap backwards from month end e.g. "-1" for last day of month
i_month - Optional month to run task. e.g. "1" for January
i_dow - Optional day of week to run task. e.g. "1,3" to run task on Mondays and Wednesdays
i_dow_first - True if dow value is to only apply to first occurence in month. Optional.
i_dow_last - True if dow value is to only apply to last occurence in month. Optional.
i_title - Title for schedule (sub title to task title)
i_sql_trace - Run the task with sql_trace enabled (true/false).
i_ora_trace - Run the task with oracle trace event 10046 enabled (true/false). This overrides I_sql_trace
i_run_stats - Record session statistics after task is complete
i_once_only - True to make job disable itself after 1st run. Optional.
i_enabled - False to schedule job but not activate it.
o_sched_id - ID of newly scheduled task

reschedule_task

  public  reschedule_task(i_sched_id NUMBER, 
i_hour VARCHAR2 DEFAULT NULL,
i_min VARCHAR2 DEFAULT NULL,
i_dom NUMBER DEFAULT NULL,
i_month NUMBER DEFAULT NULL,
i_dow VARCHAR2 DEFAULT NULL,
i_dow_first BOOLEAN DEFAULT NULL,
i_dow_last BOOLEAN DEFAULT NULL,
i_title VARCHAR2 DEFAULT NULL,
i_sql_trace BOOLEAN DEFAULT NULL,
i_ora_trace BOOLEAN DEFAULT NULL,
i_run_stats BOOLEAN DEFAULT NULL,
i_once_only BOOLEAN DEFAULT NULL,
i_enabled BOOLEAN DEFAULT NULL)
Reschedules a scheduled task Does NOT commit.
Parameters:
i_sched_id - ID of scheduled task
i_hour - Option hours of day to run task. Allows comma separated values. e.g "8,12,17" for 8am, 12pm and 5pm.
i_min - Optional minute of current hour to run task. Allows comma seperated values. e.g "0,15,30,45" to run every 15 mins
i_dom - Optional day of month to run task. e.g. "1" for 1st of month Negative numbers wrap backwards from month end e.g. "-1" for last day of month
i_month - Optional month to run task. e.g. "1" for January
i_dow - Optional day of week to run task. e.g. "1,3" to run task on Mondays and Wednesdays
i_dow_first - True if dow value is to only apply to first occurence in month. Optional.
i_dow_last - True if dow value is to only apply to last occurence in month. Optional.
i_title - Title for schedule (sub title to task title)
i_sql_trace - Run the task with sql_trace enabled (true/false).
i_ora_trace - Run the task with oracle trace event 10046 enabled (true/false). This overrides I_sql_trace
i_run_stats - Record session statistics after task is complete
i_once_only - True to make job disable itself after 1st run. Optional.
i_enabled - False to schedule job but not activate it.

enable_task

  public  enable_task(i_sched_id NUMBER)
Enables a scheduled task Does NOT commit.
Parameters:
i_sched_id - ID of scheduled task

disable_task

  public  disable_task(i_sched_id NUMBER)
Disables a scheduled task Does NOT commit.
Parameters:
i_sched_id - ID of scheduled task

add_task_prm

  public  add_task_prm(i_sched_id NUMBER, 
i_prm_name VARCHAR2,
i_prm_value VARCHAR2)
Adds parameters to a task already scheduled using schedule_task. Done on scheduled tasks rather than unscheduled ones as different inputs may be required for different schedules. Specifically doesn't validate datatypes as procedure may be subject to change, datatypes are checked at runtime. Does NOT commit.
Parameters:
i_sched_id - ID of scheduled task
i_prm_name - Name of input parameter to procedure specified in create_task.
i_prm_value - Value of input parameter

drop_task

  public  drop_task(i_task_id NUMBER)
Drops a task and it's associated schedules
Parameters:
i_task_id - ID of task

drop_schedule

  public  drop_schedule(i_task_id NUMBER, 
i_sched_id NUMBER)
Drops a task's schedule, task is a parameter to verify sched_id
Parameters:
i_task_id - ID of task
i_sched_id - ID of scheduled task

start_scheduler

  public  start_scheduler()
Starts the task scheduler which wakes up every minute and checks for any jobs scheduled for that minute.
Throws:
sched_already_started -

stop_scheduler

  public  stop_scheduler()
Stops the task scheduler
Throws:
sched_already_stopped -

reset_scheduler

  public  reset_scheduler()
Stops the task scheduler if it's running and resets the scheduler so it is sure it isn't running. Just incase things get out of step with each other

task_log_maint

  public  task_log_maint(i_older_than DATE DEFAULT NULL)
Used to maintain the task_logs table.
Parameters:
i_older_than - If NULL then defaults to today-30.

Tascha Task Scheduler