Oracle: prevent Active DataGuard from being used
Using a standby database is a good way to increase availability and redundancy to an Oracle database. Switching over the database to another host and/or data center also helps to decrease outages for patching.
Best practise for a database installation is to always have Grid Infrastructure (GI) installed. Sure - it needs more disk space and also patching components, but it also helps us when switching over: it starts database using the right role - either PRIMARY or PHYSICAL_STANDBY.
But there are still some Oracle installations without GI. They use some custom scripts to start the database(s), mostly from within systemd.
Stopping databases on these systems is quite easy:
# dbshut $ORACLE_HOMEdbshut goes through /etc/oratab and stopps all databases and listener(s).
Starting them is also easy:
# dbstart $ORACLE_HOMEOn a primary site, this is quite ok. But on a standby site, databases are started in OPEN mode, which leads to a standby database using Active DataGuard. You can check it like this:
SQL> select OPEN_MODE from v$database;READ ONLY WITH APPLYBut you can use an underscore parameter to prevent the standby database from being opened using Active DataGuard:
SQL> alter system set "_query_on_physical"=FALSE scope=spfile sid='*';As it's not a dynamic parameter, you have to restart the database for this.
After starting the database using dbstart $ORACLE_HOME, the database will started going through NOMOUNT and MOUNT state. It will also try top open, but since the parameter is set, OPEN mode will prevented.