Oracle RAC Administration and Monitoring Scripts -2
There are lots of options used with SRVCTL command, i mentioned them below.
-d Database Name -i Instance Name -s Service Name -n Node Name -r Preferred list -a Available list -p TAF (Transparent application failover policy) -v Verbose
Status and Config Database
We can check all instance status of database as follows.
srvctl status database -d DB_NAME
[oracle@RAMdbrac01 ~]$ srvctl status database -d RAM Instance RAM1 is running on node RAMdbrac01 Instance RAM2 is running on node RAMdbadm02 Instance RAM3 is running on node RAMdbadm03 Instance RAM4 is running on node RAMdbadm04 [oracle@RAMdbrac01 ~]$
We can display the configurations (instances name, nodes and oracle home) of any RAC Database as follows.
srvctl config database -d DB_NAME srvctl config database -d RAM
Shutdown RAC Database
We can shutdown all instances of any database as follows.
srvctl stop database -d db_name [-o stop_options] srvctl stop database -d DB_NAME srvctl stop database -d DB_NAME -o normal srvctl stop database -d DB_NAME -o immediate srvctl stop database -d DB_NAME -o transactional srvctl stop database -d DB_NAME -o abort
[oracle@RAMdbrac01 ~]$ srvctl stop database -d RAM
Startup RAC Database
We can start all instances of any database as follows.
srvctl start database -d db_name [-o start_options] srvctl start database -d DB_NAME srvctl start database -d DB_NAME -o nomount srvctl start database -d DB_NAME -o mount srvctl start database -d DB_NAME -o open
[oracle@RAMdbrac01 ~]$ srvctl start database -d RAM
Shutdown An Instance
We can shutdown only specific Instance of RAC database as follows.
srvctl stop instance -d db_unique_name [-i "instance_name_list"]} [-o stop_options] [-f] srvctl stop instance -d DB_NAME -i INSTANCE_NAME
[oracle@RAMdbrac01 ~]$ srvctl stop instance -d RAM -i RAM1
Startup and Status An Instance
We can startup only specific Instance(s) of RAC database as follows.
srvctl start instance -d db_unique_name [-i "instance_name_list"} [-o start_options] srvctl start instance -d DB_NAME -i INSTANCE_NAME
[oracle@RAMdbrac01 ~]$ srvctl start instance -d RAM -i RAM1
We can display any instance of RAC database as follows.
srvctl status instance -d DB_NAME -i INSTANCE_NAME
[oracle@RAMdbrac01 ~]$ srvctl status instance -d RAM -i RAM1
Add and Remove Database from CRS
We can add new DB to CRS as follows.
srvctl add database -d db_unique_name -o ORACLE_HOME [-p spfile]
srvctl add database -d RAM -o /u01/app/product/12.1.0.2/dbhome_1 -p +DATAC1/RAM/parameterfile/spfileRAM.ora
We can remove existing DB from CRS as follows.
srvctl remove database -d db_unique_name [-f] [-y] [-v]
srvctl remove database -d DB_NAME -f -y
Stop, Start and Check ASM via SRVCTL
We can shutdown an ASM instance as follows.
srvctl stop asm -n NODE_NAME -o immediate srvctl stop asm -n RAMdbrac01 -o immediate
We can startup an ASM instance as follows.
srvctl start asm -n NODE_NAME srvctl start asm -n RAMdbrac01
We can display configuration and status an ASM instance as follows.
srvctl status asm -n NODE_NAME srvctl config asm -n NODE_NAME
[oracle@RAMdbrac01 ~]$ srvctl status asm -n RAMdbrac01 ASM is running on RAMdbrac01 [oracle@RAMdbrac01 ~]$ [oracle@RAMdbrac01 ~]$ [oracle@RAMdbrac01 ~]$ srvctl config asm -n RAMdbrac01 PRKO-2207 : Warning:-node option has been deprecated and will be ignored. ASM home: <CRS home> Password file: +DBFS_DG/orapwASM ASM listener: LISTENER [oracle@RAMdbrac01 ~]$
Stop, Start and Check Service via SRVCTL
We can start, stop and check any service on Database as follows.
srvctl status service -d db_name srvctl config service -d db_name srvctl start service -d dbname -s service_name srvctl stop service -d dbname -s service_name srvctl add service -d {DB_NAME} -s {SERVICE_NAME} -r {"preferred_list"} -a {"available_list"} [-P {BASIC | NONE | PRECONNECT}] srvctl relocate service -d db_name -s service_name -i instance_name -t new_instance_name [-f]
We can remove any service as follows.
srvctl remove service -d {DB_NAME} -s {SERVICE_NAME} srvctl remove service -d RAM -s RAM_SALES
Enable/disable Autorestart of Instance and Database
We can enable and disable auto restart of the database as follows.
srvctl enable database -d DB_UNIQUE_NAME srvctl disable database -d DB_UNIQUE_NAME
We can enable and disable auto restart of the instance
srvctl enable instance -d DB_UNIQUE_NAME-i INSTANCE_NAME srvctl disable instance -d DB_UNIQUE_NAME-i INSTANCE_NAME
Start, Stop and Check status,configurations of NodeApps
srvctl status nodeapps -n nodename srvctl config nodeapps -n nodename srvctl start nodeapps -n nodename srvctl stop nodeapps -n nodename
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8