Understanding SRVCTL Commands for Oracle RAC Databases

srvctl a command-line utility that makes it easier to manage RAC resources. In this post, we’ll go over some basic srvctl commands to help you configure, start, stop, and manage your Oracle RAC databases

Configuring the Database

To see the configuration of your RAC database, you can use the following command:

[oracle@discoveryrac1 ~]$ srvctl config database
discover

For more detailed information about a specific database, run:

[oracle@discoveryrac1 ~]$ srvctl config database -d discover

This command will show you important details like:

  • Database unique name: discover
  • Database name: discover
  • Oracle home: /u02/app/oracle/product/21/db_home
  • Database instances: discover1, discover2
  • Configured nodes: discoveryrac1, discoveryrac2

These details help you understand your RAC setup.

Example Command and Output Analysis

Database unique name: discover
Database name: discover
Oracle home: /u02/app/oracle/product/21/db_home
Oracle user: oracle
Spfile: +RECO/DISCOVER/PARAMETERFILE/spfilediscover.ora
Password file: +RECO/DISCOVER/PASSWORD/pwddiscover.257.1181771365
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: FRA,RECO
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: dba
Database instances: discover1,discover2
Configured nodes: discoveryrac1,discoveryrac2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed

Checking Database Status

To check the current status of your database instances, run:

[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is running on node discoveryrac1
Instance discover2 is running on node discoveryrac2

Stopping and Starting the Database

Stop your database by running the command

[oracle@discoveryrac1 ~]$ srvctl stop database -d discover
[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is not running on node discoveryrac1
Instance discover2 is not running on node discoveryrac2

You can manage your database using different stop options.

srvctl stop database -d discover -o normal
srvctl stop database -d discover -o immediate
srvctl stop database -d discover -o transactional
srvctl stop database -d discover -o abort

Start your database by running the command

[oracle@discoveryrac1 ~]$ srvctl start database -d discover
[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is running on node discoveryrac1
Instance discover2 is running on node discoveryrac2

You can manage your database using different start options.

srvctl start database -d discover -o nomount
srvctl start database -d discover -o mount
srvctl start database -d discover -o open

Managing Instances

You can manage individual instances with srvctl. To stop a specific instance, run:

[oracle@discoveryrac1 ~]$ srvctl stop instance -d discover -i discover1
[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is not running on node discoveryrac1
Instance discover2 is running on node discoveryrac2

To start the instance again:

[oracle@discoveryrac1 ~]$ srvctl start instance -d discover -i discover1
[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is running on node discoveryrac1
Instance discover2 is running on node discoveryrac2

Adding and Removing Instances

If you need to remove an instance from your database, follow these steps. For example, to remove the instance on node 2 (discover2), first ensure it is stopped:

[oracle@discoveryrac1 ~]$ srvctl stop instance -d discover -i discover2
[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is running on node discoveryrac1
Instance discover2 is not running on node discoveryrac2

Note:If the instance is still running, you’ll get an error message

[oracle@discoveryrac1 ~]$ srvctl remove instance -d discover -i discover2 
Remove instance from the database discover? (y/[n]) y
PRCD-1052 : Failed to remove instance from database discover
PRCD-1101 : Failed to remove running instance discover2 for database discover

Next, you can remove the instance with:

[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is running on node discoveryrac1
Instance discover2 is not running on node discoveryrac2
[oracle@discoveryrac1 ~]$ srvctl remove instance -d discover -i discover2
Remove instance from the database discover? (y/[n]) y
[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is running on node discoveryrac1

To add an instance to the database,run:

[oracle@discoveryrac1 ~]$ srvctl add instance -d discover -i discover2 -n discoveryrac2
[oracle@discoveryrac1 ~]$ srvctl status database -d discover
Instance discover1 is running on node discoveryrac1
Instance discover2 is not running on node discoveryrac2
[oracle@discoveryrac1 ~]$ srvctl start instance -d discover -i discover2

Alert: The information provided on this website is for educational purposes only. It has been tested internally, but there is no guarantee it will work in every environment. It is strongly recommended to first test the process in a non-production environment, such as a User Acceptance Testing (UAT) setup. This allows you to verify configurations, identify any issues, and ensure a smooth transition to production, minimizing the risk of disruptions in your live environment. Always conduct thorough testing before applying changes to production systems.

I hope you found this blog helpful! We’d love to hear about your experiences or any questions you might have, so please share your thoughts in the comments. Your feedback is greatly appreciated. Stay tuned for more tips and advanced topics on managing Oracle Database!

admin

Welcome to the DBA Discovery Hub! As an OCP, I’m here to share articles, tutorials, and tips on Oracle Database Administration. Let’s connect and explore together! Start exploring!

View All Post

Leave a Reply

Your email address will not be published. Required fields are marked *