My Oracle Support Banner

PURGE_LOG Job will purge all entries and ignore the setting of LOG_HISTORY (Doc ID 1270854.1)

Last updated on FEBRUARY 03, 2019

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.5 to 12.1.0.2 [Release 10.2 to 12.1]
Information in this document applies to any platform.

Symptoms


In a database version 11.1.0.7  or later versions,
there can be the situation where the automatic purge job (PURGE_LOG)
purge more entries from the scheduler log tables than expected. In that case the setting of log_history
will be ignored by the purge job .

Some generics:
The attribute log_history controls the number of days that log entries for both the job log and
the window log are retained. It helps prevent logs from growing indiscriminately.
Log_history can be set explicit as a global attribute or can be set explicit for a job class.
When not explicit set, then there is a default value of 30 days.


Example how to set the log history for the default_job_class to 5:

BEGIN
DBMS_SCHEDULER.set_attribute (
name => 'DEFAULT_JOB_CLASS',
attribute => 'log_history',
value => 5);
End;
/

-- after executing above command in SqlPlus,check the setting with:
SQL> select job_class_name, log_history from dba_scheduler_job_classes;

JOB_CLASS_NAME LOG_HISTORY
------------------------------ -----------
DEFAULT_JOB_CLASS 5



Example how to set the log history as an global attribute to value 10:

BEGIN
DBMS_SCHEDULER.set_scheduler_attribute (
attribute => 'LOG_HISTORY',
value => 10);
End;
/


-- after executing above command in SqlPlus,check the setting with:

SQL> Select * from dba_scheduler_global_attribute where attribute_name='LOG_HISTORY';

ATTRIBUTE_NAME
------------------------------
VALUE
--------------------------------------------------------------------------------
LOG_HISTORY
10



Note: The setting of the global attribute log_history will be overwritten by the actual
setting of log_history for a job class.
For example:
when the global attribute in dba_scheduler_global_attributes is set to a
value of 10 (10 days), and the log_history for a job class is set to 5 (5days) then the
scheduler log entries will be purged every 5 days  for jobs attached to this job class.



The purge job is a default Oracle job which will be executed per default schedule at 3 am, every day.


Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.
My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.