ORA-01666: control file is for a standby database – failover over standby as primary

Few and quick steps to open the standby database as primary with
failover option. Note that primary is not available to switch over.
Dataguad broker not configured.

Quick round-up:

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

NAME      OPEN_MODE            DATABASE_ROLE
——— ——————– —————-
PROD     READ ONLY            PHYSICAL STANDBY

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

Total System Global Area 3.4206E+10 bytes
Fixed Size                  2238616 bytes
Variable Size            3422553960 bytes
Database Buffers         3.0736E+10 bytes
Redo Buffers               45682688 bytes
Database mounted.
SQL>

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01666: control file is for a standby database

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

NAME      OPEN_MODE            DATABASE_ROLE
——— ——————– —————-
PROD     MOUNTED              PHYSICAL STANDBY

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

SQL>
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Database altered.

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY
*
ERROR at line 1:
ORA-16139: media recovery required

— Fail-over

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

Database altered.
SQL> ALTER DATABASE ACTIVATE STANDBY DATABASE;

Database altered.

SQL>

— Now verify the database status

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

NAME      OPEN_MODE            DATABASE_ROLE
——— ——————– —————-
PROD      MOUNTED              PRIMARY

— Now open the database

SQL> alter database open;

Database altered.

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

NAME      OPEN_MODE            DATABASE_ROLE
——— ——————– —————-
PROD      READ WRITE           PRIMARY

— If you have flashback on, make it off if you want.

SQL> alter database flashback off;

Database altered.

  • October 3, 2018 | 16 views
  • Comments