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...

Complete Guide to PostgreSQL 18 Source Installation with Performance Optimization

PostgreSQL 18 brings powerful new features and performance improvements that make it an excellent choice for modern database workloads. In this comprehensive guide, I'll walk you through installing PostgreSQL 18 from source code while implementing a strategic disk layout that maximizes performance. Why Install from Source? While package managers offer convenience, building PostgreSQL from source gives you complete control over configuration and optimization options. This flexibility allows you to tailor the database precisely to your hardware and workload requirements. Prerequisites Before we begin, ensure you're working with a RHEL, CentOS, or Fedora-based system. We'll be installing several development tools and libraries needed for compilation. Installation Process 1. Download PostgreSQL 18 Source Code First, grab the latest PostgreSQL 18 source tarball: wget https://ftp.postgresql.org/pub/source/v18.0/postgresql-18.0.tar.gz 2. Install Required Dependencies Install all n...

⚡ Automating Oracle 19c Database Patching on Windows Server with PowerShell

Applying Oracle patches on Windows often feels repetitive and error-prone — stopping services, updating OPatch, applying patches, running datapatch , and restarting services. To save time ⏱ and reduce mistakes ⚠, I created a PowerShell automation script that performs the patching process end-to-end 🚀. 🔹 Why Automate Oracle Patching? ⏱ Save time by automating repetitive steps ⚙ Avoid manual errors during patching 📜 Maintain logs for auditing and troubleshooting 🛡 Ensure consistent, reliable patching 🔹 Full PowerShell Script # --- CONFIGURATION --- $oracleHome = "c:\users\administrator\downloads\v982656-01" # Change if this is not your actual Oracle Home! $patchDir = "C:\Users\Administrator\Downloads\p37962957_190000_MSWIN-x86-64\37962957" #update the Patchfile directory $opatchDir = "$oracleHome\OPatch" $opatchZip = "C:\Users\Administrator\Downloads\p6880880_190000_MSWIN-x86-64.zip" #Based on your setup update Opatch di...