11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

166 CHAPTER 3 ■ DATABASE ADMINISTRATIONThe following example shows how to run a job in the two database roles: the primary databaserole and the logical standby database role. We create two copies of a job and assign differentvalues for the database_role attribute (primary and logical standby) to each of the copies.If you want to run a job in both roles, you can do so by copying the job and then changingthe database_role attribute value to the required value (primary or logical standby) after enablingthe copied job.In the following example, we create a job named test_primary on the primary database. Wethen make a copy of this job and change the database_role attribute value to logical standby.When the primary database becomes a logical standby database, the copied job will run as perthe schedule.begindbms_scheduelr.create_job(job_name => 'test_primary',program_name => 'test_prog',schedule_name => 'test_sched');dbms_scheduler.copy_job('test_primary','test_standby');dbms_scheduler.enable(name=>'test_standby');dbms_scheduler.set_attribute('test_standby','database_role','logical_standby');end;/You can query the DBA_SCHEDULER_JOB_ROLES view to ensure that the job roles areswitched, as shown here:SQL> select job_name,database_rolefrom dba_scheduler_job_roles;JOB_NAMEDATABASE_ROLE------------- ----------------TEST_PRIMARYPRIMARYTEST_STANDBYLOGICAL STANDBYThe query reveals that our primary and standby jobs are assigned the correct job roles.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!