Oracle 12c – Deleting Rows from user_scheduler_job_run_details Table

oracleoracle-12c

Oracle Database 12c
Red Hat Linux 7

I want to delete the last 1000 records on the Oracle table user_scheduler_job_run_details because it is getting too large.
How best to delete rows from the Oracle table user_scheduler_job_run_details?
Are any precautions needed?
Is it simply a matter of doing a DELETE FROM … DML statement?
Is there an existing job or procedure that handles this?

Best Answer

You can specify it in days, not number of rows.

DBMS_SCHEDULER.PURGE_LOG

By default, the Scheduler automatically purges all rows in the job log and window log that are older than 30 days. The PURGE_LOG procedure is used to purge additional rows from the job and window log.

log_history

This specifies how much history (in days) to keep. The valid range is 0 - 1000000. If set to 0, no history is kept.

DBMS_SCHEDULER.PURGE_LOG (
   log_history             IN PLS_INTEGER  DEFAULT 0,
   which_log               IN VARCHAR2     DEFAULT 'JOB_AND_WINDOW_LOG',
   job_name                IN VARCHAR2     DEFAULT NULL);