Oracle snapshot standby数据库的scheduler jobs不执行(2)

Applies to:
Oracle Server - Enterprise Edition - Version: 11.1.0.6 to 11.2.0.2 - Release: 11.1 to 11.2
Information in this document applies to any platform.
Symptoms
Scenario:

1) Dataguard 11g with logical standby database

2) Customer implemented DBMS_SCHEDULER  as SYS on both primary and standby site.
The job is listed in DBA_SCHEDULER_JOBS on primary/standby before a switchover/failover-action.

3) Customer performed dataguard switchover.

4) After the switchover the job is gone from view DBA_SCHEDULER_JOBS on NEW primary site,
however the job is visible in DBA_OBJECTS.

Since the job is still available in dba_objects recreating or dropping the job fails with:


ORA-27477: "SYS.MON_TMP_UNDO_JOB" already exists.

Changes
After upgrade from 10g to 11g  the jobs doesn't work anymore on the new primary in case of a switchover/failover.
This worked fine in 10g.
Cause
A new attribute is introduced in 11g DBMS_SCHEDULER called "DATABASE_ROLE".

Solution

In an Oracle 11g Data Guard environment you have to define the database role ('PRIMARY' or 'LOGICAL STANDBY') in the DBMS_SCHEDULER package.


SQL> select job_name,database_role,enabled from dba_scheduler_job_roles;

dbms_scheduler.set_attribute(name=>'xxxx',
attribute=>'DATABASE_ROLE',value=>'LOGICAL STANDBY');


For more details please see

Oracle? Data Guard, Concepts and Administration, 11g Release 2 (11.2)
Appendix C.8.2: Unsupported PL/SQL Supplied Packages

and

Oracle Database, PL/SQL Packages and Types Reference, 11g Release 2 (11.2)
Chapter 128: DBMS_SCHEDULER

and

Oracle? Database Administrator's Guide, 11g Release 2 (11.2)
Scheduler Support for Oracle Data Guard

#########################################################################################
    Scheduler Job on a Snapshot Standby database does not exist in DBA_SCHEDULER_JOBS while its logs exist in DBA_SCHEDULER_JOB_RUN_DETAILS (文档 ID 1551817.1)   

In this Document
    Symptoms
    Cause
    Solution
    References


Applies to:
Oracle Database - Enterprise Edition - Version 11.2.0.3 and later
Information in this document applies to any platform.
Symptoms

+ Oracle Database 11.2.0.3 (without fix of Bug 13399711).

+ On a Snapshot Standby database, a scheduler job record is not shown in DBA_SCHEDULER_JOBS view when its logs exist in DBA_SCHEDULER_JOB_RUN_DETAILS view.

+ Health Check reports zero potential errors on this instance.

+ There is an entry for this concerned job in OBJ$ & SCHEDULER$_JOB. However, no record is shown up in DBA_SCHEDULER_JOBS view.

+ Recreating this job errors out with ORA-27477 error (claiming that job already exists) as it actually exists in OBJ$ & SCHEDULER$_JOB.

+ Dropping this scheduler job or setting its DATABASE_ROLE to LOGICAL STANDBY errors out with ORA-27476 error claiming that it does not exist as it does not show up in DBA_SCHEDULER_JOBS view.

+ When trying to set the database_role of the job to SNAPSHOT STANDBY, the following error is reported:
SQL> exec DBMS_SCHEDULER.SET_ATTRIBUTE('&scheduler_job_owner.&scheduler_job_name','database_role','SNAPSHOT STANDBY');
BEGIN  DBMS_SCHEDULER.SET_ATTRIBUTE('&scheduler_job_owner.&scheduler_job_name','database_role','SNAPSHOT STANDBY'); END;
*
ERROR at line 1:
ORA-16612: string value too long for attribute "database_role"
ORA-06512: at "SYS.DBMS_ISCHED", line 4478
ORA-06512: at "SYS.DBMS_SCHEDULER", line 2862
ORA-06512: at line 1

+ As a result, the scheduler job no longer runs on this standby database.
Cause

Bug 16217211 was created particularly for this problem.

The job was not shown in DBA_SCHEDULER_JOBS view because of the fact that it was filtered out due to the fact that DATABASE_ROLE of the scheduler job was set to PRIMARY while DATABASE_ROLE of the instance was set to SNAPSHOT STANDBY. Hence, the scheduler job will be executed on this instance if and only if the instance turns to be PRIMARY.
For a record to appear in DBA_SCHEDULER_JOBS view, the DATABASE_ROLE of both the scheduler job and the instance must match.


 
Solution

1) Please apply Patch 13399711 on the culprit snapshot standby database. This patch is available on top of 11.2.0.3 for Linux x86-64. This patch fixes the ORA-16612 error that is reported when trying to set the DATABASE_ROLE of the scheduler job to SNAPSHOT STANDBY to match that of the instance.


2) Then, kindly execute the following:

# sqlplus / as sysdba
set line 150

select DBID, NAME, DATABASE_ROLE from V$DATABASE;
select * from DBA_SCHEDULER_JOBS where OWNER='&scheduler_job_owner' and JOB_NAME='&scheduler_job_name';

set serveroutput on

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/7e19b6d5f69eaeb0ad3959c21e2697fa.html