Srvctl Start Database Mount Standby
In some cases, you would like to change the default startup option of srvctl other than OPEN, for example, after duplicating a standby database, it needs to go to MOUNT state to prevent users from accessing.
For convenience, you can set the default open option to mount. Then, every time you restart your standby database, it will go to MOUNT state as you wish. No need to add start option -o mount.
Let's see the current config of the standby database in srvctl:
$ srvctl config database -d compdb
Database unique name: compdb
Database name: compdb
Oracle home: /u01/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +DATA/compdb/spfilestandb.ora
Domain: example.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: compdb
Database instances: standb1,standb2
Disk Groups: DATA
Services:
Database is administrator managed
You can see the Database role is PRIMARY and Start option is OPEN, if you restart the host, the standby db will go to READ ONLY WITH APPLY automatically like the following:
$ sqlplus / as sysdba
SQL> select open_mode, database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY
We need to fix the problem.
Solution
The solution is to change the startup options of the standby database in cluster.
srvctl modify database startup options
Next, let's do srvctl modify database, the configuration:
$ srvctl modify database -d compdb -s mount
Moreover, we can change its role to physical standby as well.
$ srvctl modify database -d compdb -s mount -r PHYSICAL_STANDBY
If you plan to use active data guard, you can set the default startup option to READ ONLY.
$ srvctl modify database -d compdb -s "read only" -r PHYSICAL_STANDBY
In fact, there're more startup options can be used for configuring a RAC database.
Sometimes, you may be confused about options in short form, so I list their long form as below.
Short Form | Long Form |
---|---|
-d | -db |
-s | -startoption |
-r | -role |
Review the configuration:
$ srvctl config database -d compdb
Database unique name: compdb
Database name: compdb
Oracle home: /u01/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +DATA/compdb/spfilestandb.ora
Domain: example.com
Start options: mount
Stop options: immediate
Database role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
Server pools: compdb
Database instances: standb1,standb2
Disk Groups: DATA
Services:
Database is administrator managed
That's our expected configuration.
Please note that, even though we have set the default startup option, we can still start the database to various state. For example, srvctl start database mount or srvctl start database read only.