Thursday, 18 September 2025

Rac services Startup Sequence

 

RAC Services Startup Sequence

When an Oracle RAC cluster is started, the components must come up in a specific dependency order:


🧩 Step-by-Step Startup Order

OrderComponentDescriptionCommand (if manual)
1️⃣OHAS (Oracle High Availability Services)Base daemon on each node. Brings up local agents and monitors.crsctl start has
2️⃣CSSD (Cluster Synchronization Services Daemon)Handles node membership and cluster heartbeat.Auto via OHAS
3️⃣CRSD (Cluster Ready Services Daemon)Manages cluster resources (like databases, services, VIPs).Auto via OHAS
4️⃣EVMD (Event Manager Daemon)Manages cluster events and notifications.Auto via OHAS
5️⃣ASM InstancesProvides shared storage (if using ASM). Must start before any database instances.srvctl start asm -n <node>
6️⃣Listener(s)Handles client connections. Needed before database instances start.srvctl start listener -n <node>
7️⃣Database InstancesEach RAC instance on each node. They mount and open the shared database.srvctl start instance -d <db> -i <inst> or srvctl start database -d <db>
8️⃣RAC Services (DB Services)Logical services running on top of the database. Enable workload balancing, failover, etc.srvctl start service -d <db> -s <service>

RAC Startup Sequence

 In an Oracle RAC environment, multiple instances start up and mount one shared database. The startup is coordinated by Oracle Clusterware.


🧩 RAC Startup Steps

1. Clusterware Startup (Infrastructure Layer)

  • Before any database instance starts, Clusterware (CRS) must be running on all nodes.

  • Clusterware includes:

    • Cluster Ready Services (CRS)

    • Oracle Cluster Synchronization Services (CSS)

    • Oracle High Availability Services (OHASD)

Commands:

crsctl start crs # Start Clusterware stack on a node crsctl check crs # Verify status

2. Automatic Startup of RAC Instances

  • Once CRS is up, it will start:

    • Oracle ASM instances (if used)

    • Listener

    • Database instances (configured as resources in CRS)

Commands:

srvctl start asm -n <node_name> # Start ASM on a specific node srvctl start listener -n <node_name> # Start listener on a node srvctl start database -d <db_name> # Start all RAC instances
  • Alternatively, to start an instance manually (on one node):

sqlplus / as sysdba STARTUP

⚙ RAC Instance Startup Phases

Each RAC instance goes through these standard Oracle startup stages:

StageWhat Happens
STARTUP NOMOUNTAllocates SGA, starts background processes. Uses init.ora / spfile
STARTUP MOUNTReads control files from shared storage. Opens redo threads.
STARTUP OPENOpens datafiles and online redo logs, database available to users
  • At MOUNT, the instance joins the cluster group using Global Enqueue Service (GES) and Global Cache Service (GCS).

  • At OPEN, the database becomes fully accessible.


🔁 Typical RAC Startup Flow

[Start Clusterware] ↓ [Start ASM Instances] ↓ [Start Listeners] ↓ [Start RAC Instances (Node1, Node2,...)] ↓ [Each instance does: NOMOUNT → MOUNT → OPEN] ↓ [Clustered Database becomes available]

📌 Useful RAC Startup/Shutdown Commands

TaskCommand
Start whole RAC DBsrvctl start database -d <db_name>
Stop whole RAC DBsrvctl stop database -d <db_name>
Start one instancesrvctl start instance -d <db_name> -i <inst_name>
Stop one instancesrvctl stop instance -d <db_name> -i <inst_name>
Check database statussrvctl status database -d <db_name>

Components of RAC

 1. Cluster Nodes (Servers)

  • Multiple physical or virtual servers (nodes) work together as a cluster.

  • Each node runs its own Oracle Instance (SGA + background processes).

  • All nodes access the same database files.


2. Shared Storage

  • All RAC nodes must see the same storage.

  • Contains:

    • Datafiles

    • Control files

    • Redo log files

    • Archive logs

  • Usually implemented using SAN / NAS / ASM (Automatic Storage Management).


3. Cluster Interconnect (Private Network)

  • High-speed private network between all nodes.

  • Used for:

    • Cache Fusion (transferring data blocks between instances)

    • Global resource coordination

  • Requires low-latency and high-bandwidth network (typically 10/25/40GbE or Infiniband).


4. Oracle Clusterware

  • Provides cluster management and node membership.

  • Ensures only active nodes access the shared storage.

  • Manages:

    • Node heartbeat monitoring

    • Automatic failover

    • VIP (Virtual IP) configuration


5. Global Cache Service (GCS) & Global Enqueue Service (GES)

  • Ensure data consistency across instances.

  • Cache Fusion: If a block is modified on one node, other nodes get the updated version via interconnect (not disk I/O).

  • GES manages locks, GCS manages cache coherency.


6. Oracle RAC Database

  • One database (shared) accessed by multiple instances.

  • Appears as a single database to applications.

  • Supports load balancing and failover through services.


📊 RAC Architecture Diagram

+-------------+ +-------------+ | Node 1 | | Node 2 | |-------------| |-------------| | Oracle Inst | | Oracle Inst | | SGA/Proc | | SGA/Proc | +------|------+ +------|------+ | | ======= Private Interconnect ======= | | +---------------------------------------+ | Shared Storage (ASM) | | Control/Data/Redo/Archive Files | +---------------------------------------+

⚙ Benefits of RAC

  • High Availability: Survives node failure automatically.

  • Scalability: Add more nodes to increase capacity.

  • Load Balancing: Workload distributed among nodes.

  • Fault Tolerance: Shared database remains available if a node fails.

Wednesday, 13 August 2014

Voting Disk and Oracle Cluster Registry

1.    Voting Disk: - Manages cluster membership by way of a health check and arbitrates cluster ownership among the instances in case of network failures. RAC uses the voting disk to determine which instances are members of a cluster. The voting disk must reside on shared disk. For high availability, Oracle recommends that you have multiple voting disks. The Oracle Clusterware enables multiple voting disks.

2. OCR File :- Cluster configuration information is maintained in Oracle Cluster Registry file. OCR relies on a distributed shared-cache architecture for optimizing queries against the cluster repository. Each node in the cluster maintains an in-memory copy of OCR, along with an OCR process that accesses its OCR cache.
When OCR client application needs to update the OCR, they communicate through their local OCR process to the OCR process that is performing input/output (I/O) for writing to the repository on disk.
The OCR client applications are Oracle Universal Installer (OUI), SRVCTL, Enterprise Manger (EM), Database Configuration Assistant (DBCA), Database Upgrade Assistant(DBUA), NetCA and Virtual Internet Protocol Configuration assistant (VIPCA). OCR also maintains dependency and status information for application resources defined within CRS, specifically databases, instances, services and node applications.
Maintains cluster configuration information as well as configuration information about any cluster database within the cluster. The OCR also manages information about processes that Oracle Clusterware controls. The OCR stores configuration information in a series of key-value pairs within a directory tree structure. The OCR must reside on shared disk that is accessible by all of the nodes in your cluster. The Oracle Clusterware can multiplex the OCR and Oracle recommends that you use this feature to ensure cluster high availability.

Monday, 22 October 2012

Changing Character set of database....


To change Character set of database either we have several methods.

1) If you have empty database then drop and recreate the database with new character set.
2) Go with following steps.


> SHUT IMMEDIATE

--Take full db backup .

> STARTUP MOUNT

> ALTER SYSTEM ENABLE RESTRICTED SESSION;

> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

>ALTER SYSTEM SET AQ_TM_PROCESSES=0;

>ALTER DATABASAE OPEN;

>ALTER DATABASE CHARACTER SET INTERNAL_USE US7ASCII  ;

Saturday, 20 October 2012

Oracle Architecture (Parsing Of Statement )

This is the first step in the processing of any statement in Oracle.  Parsing is the act of breaking the submitted statement down into its component parts ? determining what type of statement it is (query, DML, DDL) and performing various checks on it. 

The parsing process performs two main functions:

o Syntax Check: is the statement a valid one?  Does it make sense given the SQL grammar documented in the SQL Reference Manual.  Does it follow all of the rules for SQL.

o Semantic Analysis:  Going beyond the syntax ? is the statement valid in light of the objects in the database (do the tables and columns referenced exist).  Do you have access to the objects ? are the proper privileges in place?  Are there ambiguities in the statement ? for example if there are two tables T1 and T2 and both have a column X, the query ?select X from T1, T2 where ?? is ambiguous, we don?t know which table to get X from.And so on.

So, you can think of parsing as basically a two step process, that of a syntax check to check the validity of the statement and that of a semantic check ? to ensure the statement can execute properly.  The difference between the two types of checks are hard for you to see ? Oracle does not come back and say ?it failed the syntax check?, rather it returns the statement with a error code and message. 
So for example, this statement fails with a syntax error:
SQL> select from where 2;
select from where 2
       *
ERROR at line 1:
ORA-00936: missing expression

While this statement failed with a semantic error ? if the table NOT_A_TABLE existed and we had permission to access it, this statement would have succeeded:

SQL> select * from not_a_table;
select * from not_a_table
              *
ERROR at line 1:
ORA-00942: table or view does not exist

That is the only way to really tell the difference between a semantic and syntactic error ? if the statement COULD have executed given the proper objects and privileges, you had a semantic error, otherwise if the statement could not execute under any circumstances, you have a syntax error.  Regardless ? Oracle will not execute the statement for you!

The next step in the parse operation is to see if the statement we are currently parsing has already in fact been processed by some other session.  If it has ? we may be in luck here, we can skip the next two steps in the process, that of optimization and row source generation.  If we can skip these next two steps in the process, we have done what is known as a Soft Parse ? a shorter process to getting our query going.  If we cannot,
if we must do all of the steps, we are performing what is known as a Hard Parse ? we must parse, optimize, generate the plan for the query.  This distinction is very important.  When developing our applications we want a very high percentage of our queries to be Soft Parsed ? to be able to skip the optimize/generate phases ? as they are very CPU intensive as well as a point of contention (serialization).  If we have to Hard Parse a large percentage of our queries, our system will function slowly and in
some cases ? not at all.The way this sharing of SQL in Oracle is accomplished is via the shared pool, a piece of memory in the SGA maintained by Oracle.  We covered this topic in chapter 5 but will revisit is again in the context of processing a query.  After Oracle parses the query and
it passes the syntax and semantic checks ? it will look in the shared pool component of the SGA to see if that same exact query has already been processed by another session.  Since it has performed the semantic check it has already figured out:
o Exactly what tables are involved
o That we have access to the tables (the proper privileges are there)

And so on.  Now, it can look at all of the queries in the shared pool that have already been parsed/optimized and generated to see if the work has already been done. 
........ +