Thursday, September 10, 2009

dbms_scheduler job class

# To fix a dbms_scheduler job to run on a specific RAC instance, use a job class to specify the service.

# check where the job is running.
select log_date, owner, job_name, instance_id from dba_scheduler_job_run_details
where job_name = 'QL_PH_EMAIL_TO_PERSON' and log_date > sysdate -1/24
order by log_date;

# create the job class
exec DBMS_SCHEDULER.create_job_class(job_class_name => 'PROD_SGE_CLASS', service => 'PROD_SGE');

# associate the job with the class
exec dbms_scheduler.set_attribute(name => 'QL_PH_EMAIL_TO_PERSON', attribute => 'JOB_CLASS', value => 'SYS.PROD_SGE_CLASS');