Monday 4 November 2024
killing session in Oracle
Wait Events and queries to identify wait in Oracle database
How to check query plan changed or not from AWR
Sunday 3 November 2024
SET COLSEP ' | ' - column separator in Query
SQL>
column
service_name format a20
SQL>
column
network_name format a20
SQL>
set
colsep
' | '
SQL>
select
service_id,
name
as
service_name, network_name,
2 (
select
count
(*)
from
v$active_services
where
name
= A.
name
)
as
active
3
from
v$services A
order
by
name
;
SERVICE_ID | SERVICE_NAME | NETWORK_NAME | ACTIVE
---------- | ---------------- | ---------------- | ----------
4 | plt | plt | 1
5 | pltp | pltp | 1
3 | pltXDB | pltXDB | 1
1 | SYS$BACKGROUND | | 1
2 | SYS$USERS | | 1
Oracle RAC Clusterware Startup Sequence in detail
System Boot and Init Process
- When the operating system completes the boot process, it reads the
/etc/init.d
scripts through theinit
orinit.d
daemon. These scripts manage service startups on Linux systems. - The inittab file configuration triggers the Oracle High Availability Services Daemon (OHASD). On Linux, this means that as part of the system startup, OHASD is one of the first Clusterware processes to start.
- When the operating system completes the boot process, it reads the
OHASD Initialization and OLR Access
- OHASD is the root daemon for initializing Oracle Clusterware. It has privileged access to the Oracle Local Registry (OLR) stored on each node’s local file system.
- OLR contains vital configuration data specific to the node, including information needed for initial Clusterware setup and node-specific details. This data enables OHASD to complete its initialization.
Starting GPNPD and CSSD Daemons
- Once OHASD is operational, it starts the Grid Plug and Play Daemon (GPNPD) and Cluster Synchronization Services Daemon (CSSD).
- CSSD has access to the GPNP Profile (also stored locally on each node), which includes essential bootstrap data such as:
- ASM Diskgroup Discovery String: Information to discover ASM disks on startup.
- ASM SPFILE Location: Specifies the diskgroup where the ASM SPFILE (Server Parameter File) is stored.
- ASM Diskgroup Name for Voting Files: Identifies the ASM diskgroup that contains the Voting Disk(s), which are critical for cluster node coordination.
CSSD and Voting Files
- CSSD reads the GPNP Profile to locate the Voting Files stored in ASM disk headers. Voting Files are used for node membership and are crucial for cluster health monitoring.
- With these pointers, CSSD completes its initialization and either starts a new cluster or joins an existing one.
Starting ASM Instance and Diskgroup Mounting
- With CSSD running, OHASD proceeds to start the ASM (Automatic Storage Management) instance.
- ASM operates in coordination with CSSD to manage and access storage. It uses the SPFILE located in the specified diskgroup for initialization.
- Once the ASM instance is active, it mounts the necessary ASM diskgroups, including the ones containing the Voting Files and OCR (Oracle Cluster Registry).
CRSD Initialization and OCR Access
- With ASM and its diskgroups mounted, access to the Oracle Cluster Registry (OCR) is now available. OCR, which is typically stored in an ASM diskgroup, contains cluster-wide configuration data necessary for CRSD operations.
- OHASD starts the Cluster Ready Services Daemon (CRSD), which relies on OCR for retrieving information about cluster resources, dependencies, and node roles.
Completion of Clusterware Initialization
- After CRSD starts, Oracle Clusterware completes the remainder of its initialization. CRSD then begins managing high-availability resources, such as database instances, listeners, and other services under Oracle Clusterware control.
Key Points on OLR, Voting Files, and Cluster Components
OLR: Essential for node-specific configuration and available locally to OHASD. If OLR is lost or corrupted, OHASD may fail to start correctly on that node, and the node may need recovery or reconfiguration.
Voting Files: These are central to node membership and fencing decisions, helping to avoid split-brain scenarios. CSSD relies on the Voting Files for its initialization and operation, while CRSD uses OCR for managing cluster resources.
ASM Instance: Plays a dual role, storing both Voting Files and OCR if they’re ASM-managed. ASM mounts the required diskgroups to provide Clusterware components with access to these files.
Cluster Resource Management: CRSD uses OCR data to start and monitor all Oracle RAC resources, completing the initialization sequence and ensuring high availability.
In summary, each component in the Oracle Clusterware startup process depends on previous components, creating a cascading initialization. If any critical part (like OLR, Voting Files, or ASM diskgroups) is missing or corrupted, it can impact the whole startup sequence, potentially leading to node isolation or cluster inaccessibility until recovery steps are taken.
GPNP Profile Internals in Oracle RAC
The GPnP profile is a XML file located at location <GRID_HOME/gpnp/<hostname>/profiles/peer as profile.xml.
Each node of the cluster maintains a copy of this profile locally and is maintained by GPnP daemon along with mdns daemon.
Now before understanding why Oracle came up with GPnP profile, we need to focus on what it contains.
GPnP defines a node’s meta data about network interfaces for public and private interconnect, the ASM server parameter file, and CSS voting disks.
This profile is protected by a wallet against modification.
If you have to manually modify the profile, it must first be unsigned with $GRID_HOME/bin/gpnptool, modified, and then signed again with the same utility, however there is a very slight chance you would ever be required to do so.
Now we’ll use the gpnptool with get option to dump this xml file into standard output.
Below is the formatted output for the ease of readability.
<?xml version=”1.0″ encoding=”UTF-8″?>
<gpnp:GPnP-Profile Version=”1.0″ xmlns=”http://www.xyz/gpnp-profile”
xmlns:gpnp=”http://xyz/gpnp-profile”
xmlns:orcl=”http://xyz/gpnp-profile”
xmlns:xsi=”http://xyz/XMLSchema-instance”
xsi:schemaLocation=”http://xyz/gpnp-profile gpnp-profile.xsd”
ProfileSequence=”3″ ClusterUId=”002c207a71cvaljgkcea7bea5b3a49″
ClusterName=”Cluster01″ PALocation=””>
<gpnp:Network-Profile>
<gpnp:HostNetwork id=”gen” HostName=”*”>
<gpnp:Network id=”net1″ IP=”xxx.xx.x.x” Adapter=”bond0″ Use=”public”/>
<gpnp:Network id=”net2″ IP=”xxx.xxx.x.x” Adapter=”bond1″
Use=”cluster_interconnect”/>
</gpnp:HostNetwork>
</gpnp:Network-Profile>
<orcl:CSS-Profile id=”css” DiscoveryString=”+asm” LeaseDuration=”400″ />
<orcl:ASM-Profile id=”asm” DiscoveryString=””
SPFile=”+DATA/prod/asmparameterfile/registry.253.699915959″ />
<ds:Signature…>…</ds:Signature>
</gpnp:GPnP-Profile>
So from the above dump we can see that GPnP profile contains following information:-
1) Cluster Name
2) Network Profile
3) CSS-Profile tag
4) ASM-Profile tag
Now that we have understood the content of a GPnP profile, we need to understand how the Clusterware uses this information to start.
From 11gr2 you have the option of storing the OCR and Voting disk on ASM, but clusterware needs OCR and Voting disk to start crsd & cssd and both these files are on ASM which itself is a resource for the node. so how does the clusterware starts, which files it accesses to get the information needed to start clusterware, to resolve this Oracle came up with two local operating system files OLR & GPnP.
When a node of an Oracle Clusterware cluster restarts, OHASD is started by platform-specific means.OHASD has access to the OLR (Oracle Local Registry) stored on the local file system. OLR provides needed data (Would explain in another post) to complete OHASD initialization
OHASD brings up GPnP Daemon and CSS Daemon.
CSS Daemon has access to the GPNP Profile stored on the local file system.
The Voting Files locations on ASM Disks are accessed by CSSD with well-known pointers in the ASM Disk headers and CSSD is able to complete initialization and start or join an existing cluster.
OHASD starts an ASM instance and ASM can now operate with CSSD initialized and operating.
The ASM instance uses special code to locate the contents of the ASM SPFILE, assuming it is stored in a Diskgroup.
With an ASM instance operating and its Diskgroups mounted, access to Clusterware’s OCR is available to CRSD.
OHASD starts CRSD with access to the OCR in an ASM Diskgroup.And thus Clusterware completes initialization and brings up other services under its control.
Thus with the use of GPnP profile several information stored in it along with the information in the OLR several tasks have been automated or eased for the administrators.
killing session in Oracle
Killing session :- INACTIVE and MACHINE set lines 300 pages 300 ; col module for a40 ; col machine for a10 ; select sid , machine ,SQL_ID...
-
What Is OEM? Oracle Enterprise Manager (OEM) has built-in management capabilities that enable DBAs and Apps DBAs to monitor and ma...
-
In each version of the Oracle database, a large number of background processes will be added. Below I have compiled a list of Oracle backg...
-
Oracle ASMCMD is ASM command-line utility that you can use to manage Oracle ASM instances, disk groups, file access control for disk groups,...