Tuesday, May 3, 2022

How to take a standby database out of a data guard configuration and convert it to a standalone read/write database using the Data Guard Broker

Deactive the Data Guard Broker configuration:
dgmgrl / 
show configuration
# disable log shipping
edit database 'stdb' SET STATE='APPLY-OFF';
disable configuration;
Check if the standby database is opened in READ ONLY WITH APPLY, READ ONLY or MOUNTED mode:
select open_mode from v$database;
If in READ ONLY WITH APPLY or READ ONLY mode, close the database:
 alter database close;
Often, a database that has been opened in READ ONLY mode still have active sessions. In such cases, it may be necessary to shut the database down and open it in mount-mode:
 shutdown immediate
 startup mount
Activate the standby database:
 ALTER DATABASE ACTIVATE STANDBY DATABASE;
Verify that the status of the control file has changed from "STANDBY" to "CURRENT":
 select CONTROLFILE_TYPE from v$database;
 
 CONTROL
 -------
 CURRENT
Open the database:
 
 ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;
 ALTER DATABASE OPEN;
If not done by the broker, reset the value of log_archive_dest_2:
 Alter system set log_archive_dest_2='';
Your database should now be stand alone and out of the data guard configuration.

To avoid errors related to redo shipping, make sure that your old primary no longer is attempting to ship redo log information to the old standby database, which is now out of the data guard configuration.
On the old primary server, set the relevant log_archive_dest_n parameter to DEFER:
 alter system set log_archive_dest_state_2=defer scope=both;

No comments:

Post a Comment