There're two sections that you have to configure in order to automatically start a RAC database after system reboots.
A. RAC Level
You have to make sure the startup policy is AUTOMATIC, not MANUAL.
[oracle@primary01 ~]$ srvctl config database -d orcl
...
Management policy: AUTOMATIC
If the management policy of the database was set as MANUAL, you can revert it back to AUTOMATIC by the following command:
[oracle@primary01 ~]$ srvctl modify database -d orcl -y automatic
Changing the management policy of the database from MANUAL to AUTOMATIC will also change AUTO_START of the database resource to RESTORE, not ALWAYS.
So next, let's see how we change AUTO_START to ALWAYS at grid-level.
B. Grid Level
After installing grid infrastructure, you will have Oracle Clusterware, also called Cluster Ready Service, CRS controls all Oracle cluster components as resources, and manages the dependencies among resources, so it can coordinate their start and stop priority.
Restarting a database server will bring CRS up (ohasd), once CRS is up, CRS will arrange the resources to start according to the planned configuration.
AUTO_START
We should make sure AUTO_START = ALWAYS of the database resource. In this case, ora.orcl.db is related to database, it can be planned the target state to ONLINE or OFFLINE by setting an attribute of AUTO_START. There are three options of AUTO_START:
- always: starts the resource ONLINE automatically after the node server restart.
- restore: remains the resource state as same as when the node server was shutdown, which means, if it was ONLINE/OFFLINE, then restarts the resource as ONLINE/OFFLINE.
- never: does not restart the resource after node server restart.
Now, let's check the current configuration of ora.orcl.db:
[grid@primary01 ~]$ crsctl status resource ora.orcl.db -p | grep AUTO_START
AUTO_START=restore
If you want to start database automatically every time the server restart, you can set AUTOMATIC to ALWAYS:
[grid@primary01 ~]$ crsctl modify resource ora.orcl.db -attr AUTO_START=always
[grid@primary01 ~]$ crsctl status resource ora.orcl.db -p | grep AUTO_START
AUTO_START=always
For 12.1.0.2 or later, you might see CRS-4995.
In my opinion, the option "restore" of AUTO_START is more reasonable for DBA to consider, here are my reasons:
- Sometimes server restart is for maintenance works or unplanned operations, these works need DBA's interventions to select a proper state to startup. In such case, you don't want to start database to start option.
- If the server restart is a planned restart, then keeping the state of the database will be more efficient.
To test the result, you may stop the database before a system reboot.
[oracle@primary01 ~]$ srvctl stop database -d orcl
Even though you shutdown the RAC database, it startup automatically after system reboot.
To revert the process, you may disable RAC databases to automatically restart.