Testing is an essential part of any migration project of your Oracle Database. With Zero Downtime Migration (ZDM) and the Physical Online method it has become a lot easier. Before going live (i.e. doing the Data Guard switchover) you can test on your production data on your future production system – the OCI database. That’s cool.
Concept
For the duration of your test convert the OCI target database into a snapshot standby database. A short recap on snapshot standby database:
- A snapshot standby database is a type of updatable standby database that provides full data protection for a primary database.
- A snapshot standby database receives and archives, but does not apply, redo data from its primary database. Redo data received from the primary database is applied when a snapshot standby database is converted back into a physical standby database, after discarding all local updates to the snapshot standby database.
- A snapshot standby database diverges from its primary database over time because redo data from the primary database is not applied as it is received. Local updates to the snapshot standby database cause additional divergence. The data in the primary database is fully protected however, because a snapshot standby can be converted back into a physical standby database at any time, and the redo data received from the primary is then applied.
The plan is:
- Build the standby database in OCI.
- Migration is currently paused at ZDM_CONFIGURE_DG_SRC (
-pauseafter ZDM_CONFIGURE_DG_SRC
). - Convert the OCI target database – which is a physical standby – into a snapshot standby.
- Do your test. Do whatever you want. The database is protected by Flashback Database, so you can insert and delete data, truncate, add tablespaces, you name it.
- When you are done with your tests, convert the OCI target database back into a physical standby database. Implicitly, the database is flashed back, and now the redo is getting applied again.
- After a little while the target database is now back in sync again.
- Complete migration at your will.
How
You find the steps needed to conver to snapshot standby and back again below. You can repeat the process as many times as you want.
Manual
To convert the standby database to snapshot standby:
alter database recover managed standby database cancel;
shutdown immediate
startup mount
alter database convert to snapshot standby;
alter database open;
Now, the database is opened in READ WRITE mode and you can use it for testing. To convert back to a physical standby database:
shutdown immediate
startup mount
alter database convert to physical standby;
shutdown immediate
startup
alter database recover managed standby database disconnect from session;
Manual on RAC
To convert the standby database to snapshot standby:
sqlplus / as sysdba <<EOF
alter database recover managed standby database cancel;
EOF
srvctl stop database -d $ORACLE_UNQNAME
srvctl start database -d $ORACLE_UNQNAME -o mount
sqlplus / as sysdba <<EOF
alter database convert to snapshot standby;
alter database open;
EOF
Now, the database is opened in READ WRITE mode and you can use it for testing. The database is only opened on one node. You can open the other nodes by executing the following on each of the nodes:
alter database open;
To convert back to a physical standby database:
srvctl stop database -d $ORACLE_UNQNAME
sqlplus / as sysdba <<EOF
startup mount
alter database convert to physical standby;
shutdown immediate
EOF
srvctl start database -d $ORACLE_UNQNAME
sqlplus / as sysdba <<EOF
alter database recover managed standby database disconnect from session;
EOF
Data Guard Broker
To convert the standby database to a snapshot standby database using broker (CDB19_fra3zt is the target DB_UNIQUE_NAME
):
convert database 'CDB19_fra3zt' to snapshot standby;
Now, the database is opened in READ WRITE mode and you can use it for testing. To convert back to a physical standby database:
convert database 'CDB19_fra3zt' to physical standby;
Conclusion
One of the really cool features of ZDM is that you can use my standby database for testing in OCI – before I decide to do the switchover. You can achieve this by converting to a snapshot standby database.
Finally, a thank you to my colleague Jose Bennani Pareja for helping out with RAC database information.
Other Blog Posts in This Series
- Introduction
- Install And Configure ZDM
- Physical Online Migration
- Physical Online Migration to DBCS
- Physical Online Migration to ExaCS
- Physical Online Migration and Testing
- Physical Online Migration of Very Large Databases
- Logical Online Migration
- Logical Online Migration to DBCS
- Logical Offline Migration to Autonomous Database
- Logical Online Migration and Testing
- Logical Online Migration of Very Large Databases
- Logical Online and Sequences
- Logical Offline Migration How To Minimize Downtime
- Logical Migration and Statistics
- Logical Migration and the Final Touches
- Create GoldenGate Hub
- Monitor GoldenGate Replication
- The Pro Tips