ORACLE RAC VARIOUS COMMAND FOR DAY TO DAY OPERATION
ORACLE RAC VARIOUS COMMAND FOR DAY TO DAY OPERATION
Checking CRS Status:
The below two commands are generally used to check the status of CRS. The first command lists the status of CRS on the local node where as the other command shows the CRS status across all the nodes in Cluster.
# cd /u01/app/11.2.0/grid/bin
# ./crsctl check cluster -all
crsctl check crs <<– for the local node
crsctl check cluster <<– for remote nodes in the cluster
Example:
[root@YesBolisetty1-pub ~]# crsctl check crs
For the below command to run, CSS needs to be running on the local node. The “ONLINE” status for remote node says that CSS is running on that node. When CSS is down on the remote node, the status of “OFFLINE” is displayed for that node.
Example:
[root@YesBolisetty1-pub ~]# crsctl check cluster
Viewing Cluster name:
The below command to get the name of Cluster. The similar information can be retrieved from the dump file.
ocrdump -stdout -keyname SYSTEM | grep -A 1 clustername | grep ORATEXT | awk ‘{print $3}’
OR
ocrconfig -export /tmp/ocr_exp.dat -s online
for i in `strings /tmp/ocr_exp.dat | grep -A 1 clustername` ; do if [ $i != ‘SYSTEM.css.clustername’ ]; then echo $i; fi; done
OR
Oracle creates a directory with the same name as Cluster under the $ORA_CRS_HOME/cdata.
No. Of Nodes configured in Cluster:
The below command can be used to find out the number of nodes registered into the cluster. It also displays the node’s Public name, Private name and Virtual name along with their numbers.
olsnodes -n -p -i
Example:
[root@YesBolisetty1-pub ~]# olsnodes -n -p –i
Viewing Votedisk Information:
The below command is used to view the no. of Voting disks configured in the Cluster.
crsctl query css votedisk
Viewing OCR Information:
The ocrcheck command displays the no. of OCR files configured in the Cluster. It is primarily used to chck the integrity of the OCR files. It also displays the version of OCR as well as storage space information. You can only have 2 OCR files at max.
Example:
[root@YesBolisetty1-pub ~]# ocrcheck
Backing up OCR:
Oracle performs physical backup of OCR devices every 4 hours under the default backup directory $ORA_CRS_HOME/cdata/ and then it rolls that forward to Daily, weekly and monthly backup. You can get the backup information by executing below command.
ocrconfig -showbackup
Example:
[root@YesBolisetty1-pub ~]# ocrconfig –showbackup
Manually backing up the OCR
ocrconfig -manualbackup <<–Physical Backup of OCR
The above command backs up OCR under the default Backup directory. You can export the contents of the OCR using below command (Logical backup).
ocrconfig -export /tmp/ocr_exp.dat -s online <<– Logical Backup of OCR
Direct connections to specific instance, or using a load balanced connection to the main service.
$ sqlplus / as sysdba
SQL> CONN sys/password@rac1 AS SYSDBA
Connected.
SQL> SELECT instance_name, host_name FROM v$instance;
SQL> CONN sys/password@rac2 AS SYSDBA
Connected.
SQL> SELECT instance_name, host_name FROM v$instance;
SQL> CONN sys/password@rac AS SYSDBA
Connected.
SQL> SELECT instance_name, host_name FROM v$instance;
Check the Status of the RAC
There are several ways to check the status of the RAC. The srvctl utility shows the current configuration and status of the RAC database.
Example:
$ srvctl config database -d RAC
$ srvctl status database -d RAC
The V$ACTIVE_INSTANCES view can also display the current status of the instances.
$ sqlplus / as sysdba
SQL> SELECT * FROM v$active_instances;
The GV$ allow you to display global information for the whole RAC.
SQL> SELECT inst_id, username, sid, serial# FROM gv$session WHERE username IS NOT NULL;
olsnodes
Run the olsnodes command on all cluster nodes and see that it returns a list of all the nodes in each case.
# cd /u01/app/11.2.0/grid/bin
# ./olsnodes
RAC specific background processes for the database instance
Cluster Synchronization Service (CSS)
ocssd daemon, manages cluster configuration
Cluster Ready Services (CRS)
manages resources(listeners, VIPs, Global Service Daemon GSD, Oracle Notification Service ONS)
crsd daemon backup the OCR every for hours, configuration is stored in OCR
Event Manager (EVM)
evmd daemon, publish events
LMSn coordinate block updates
LMON global enqueue for shared locks
LMDn manages requests for global enqueues
LCK0 handle resources not requiring Cache Fusion
DIAG collect diagnostic info
Check for main Clusterware services up
#check Event Manager up
ps -ef | grep evmd
#check Cluster Synchronization Services up
ps -ef | grep ocssd
#check Cluster Ready Services up
ps -ef | grep crsd
#check Oracle Notification Service
ps -ef | grep ons
crs_stat
#Tested, as root
#Lists the status of an application profile and resources
#crs_stat [resource_name […]] [-v] [-l] [-q] [-c cluster_node]
$ORA_CRS_HOME/bin/crs_stat –t
#use -v for verbose resource use
#use -p for a lot of details
#use -ls to view resources and relative owners
Views
GV$SERVICES
GV$ACTIVE_SERVICES
GV$SERVICEMETRIC
GV$SERVICEMETRIC_HISTORY
GV$SERVICE_WAIT_CLASS
GV$SERVICE_EVENT
GV$SERVICE_STATS
GV$SERV_MOD_ACT_STATS
Views and queries
select * from GV$CACHE_TRANSFER
Checking CRS Status:
The below two commands are generally used to check the status of CRS. The first command lists the status of CRS on the local node where as the other command shows the CRS status across all the nodes in Cluster.
# cd /u01/app/11.2.0/grid/bin
# ./crsctl check cluster -all
crsctl check crs <<– for the local node
crsctl check cluster <<– for remote nodes in the cluster
Example:
[root@YesBolisetty1-pub ~]# crsctl check crs
For the below command to run, CSS needs to be running on the local node. The “ONLINE” status for remote node says that CSS is running on that node. When CSS is down on the remote node, the status of “OFFLINE” is displayed for that node.
Example:
[root@YesBolisetty1-pub ~]# crsctl check cluster
Viewing Cluster name:
The below command to get the name of Cluster. The similar information can be retrieved from the dump file.
ocrdump -stdout -keyname SYSTEM | grep -A 1 clustername | grep ORATEXT | awk ‘{print $3}’
OR
ocrconfig -export /tmp/ocr_exp.dat -s online
for i in `strings /tmp/ocr_exp.dat | grep -A 1 clustername` ; do if [ $i != ‘SYSTEM.css.clustername’ ]; then echo $i; fi; done
OR
Oracle creates a directory with the same name as Cluster under the $ORA_CRS_HOME/cdata.
No. Of Nodes configured in Cluster:
The below command can be used to find out the number of nodes registered into the cluster. It also displays the node’s Public name, Private name and Virtual name along with their numbers.
olsnodes -n -p -i
Example:
[root@YesBolisetty1-pub ~]# olsnodes -n -p –i
Viewing Votedisk Information:
The below command is used to view the no. of Voting disks configured in the Cluster.
crsctl query css votedisk
Viewing OCR Information:
The ocrcheck command displays the no. of OCR files configured in the Cluster. It is primarily used to chck the integrity of the OCR files. It also displays the version of OCR as well as storage space information. You can only have 2 OCR files at max.
Example:
[root@YesBolisetty1-pub ~]# ocrcheck
Backing up OCR:
Oracle performs physical backup of OCR devices every 4 hours under the default backup directory $ORA_CRS_HOME/cdata/
ocrconfig -showbackup
Example:
[root@YesBolisetty1-pub ~]# ocrconfig –showbackup
Manually backing up the OCR
ocrconfig -manualbackup <<–Physical Backup of OCR
The above command backs up OCR under the default Backup directory. You can export the contents of the OCR using below command (Logical backup).
ocrconfig -export /tmp/ocr_exp.dat -s online <<– Logical Backup of OCR
Direct connections to specific instance, or using a load balanced connection to the main service.
$ sqlplus / as sysdba
SQL> CONN sys/password@rac1 AS SYSDBA
Connected.
SQL> SELECT instance_name, host_name FROM v$instance;
SQL> CONN sys/password@rac2 AS SYSDBA
Connected.
SQL> SELECT instance_name, host_name FROM v$instance;
SQL> CONN sys/password@rac AS SYSDBA
Connected.
SQL> SELECT instance_name, host_name FROM v$instance;
Check the Status of the RAC
There are several ways to check the status of the RAC. The srvctl utility shows the current configuration and status of the RAC database.
Example:
$ srvctl config database -d RAC
$ srvctl status database -d RAC
The V$ACTIVE_INSTANCES view can also display the current status of the instances.
$ sqlplus / as sysdba
SQL> SELECT * FROM v$active_instances;
The GV$ allow you to display global information for the whole RAC.
SQL> SELECT inst_id, username, sid, serial# FROM gv$session WHERE username IS NOT NULL;
olsnodes
Run the olsnodes command on all cluster nodes and see that it returns a list of all the nodes in each case.
# cd /u01/app/11.2.0/grid/bin
# ./olsnodes
RAC specific background processes for the database instance
Cluster Synchronization Service (CSS)
ocssd daemon, manages cluster configuration
Cluster Ready Services (CRS)
manages resources(listeners, VIPs, Global Service Daemon GSD, Oracle Notification Service ONS)
crsd daemon backup the OCR every for hours, configuration is stored in OCR
Event Manager (EVM)
evmd daemon, publish events
LMSn coordinate block updates
LMON global enqueue for shared locks
LMDn manages requests for global enqueues
LCK0 handle resources not requiring Cache Fusion
DIAG collect diagnostic info
Check for main Clusterware services up
#check Event Manager up
ps -ef | grep evmd
#check Cluster Synchronization Services up
ps -ef | grep ocssd
#check Cluster Ready Services up
ps -ef | grep crsd
#check Oracle Notification Service
ps -ef | grep ons
crs_stat
#Tested, as root
#Lists the status of an application profile and resources
#crs_stat [resource_name […]] [-v] [-l] [-q] [-c cluster_node]
$ORA_CRS_HOME/bin/crs_stat –t
#use -v for verbose resource use
#use -p for a lot of details
#use -ls to view resources and relative owners
Views
GV$SERVICES
GV$ACTIVE_SERVICES
GV$SERVICEMETRIC
GV$SERVICEMETRIC_HISTORY
GV$SERVICE_WAIT_CLASS
GV$SERVICE_EVENT
GV$SERVICE_STATS
GV$SERV_MOD_ACT_STATS
Views and queries
select * from GV$CACHE_TRANSFER
Comments
Post a Comment