Tuesday, October 20, 2015

Oracle: Finding the value for "log_history" in DBMS_SCHEDULER

In Oracle, The "log_history" attribute in DBMS_SCHEDULER is used to specify the number of days  of log history to keep.
The default value of this attribute is 30 days. Scheduler purges the logs (job logs and windows logs) which are older than "log_history" number of days, once per day.

Execute following anonymous block in sqlplus to find the current value of 'log_history" attribute.

set serveroutput on
DECLARE
  val VARCHAR2(100);
BEGIN
  dbms_scheduler.get_scheduler_attribute('log_history', val);
  dbms_output.put_line(val);
END;
/

To change the "log_history" value, you can use
dbms_scheduler.set_scheduler_attribute('log_history','40');