srvctl commands is an important tool to manage the Oracle database in the RAC environment and Oracle restarts env(Single node env with ASM). This can be used to stop, start, find status, and other things in the cluster or the server. Let’s review those command
srvctl commands
srvctl is a utility in $ORACLE_HOME/bin and it has various options. You can find all the options using the below command
srvctl -help
This can be used to list databases, config databases, check the status of the database and many others.
srvctl config database
srvctl config database is the command to list all the databases registered in the Oracle RAC cluster or Oracle restart environment. There is no such command as srvctl list databases. It is the srvctl config database command
srvctl config database Example srvctl config database TESTDB TESTDB19
If you want to see the detailed configuration for a particular database, then the command is
srvctl config database -d <db name> -a Example srvctl config database -d TESTDB -a
srvctl start database
srvctl start database is used to start the database. Here is the full command line
srvctl start database -d <db name>
Example
srvctl start database -d TESTDB
srvctl start instance
In the previous command, it will start all the instances of the database, If you want to start a particular instance, then we can use the below command
srvctl start instance -d <db name> -i <instance name> Example srvctl start instance - d TESTDB -i TESTDB1
srvctl stop database
srvctl stop database is used to stop the database. Here is the full command line
srvctl stop database -d <db name> Example srvctl stop database -d TESTDB
It is also possible to use the options for stopping like this
srvctl stop database -d TESTDB -i normal
srvctl stop database -d TESTDB -i abort
srvctl stop database -d TESTDB -immediate
srvctl stop instance
In the previous command, it will stop all the instances of the database, If you want to stop a particular instance, then we can use the below command
srvctl stop instance -d <db name> -i <instance name> Example srvctl stop instance - d TESTDB -i TESTDB1
srvctl status database
srvctl status database is used to check the status of the database. It will show the status of all the instances of an Oracle RAC and the status of an instance of the Non -RAC
srvctl status database -d <db name> Example srvctl status database -d TESTDB
If you want to see more information, you can add -verbose to it
srvctl status database -d <db name> -verbose Example srvctl status database -d TESTDB -verbose
srvctl add database
This command can be used to add a database in the srvctl registry
srvctl add database -d < db unique name> -o <oracle home location> -p <spfile location> -db <db name Example srvcrtl add database -d TESTDG -i /u01/ap/product/db_home1 -p +DATA/TESTDG/parameterfile/spfileTESETDG.ora
srvctl add instance
This command is used to add an instance after adding a database
srvctl add instance -d < db name> -i <instance name> -n <node name> Example srvctl add instance -d TESTDB -i TESTDG1 -i technode1 srvctl add instance -d TESTDB -i TESTDG2 -i technode2
In the case of Non-RAC, we can remove option the node option
srvctl remove database
we can remove the database using the below command
srvctl remove database -d <db name> -f -y Example srvctl remove database -d TESTDG -f -y
srvctl remove instance
If you want to just remove one instance, we can use the below command
srvctl remove instance -d <db name> - i <instance name>
srvctl upgrade database
This command will be helpful for upgrading the Clusterware keys for the DB
Suppose you manually upgraded the database from 12c to 19c and now you want to modify entries in srvctl, then use this command to upgrade in srvctl
You need to run this command from the New Oracle home
srvctl upgrade database -d <db name> - o <old oracle home>
Hope you like this post on srvctl commands
SSH Putty commands : Putty is a widely used tool to connect with a Linux server..Here are 41 Useful SSH Putty commands to help you manage Linux with examples.
oracle Cluster command : This page list down the common oracle Cluster command like srvctl ,oicfg,cluvfy,ocrconfig,crsctl,crs_stats,oclumon clusterware