Mir Sayeed Hassan – Oracle Blog

Oracle DBA – Tips & Techniques | Learn with real-time examples

  • Translate

  • It’s Me






  • My Certificates

  • Links

    My Acclaim Certification : Credly Profile
    My Oracle ACE Pro Profile

  • Achievements

    Awarded Top 100 Oracle Blogs from Worldwide - #RANK 39
  • VISITORS COUNT

  • Verified International Academic Qualification from World Education Service (WES)

    Verified International Academic Qualification from World Education Service (WES)

  • Jobs

Failover by using the DGMGRL

Posted by Mir Sayeed Hassan on September 27th, 2017

Failover by using the DGMGRL

On Primary Database

[oracle@pr ~]$ !sq
sqlplus / as sysdba

SQL>  SELECT NAME,DB_UNIQUE_NAME, OPEN_MODE,DATABASE_ROLE FROM V$DATABASE;
NAME      DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE
-------- ------------------------------ -------------------- ----------------
PR        pr                             READ WRITE           PRIMARY

On Standby Database

[oracle@std scripts]$ !sq
sqlplus / as sysdba

SQL> SELECT NAME,DB_UNIQUE_NAME, OPEN_MODE,DATABASE_ROLE FROM V$DATABASE;
NAME      DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE
--------- ------------------------------ -------------------- ----------------
PR        std                            MOUNTED              PHYSICAL STANDBY
SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@std scripts]$ dgmgrl

DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> conn sys/sys
Unrecognized command "conn", try "help"
DGMGRL> connect sys/sys
Connected.
DGMGRL> show configuration

Configuration - PRDG
Protection Mode: MaxPerformance
Databases:
pr  - Primary database
std - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL> show database 'PR';
Object "PR" was not found
DGMGRL> show database 'pr';

Database - pr
Role:            PRIMARY
Intended State:  TRANSPORT-ON
Instance(s):
pr
Database Status:
SUCCESS

Shutdown abort on primay database

SQL> shu abort

ORACLE instance shut down.
On standby database
DGMGRL> failover to 'std'

Performing failover NOW, please wait...
Failover succeeded, new primary is "std"
Check the standby database status
SQL> select status from v$instance;

STATUS
------------
OPEN
SQL> SELECT NAME,DB_UNIQUE_NAME, OPEN_MODE,DATABASE_ROLE FROM V$DATABASE;

NAME      DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE
--------- ------------------------------ -------------------- ----------------
PR        std                            READ WRITE           PRIMARY
[oracle@std scripts]$ dgmgrl

DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/sys
Connected.
DGMGRL> SHOW CONFIGURATION

Configuration - PRDG
Protection Mode: MaxPerformance
Databases:
std - Primary database
pr  - Physical standby database (disabled)
ORA-16661: the standby database needs to be reinstated
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL> show database 'pr'

Database - pr
Role:            PHYSICAL STANDBY
Intended State:  APPLY-ON
Transport Lag:   (unknown)
Apply Lag:       (unknown)
Apply Rate:      (unknown)
Real Time Query: OFF
Instance(s):
pr
Database Status:
ORA-16661: the standby database needs to be reinstated
SQL> SELECT NAME,DB_UNIQUE_NAME, OPEN_MODE,DATABASE_ROLE FROM V$DATABASE;

NAME      DB_UNIQUE_NAME                 OPEN_MODE            DATABASE_ROLE
--------- ----------------------------- -------------------- ----------------
PR        std                            READ WRITE           PRIMARY

========================Hence Tested & Verified in our test env===================