In our earlier article, we explained how to convert physical standby to snapshot standby manually .

Convert Physical standby to snapshot standby manually(Without DGMGRL)

However in this article, I will explain how can we achieve this using dgmgrl.

To use dgmgrl , make sure dg broker is enabled.Follow below article to implement.

How to set up dataguard broker ( dgmgrl)

1. Make sure flashback is on on standby database.


SQL> show parameter db_recovery

NAME                                 TYPE
------------------------------------ --------------------------------
VALUE
------------------------------
db_recovery_file_dest                string
+FRA
db_recovery_file_dest_size           big integer
200G
SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
NO


SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY WITH APPLY

SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active


SQL> recover managed standby database cancel;
Media recovery complete.
SQL> alter database flashback on;

Database altered.

SQL>  select flashback_on from v$database;

FLASHBACK_ON
------------------
YES


SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

2. Check the configuration:

Check the configuration, if any issues are there, then fix it before proceeding further.



DGMGRL>  show configuration

Configuration - dg_config_mum

  Protection Mode: MaxPerformance
  Members:
  MUM      - Primary database
    MUMDR    - Physical standby database
      Error: ORA-16810: multiple errors or warnings detected for the member


Fast-Start Failover: DISABLED

Configuration Status:
ERROR   (status updated 46 seconds ago)


DGMGRL> validate database MUMDR

  Database Role:     Physical standby database
  Primary Database:  MUM

  Ready for Switchover:  Yes
  Ready for Failover:    Yes (Primary Running)

  Flashback Database Status:
    MUM  :  Off
    MUMDR:  On

  Managed by Clusterware:
    MUM  :  YES
    MUMDR:  YES

DGMGRL> show configuration

Configuration - dg_config_mum

  Protection Mode: MaxPerformance
  Members:
  MUM      - Primary database
    MUMDR    - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 6 seconds ago)

3. Convert physical to snapshot standby.


DGMGRL> convert database MUMDR to snapshot standby;
Converting database "MUMDR" to a Snapshot Standby database, please wait...
Database "MUMDR" converted successfully
DGMGRL> show configuration

Configuration - dg_config_mum

  Protection Mode: MaxPerformance
  Members:
  MUM      - Primary database
    MUMDR    - Snapshot standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 52 seconds ago)




SQL> select open_mode,database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ WRITE           SNAPSHOT STANDBY


Now the database is open in read write mode. So you can do any changes or testing on the database.

Once your activity is done, you can revert it back to physical standby using below command.

4. Convert snapshot to physical standby


DGMGRL> convert database MUMDR to physical standby;
Converting database "MUMDR" to a Physical Standby database, please wait...
Operation requires a connection to database "ne"
Connecting ...
Connected to "MUM"
Connected as SYSDBA.
Oracle Clusterware is restarting database "MUMDR" ...
Connected to "MUMDR"
Connected to "MUMDR"
Continuing to convert database "MUMDR" ...
Database "MUMDR" converted successfully
DGMGRL>




DGMGRL> show configuration;

Configuration - dg_config_mum

  Protection Mode: MaxPerformance
  Members:
  MUM      - Primary database
    MUMDR    - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 4 seconds ago)

DGMGRL>