Physical Standby Switchover_status Showing Not Allowed

状态列表:

In Oracle documentation explain SWITCHOVER_STATUS column of v$database can have the following values:

NOT ALLOWED – Either this is a standby database and the primary database has not been switched first, or this is a primary database and there are no standby databases.

SESSIONS ACTIVE – Indicates that there are active SQL sessions attached to the primary or standby database that need to be disconnected before the switchover operation is permitted.

SWITCHOVER PENDING – This is a standby database and the primary database switchover request has been received but not processed.

SWITCHOVER LATENT – The switchover was in pending mode, but did not complete and went back to the primary database.

TO PRIMARY – This is a standby database, with no active sessions, that is allowed to switch over to a primary database.

TO STANDBY – This is a primary database, with no active sessions, that is allowed to switch over to a standby database.

RECOVERY NEEDED – This is a standby database that has not received the switchover request.

解决:

SQL>  select name,database_role,switchover_status from v$database;

NAME                        DATABASE_ROLE                                    SWITCHOVER_STATUS
--------------------------- ------------------------------------------------ ------------------------------------------------------------
MTXDB                       PHYSICAL STANDBY                                 NOT ALLOWED

SQL>  select PROCESS, STATUS, GROUP#, SEQUENCE#, BLOCK#, BLOCKS from v$managed_standby;

PROCESS                     STATUS                               GROUP#                                                                                                                    SEQUENCE#     BLOCK#     BLOCKS
--------------------------- ------------------------------------ ------------------------------------------------------------------------------------------------------------------------ ---------- ---------- ----------
ARCH                        CONNECTED                            N/A                                                                                                                               0          0          0
DGRD                        ALLOCATED                            N/A                                                                                                                               0          0          0
DGRD                        ALLOCATED                            N/A                                                                                                                               0          0          0
ARCH                        CONNECTED                            N/A                                                                                                                               0          0          0
ARCH                        CONNECTED                            N/A                                                                                                                               0          0          0
ARCH                        CONNECTED                            N/A                                                                                                                               0          0          0
MRP0                        APPLYING_LOG                         N/A                                                                                                                              57       2346     409600
RFS                         IDLE                                 N/A                                                                                                                               0          0          0
RFS                         IDLE                                 2                                                                                                                                57       2346          1

9 rows selected.

SQL> select database_role,switchover_status from v$database;

DATABASE_ROLE                                    SWITCHOVER_STATUS
------------------------------------------------ ------------------------------------------------------------
PHYSICAL STANDBY                                 NOT ALLOWED

SQL> alter database recover managed standby database finish force;

Database altered.

SQL> select database_role,switchover_status from v$database;

DATABASE_ROLE                                    SWITCHOVER_STATUS
------------------------------------------------ ------------------------------------------------------------
PHYSICAL STANDBY                                 TO PRIMARY

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 2466250400 bytes
Fixed Size                  9137824 bytes
Variable Size             536870912 bytes
Database Buffers         1912602624 bytes
Redo Buffers                7639040 bytes
Database mounted.
Database opened.
SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL> select database_role,switchover_status from v$database;

DATABASE_ROLE                                    SWITCHOVER_STATUS
------------------------------------------------ ------------------------------------------------------------
PHYSICAL STANDBY                                 TO PRIMARY

 产生DataGuard ora-16157故障:

关于这个问题,oracle 官方的回答是要重装DG,考虑实际情况,alter database recover managed standby database finish force 之后,系统没有更改,只需要在nomount 备库之后,在主库产生standby backup control file,然后在备机用些控制文件加载就可以了,测试通过.

在主库

SQL> alter system archive log current;

System altered.

SQL> alter system checkpoint;

System altered.

SQL> SELECT UNIQUE THREAD#, MAX(SEQUENCE#) OVER(PARTITION BY THREAD#) LAST FROM v$archived_log;

   THREAD#       LAST
---------- ----------
         1         66
SQL> ALTER DATABASE CREATE standby CONTROLFILE AS '/tmp/controlfs01.ctl';

 Database altered.

--scp到备库
 

在备库:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
原文地址:https://www.cnblogs.com/tingxin/p/13200857.html