If a database server is to reboot or restart, it is desirable to have the Oracle databases and listener automatically restart with the server.
This process used to be part of a parameter in the /etc/oratab file for the database to automatically restart.
It would be called in the dbstart and dbshut commands and was Y for restart N for manual intervention.
Now there is Oracle Restart, and it is especially useful for a multicomponent environment with RAC and ASM but is simple to add databases as part of the restart.
When the database is created using dbca, the database is added to the Oracle Restart configuration.
The same is true when you remove the database using dbca: the database is removed from Oracle Restart.
If you use Oracle Net Configuration Assistant (netca) to create or delete a listener, netca will add or remove from Oracle Restart.
There are a few ways to add a database and listener to Oracle Restart if using a different method from dbca, either scripted or manual with creatdb steps.
With the database software install, there is a version of Enterprise Manager Database Control that can only add databases and listeners to the Oracle Restart configuration.
The srvctl utility will allow for adding, modifying, and deleting databases and listeners with the commands.
The commands can become part of the scripted creation of databases, so this task becomes part of the steps and not a manual task that is done afterward.
For the listener, the GRID_HOME or ORACLE_HOME needs to be set, depending on if the listener is started in the GRID or ORACLE_HOME.
The default listener is added with the following:
$ cd $GRID_HOME/bin
$ ./ srvctl add listener
To add another listener, the name of the listener would be provided. To add a database, do this:
$ cd $ORACLE_HOME/bin
$ ./ srvctl add service -d db23c -o /u01/app/oracle/product/23.1.0/db_1
• -o is the ORACLE_HOME directory.
• -d is the database name.
To remove a database, use this:
$ srvctl remove database -d db23c
A service can also be disabled to still be available but not run with the automatic restart. To disable or enable a database, do this:
$ srvctl disable database -d db23c
The srvctl utility is part of the Oracle software and available in the ORACLE_HOME, so the grid infrastructure does not need to be installed to use this method for adding databases and services to Oracle Restart. Oracle Restart will make sure that the databases are automatically restarted with a server restart as long as they are enabled in the restart configuration.
Leave a Reply