You can use DBMS_SCHEDULER
Scheduler can run jobs based on primary mode in Oracle 11 or higher.
name => 'my_job',
attribute => 'database_role'
PRIMARY - The job runs only when the database is in the role of the primary database.
Better example in E17120-07 under "Examples of Using the Scheduler"
Thank you very much for the reply!
OK, probably a really silly question. I already have multiple jobs running on the primary server. My standby server is of course read only. The jobs that are defined on the PRIMARY server - they are not running on the STANDBY server, correct? What keeps them from running, since the job definitions/schedules defined on the primary are propogated over to the standby? The fact that the standby is in read only mode and the jobs are generally doing something (ie updating/inserting/etc.)?
Also, if the standby became the primary, would I have to do anything, since the jobs are already defined?
(I think I've been under the assumption that in order for the jobs to run, the Enterprise Manager Windows Service must be up. That is the case for the backup jobs, but for other jobs that are updating/inserting/whatever, apparently not? I know that the the EM is a GUI for CREATING jobs. I am just not sure if the EM must be up and running for the jobs to actually RUN.)
Thank you again
Correct. They will only run in Primary Mode. The "SET_ATTRIBUTE" of "DBMS_SCHEDULER" handles it if set to "PRIMARY".
So if you do a switchover or failover the mode of the database changes and your jobs are handled.
Jobs in EM are not the same as this. DBMS_SCHEDULER is stored inside each database.
There's a DBMS_SCHEDULER forum here too with tons of information.
It makes sense now. When I've cloned databases, the jobs are in the cloned databases, but I do have to recreate the backups.
Have a great day!