How to view the Job running log in Oracle?

To view the running logs of jobs in the Oracle database, follow these steps: 1. Log in to the Oracle database using a system administrator or a user with appropriate permissions. 2. Execute the following command to connect to the Oracle Scheduler management interface:

  SQL> conn sys/password as sysdba;

Check to see if the scheduler program has been enabled. Run the following command:

  SQL> SELECT * FROM dba_scheduler_global_attribute WHERE attribute_name = 'SCHEDULER_ENABLED';

If the returned value is ‘FALSE’, then the scheduler is not enabled. In this case, you need to enable the scheduler in order to view the job run logs. Please note that enabling the scheduler may require restarting the database instance. Before enabling the scheduler, make sure you have backed up the database. 4. If the scheduler is already enabled, execute the following command to create a job class to assign a log table for the job.

  SQL> BEGIN

         DBMS_SCHEDULER.CREATE_JOB_CLASS(

            job_class_name  => 'LOGGING_JOB_CLASS',

            comments        => 'Job logging class');

      END;

      /

Ensure that the log level for the job is set to ‘RUNS’. Run the following command:

  SQL> BEGIN

         DBMS_SCHEDULER.SET_ATTRIBUTE(

            name        => 'JOB_NAME',

            attribute   => 'LOGGING_LEVEL',

            value       => 'RUNS');

      END;

      /

‘JOB_NAME’ is the name of the job for which you want to view the logs. 6. View the job’s execution logs by running the following command.

 SQL> SELECT * FROM dba_scheduler_job_run_details WHERE job_name = 'JOB_NAME' ORDER BY log_date;

The ‘JOB_NAME’ is the name of the job you want to view the logs for. This will return the running logs for that job, sorted by date. Please note that the above steps assume you have the necessary permissions to perform these operations. If you do not have the appropriate permissions, please contact the database administrator or relevant permissions manager for assistance.

bannerAds