Pages

Thursday, 5 September 2019

ORA-16139 Physical standby with a switchover status of “NOT ALLOWED”

ORA-16139 Physical standby with a switchover status of “NOT ALLOWED”

The status on the standby (being switched to a primary) was as follows:

SQL> SELECT database_role, switchover_status FROM v$database;

DATABASE_ROLE    SWITCHOVER_STATUS
PHYSICAL STANDBY NOT ALLOWED

The alert log indicated that not all logs had been applied to this standby before it was converted to a primary:


Switchover: Media recovery required - standby not in limbo
ORA-16139 signalled during: ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN...
At this point we brought up the database as a standby with the below commands:

SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

SQL> alter database recover managed standby database finish force;

This caused the last archive logs from the primary to be applied and the following to be displayed in the alert log:

Attempt to do a Terminal Recovery
Media Recovery Start: Managed Standby Recovery

Attempt to set limbo arscn 0:115809474 irscn 0:115809474
Completed: alter database recover managed standby database finish force
After the above, we issued:

SQL> alter database commit to switchover to primary with session shutdown;

And the alert log indicated that it was successful:

SQL>  alter database commit to switchover to primary with session shutdown

SQL> ALTER DATABASE SWITCHOVER TO PRIMARY

Switchover: Complete - Database mounted as primary
Completed: alter database commit to switchover to primary with session shutdown
At this point the database was in the below mode and switchover status:

SQL> SELECT open_mode, database_role, switchover_status FROM v$database;

OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
MOUNTED              PRIMARY          NOT ALLOWED
We then enabled the log_archive_dest_state_2 as this was now the primary and issued the below commands:

SQL> shutdown immediate;

SQL>  startup;
The database was now in the below mode and switchover status:

SQL> SELECT open_mode, database_role, switchover_status FROM v$database;

OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
READ WRITE           PRIMARY          RESOLVABLE GAP
After a couple of minutes, the status changed to:

SQL> SELECT open_mode, database_role, switchover_status FROM v$database;

OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
READ WRITE           PRIMARY          SESSIONS ACTIVE
The standby status was as follows:

SQL> SELECT open_mode, database_role, switchover_status FROM v$database;

OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
MOUNTED              PHYSICAL STANDBY NOT ALLOWED

This is an expected status as per “Physical Standby Switchover_status Showing Not Allowed. (Doc ID 1392763.1)”. After the command to switch roles is issued on the primary, the primary will generate a special marker called EOR (end-of-redo) that is placed in the header of online redo log sequence. So this online redo log sequence will be archived locally and sent to all standby databases. Only upon receiving and applying EOR (end-of-redo), v$database.switchover_status will change from “not allowed” to “to primary” or “sessions active”.

No comments:

Post a Comment