Viewing Job Details- Automation and Troubleshooting

To view details about how a job is configured, query the DBA_SCHEDULER_JOBS view. This query selects information for the RMAN_BACKUP job:

SQL> select job_name ,last_start_date ,last_run_duration ,next_run_date ,repeat_interval from dba_scheduler_jobs where job_name=’RMAN_BACKUP’;

Each time a job runs, a record of the job execution is logged in the data dictionary. To check the status of a job execution, query the DBA_SCHEDULER_JOB_LOG view. There should be one entry for every time a job has run:

SQL> select job_name ,log_date,operation ,status from dba_scheduler_job_log where job_name=’RMAN_BACKUP’;

Modifying Job Logging History

By default, the Oracle Scheduler keeps 30 days worth of log history. You can modify the default retention period via the SET_SCHEDULER_ATTRIBUTE procedure.

For example, this command changes the default number of days to 15:

SQL> exec dbms_scheduler.set_scheduler_attribute(‘log_history’,15);

To remove the contents of the log history completely, use the PURGE_LOG procedure:

SQL> exec dbms_scheduler.purge_log();

Modifying a Job

You can modify various attributes of a job via the SET_ATTRIBUTE procedure. This example modifies the RMAN_BACKUP job to run weekly, on Mondays:

SQL> begin dbms_scheduler.set_attribute(name=>’rman_backup’ ,attribute=>’repeat_interval’ ,value=>’freq=weekly; byday=mon’); end;

You can verify the change by selecting the REPEAT_INTERVAL column from the DBA_ SCHEDULER_JOBS view. Here is what the REPEAT_INTERVAL column now shows for the RMAN_BACKUP job:

freq=weekly; byday=mon

From the prior output, you can see that the job will run on the next Monday, and because no BYHOUR and BYMINUTE options were specified (when modifying the job), the job is scheduled to run at the default time of 12 a.m.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *