Purge policies allow the scheduling service to remove completed jobs according to specified criteria.
For example, a purge policy might specify the retention of all Java type job requests using a particular job definition submitted executed by a given application for three days. Another purge policy might retain a particular type of job request, say, all SQL job requests in a successful state, for only one day. You can also specify the frequency at which the purge policy is to run.
This section contains the following topics:
A purge policy determines which job requests are to be purged and which retained. Defining a purge policy involves:
Selecting the jobs to be purged: Selection criteria include the related application or product, a particular job definition or job type, the job submitter or a maximum number of requests.
Specifying retention criteria: Decide how long job requests are to be retained depending on their status.
Specifying purge frequency: Decide how often you want the purge policy to run.
Note:
After a purge policy has run, it is necessary to physically delete purged job requests from the database. For more information, see Physically Purging Job Requests from the Database.
To set up a new purge policy:
Job request data is kept in the Oracle Enterprise Scheduler run-time store as records in the run-time store tables. These job requests records are kept in the run-time store until they are physically purged by a database administrator using SQL purge scripts. You must logically delete a job request before physically purging it.
Use the method esspurge.purge_requests
on the Oracle Enterprise Scheduler schema to delete purged job requests from the database. In an Oracle Fusion Applications environment, the schema is typically called FUSION_ORA_ESS
.
The ESSPURGE
package contains a stored procedure which you can use to purge completed job requests. The package is normally loaded when the Oracle Enterprise Scheduler schema is created or updated. The stored procedure is shown in Example 4-1.
The basic syntax of esspurge.purge_requests
is shown in Example 4-2, where FUSION_ORA_ESS
is the name of the Oracle Enterprise Scheduler schema and password
is the password.
Additional examples are shown in the following list.
To purge job requests completed earlier than the current time, at a maximum of 50000 job requests, execute the following command:
execute esspurge.purge_requests(systimestamp, 50000);
To purge job requests completed 30 days earlier, at a maximum of 50000 job requests, execute the following command:
execute esspurge.purge_requests(systimestamp - 30, 50000);
To purge job requests that completed before June 01, 2010 at 15:00:00 (UTC), at a maximum of 50000 job requests, execute the following command:
execute esspurge.purge_requests(TIMESTAMP '2010-06-01 15:00:00 -00:00', 50000);
Example 4-1 ESSPURGE Stored Procedure for Purging Completed Job Requests
--- Purges job requests that have completed. --- --- p_older_than : Purge only job requests that have completed after this time. --- p_max_count : The maximum number of job requests to purge. --- p_max_runtime : The maximum time, in minutes, the purge should run. --- If null (default), this defaults to one day which effectively means --- there is no time limit. --- procedure purge_requests ( p_older_than in timestamp, p_max_count in number, p_max_runtime integer default null );
Example 4-2 Purging Job Requests from the Database
sqlplus FUSION_ORA_ESS/password set serveroutput on size unlimited set timing on execute esspurge.purge_requests(systimestamp, 1000000);
You can view all purge policies defined for the scheduling service.
To display purge policies for the scheduling service:
You can edit the request or retention criteria of an existing purge policy, as well as the purge policy schedule as long as the purge policy is not in the "Succeeded" or "Cancelled" state.
To update a purge policy:
You can delete a given purge policy as long as it is not in the "Wait" or "Hold" state.
To delete a purge policy: