Oracle Data Guard allows database administrators to create a physical standby database to ensure high availability and disaster recovery. However, in certain scenarios, it is necessary to temporarily convert a physical standby database to a snapshot standby database for testing or development purposes. This guide provides step-by-step instructions on how to perform this conversion and revert it back to a physical standby database.
Converting Physical Standby to Snapshot Standby
Run the following queries to check the last received and applied sequence numbers, along with the managed recovery process (MRP) status:
Query 1: Query to check MRP status:
select process,sequence#,status from gv$managed_standby;
Step 2: Cancel Managed Recovery
Cancel the managed recovery process on the standby database:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Verify that the recovery process has stopped:
SELECT process, sequence#, thread#, status, blocks, block#, inst_id FROM gv$managed_standby WHERE process='MRP0';
Step 3: Stop the Standby Database
Check the database configuration:
Stop the standby database:
srvctl stop database -d standby -o immediate
Step 4: Convert to Snapshot Standby
Start the instance in mount mode:
Verify the conversion:
select name, status, instance_name, database_role, open_mode FROM v$database, gv$Instance;
STATUS INSTANCE_NAME DATABASE_ROLE OPEN_MODE
------------ ---------------- ---------------- --------------------
OPEN standby1 SNAPSHOT STANDBY READ WRITE
Start the second instance:
srvctl start instance -d standby -i standby2 -o open
Verify the database status again:
select status, instance_name, database_role, open_mode FROM v$database, gv$Instance;
STATUS INSTANCE_NAME DATABASE_ROLE OPEN_MODE
------------ ---------------- ---------------- --------------------
OPEN standby1 SNAPSHOT STANDBY READ WRITE
OPEN standby2 SNAPSHOT STANDBY READ WRITE
Converting Snapshot Standby Back to Physical Standby
Check the current status of the snapshot standby database:
select status, instance_name, database_role, open_mode FROM v$database, gv$Instance;
STATUS INSTANCE_NAME DATABASE_ROLE OPEN_MODE
------------ ---------------- ---------------- --------------------
OPEN standby1 SNAPSHOT STANDBY READ WRITE
OPEN standby2 SNAPSHOT STANDBY READ WRITE
Step 2: Stop the Database
Stop the snapshot standby database:
srvctl stop database -d standby
Step 3: Start in Mount Mode and Convert to Physical Standby
Start the instance in mount mode:
srvctl start instance -d standby -i standby1 -o mount
Verify that it is in the correct mode:
select status, instance_name, database_role, open_mode FROM v$database, gv$Instance;
Convert back to physical standby:
ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
Step 4: Restart Standby and Resume Recovery:
Start the second standby instance:
srvctl start instance -d standby -i standby2 -o mount
Verify the status:
select status, instance_name, database_role, open_mode FROM v$database, gv$Instance;
Start managed recovery:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Step 5: Verify Standby Synchronization:
select process,sequence#,status from gv$managed_standby;
Comments
Post a Comment