Few and quick steps to open the standby database as primary with failover option. Note that primary is not avialbe 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.
Thanks.
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.
Thanks.
thank you for your informations
ReplyDeleteThank you for the information!
ReplyDeleteI continued to get error even after following the steps here. Had to use manually recreated controlfile to bring up the database.
thank you.!!
ReplyDeleteThanks for sharing your knowledge, it was very useful.
ReplyDeletethanks its working....
ReplyDeleteit was really very helpfull
ReplyDeleteLifesaver, thanks
ReplyDeletethis worked for me. thank you
ReplyDeleteReally help full thankyou
ReplyDeleteworked for me as well
ReplyDeleteThank you for the information.
ReplyDelete