Skip to main content

Mastering Oracle RAC with SRVCTL Commands

Oracle Real Application Clusters (RAC) provide high availability, scalability, and manageability for databases. One of the most powerful tools for managing RAC databases is srvctl, a command-line utility that allows administrators to control various database services. This blog explores essential srvctl commands to help you efficiently manage Oracle RAC environments.


1. Checking Database Configuration and Status

  •  List all available databases on the host:
                 srvctl config database
  •  Check the status of a specific database and its instances:  
                 srvctl status database -d <database_name>
  •  Retrieve detailed status information about a database, including its instances and states: 
                 srvctl status database -d <database_name> -v

2. Stopping and Starting Databases

    Oracle RAC databases can be stopped and started in different modes depending on maintenance requirements.

Stopping the Database

  • Stop the database on all RAC nodes:
               srvctl stop database -d <database_name>
  • Stopping the database using different modes:

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

Starting the Database

  • Start the database across all nodes:

            srvctl start database -d <database_name>

  • Starting the database in different states:
            srvctl start database -d PRODB -o nomount
            srvctl start database -d PRODB -o mount
            srvctl start database -d PRODB -o open

3. Managing Database Instances

Administrators can manage individual database instances using the following commands:

  • Start a specific instance:
             srvctl start instance -d <database_name> -i <instance_name>

  • Stop a specific instance:
             srvctl stop instance -d <database_name> -i <instance_name>

4. Adding and Modifying Database Configurations

  • Adding a database to cluster services:
            srvctl add database -d <database_name> -o /path/to/oracle_home
  • Adding a new instance to the cluster: 

            srvctl add instance -d <database_name> -i <instance_name> -n <node_name>

  • Modify database configuration (SPFILE, disk groups):
           srvctl modify database -db <database_name> -dbname <database_name> -spfile +ASM/Spfile_location -diskgroup "ASM01,ASM02"

5. Checking Cluster and ASM Configuration

  • Display complete Oracle Clusterware configuration details:
            srvctl config all
  • Check ASM configuration details:
            srvctl status asm -detail

6. Managing Listeners and VIPs

  • Check the status of local database listeners:

             srvctl status listener
  • Stop the local database listener:

             srvctl stop listener
  • Stop a specific listener on a node:

            srvctl stop listener -l <listener_name> -n <node_name>

  • Stop and remove Virtual IP (VIP):
           srvctl stop vip -vip <vip_name>
           srvctl remove vip -vip <vip_name>

7. Managing SCAN and SCAN Listeners

  • Check SCAN and SCAN listener status:

           srvctl status scan
           srvctl status scan_listener
  • Stop a specific SCAN listener:

           srvctl stop scan_listener -i 3
  • Stop a specific SCAN VIP:

          srvctl stop scan -i <scan_name>

8. Removing and Adding Database Services

  • Remove a database from cluster services:

             srvctl remove database -d <db_unique_name> [-f] [-y] [-v]
  •  Add a database service:
             srvctl add database -d <db_unique_name> -o ORACLE_HOME [-p spfile]
  • Add an instance to the database:

     srvctl add instance -d <db_unique_name> -i <inst_name> -n <node_name>

9. Managing Database Services

  • Relocate a service from one instance to another:

             srvctl relocate service -d <database_name> -s <service_name> -i <old_inst_name> -r <new_inst_name>

  • Remove a database service:

             srvctl remove service -d <DB_NAME> -s <SERVICE_NAME>
  • Add a database service with preferred and available lists:

             srvctl add service -d <DB_NAME> -s <SERVICE_NAME> -r "preferred_list" -a "available_list" [-P {BASIC | NONE | PRECONNECT}]
  • Start and stop a service:

            srvctl start service -d <DB_NAME> -s <SERVICE_NAME>
            srvctl stop service -d <DB_NAME> -s <SERVICE_NAME>

Comments

Popular posts from this blog

🚀 Automating Oracle Database Patching with Ansible: A Complete Guide

Oracle database patching has long been the bane of DBAs everywhere. It's a critical task that requires precision, expertise, and often results in extended maintenance windows. What if I told you that you could automate this entire process, reducing both risk and downtime while ensuring consistency across your Oracle estate? 💡 In this comprehensive guide, I'll walk you through a production-ready Ansible playbook that completely automates Oracle patch application using OPatch. Whether you're managing a single Oracle instance or hundreds of databases across your enterprise, this solution will transform your patch management strategy! 🎯 🔥 The Challenge: Why Oracle Patching is Complex Before diving into the solution, let's understand why Oracle patching is so challenging: 🔗 Multiple dependencies : OPatch versions, Oracle Home configurations, running processes ⚠️ Risk of corruption : Incorrect patch application can render databases unusable ⏰ Downtime requirements : Da...

Oracle RAC Switchover & Switchback: Step-by-Step Guide

 Ensuring business continuity requires regular Disaster Recovery (DR) drills. This guide covers the Switchover and Switchback process between Primary (DC) and Standby (DR) databases . Pre-checks Before Performing Switchover Before starting the activity, ensure there are no active sessions in the database. If any are found, share the session details with the application team, get their confirmation, and terminate the sessions. Primary Database Name: PRIMARY Standby Database Name: STANDBY  Identify Active Sessions set lines 999 pages 999 col machine for a30 col username for a30 col program for a30 compute sum of count on report break on report select inst_id,username,osuser,machine,program,status,count(1) "count" from gv$session where inst_id=1 and program like 'JDBC%' group by inst_id,username,osuser,machine,program,status order by 1,2; select inst_id,username,osuser,machine,program,status,count(1) "count" from gv$session where inst_id=2 and program lik...