Saturday, May 12, 2018

RAC Database Commands

Some useful Oracle RAC Database commands.

Background Processes

ps -ef|grep d.bin
oracle 8818 8814 0 07:23 ? 00:00:00 /u01/app/oracle/product/10.2.0/crs/bin/evmd.bin
root 8952 8111 0 07:23 ? 00:00:04 /u01/app/oracle/product/10.2.0/crs/bin/crsd.bin reboot
oracle 9476 9003 0 07:23 ? 00:00:01 /u01/app/oracle/product/10.2.0/crs/bin/ocssd.bin
root 16124 5740 0 07:35 pts/2 00:00:00 grep d.bin

Cluster logfiles

CRS logs are in $ORA_CRS_HOME/log//crsd/
CSS logs are in $ORA_CRS_HOME/log//cssd/
EVM logs are in $ORA_CRS_HOME/log//evmd/
SRVM (srvctl) and OCR (ocrdump, ocrconfig, ocrcheck) logs are in $ORA_CRS_HOME/log//client/ and in $ORACLE_HOME/log//client/
Oracle Clusterware alerts can be found in alert.log present in the $ORA_CRS_HOME/log/ directory

Stop the Cluster

# ./crsctl stop crs
Stopping resources.
This could take several minutes.
Successfully stopped Oracle Clusterware resources
Stopping Cluster Synchronization Services.
Shutting down the Cluster Synchronization Services daemon.
Shutdown request successfully issued.
# ps -ef|grep d.bin
root 18713 5771 0 07:34 pts/2 00:00:00 grep d.bin

Checking the version of cluster

#./crsctl query crs softwareversion
#./crsctl query crs activersion

List the voting disks used by Cluster

$ crsctl query css votedisk

Backup up OCR file

# pwd
/u01/app/oracle/product/10.2.0/crs/bin
# ./ocrconfig -export -s online
# ./ocrconfig –manualbackup
# ./ocrconfig -showbackup

Restore OCR file

#ocrconfig -restore

Importing an OCR file

• Shut down all the nodes in the cluster and restart one of them in single-user mode.
• Import an OCR export file using the ocrconfig -import command from any node.

Check the integrity of Cluster

ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 306952
Used space (kbytes) : 4624
Available space (kbytes) : 302328
ID : 148137643
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded

Check the status of the cluster and target nodes

$cd $ORA_CRS_HOME/bin
$ crs_stat -t
Name Type Target State Host
----------------------------------------------------------
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
$crsctl check crs
Cluster Synchronization Services appears healthy
Cluster Ready Services appears healthy
Event Manager appears healthy

Check the number of nodes in Cluster

$ olsnodes -n
rac1 1
rac2 2

Check the status of the database from DB ORACLE_HOME

srvctl status service -d DB_NAME;
srvctl status service -d -s SERVICE_NAME;
select service_name, elapsedpercall, cpupercall from V$SERVICEMETRIC;
select service_name, stat_name from V$SERVICE_STATS where service_name=''
SELECT DISTINCT stat_name FROM v$service_stats;
srvctl config database -d -t
Stop and start the services using srvctl
stop database -d db_name;
srvctl start database -d db_name;
srvctl start service -d db_name -s service_name;
srvctl stop instance -d db_name -i inst_name;
srvctl start instance -d db_name -i inst_name;
srvctl stop nodeapps -n node_name
srvctl start nodeapps -n node_name
srvctl setenv nodeapps -n node_name -t "TNS_ADMIN='Path'"
srvctl getenv nodeapps -n node_name

No comments:

Post a Comment

Featured post

Migrate OCR & vote from external to normal or High redundancy in ASM

How to Move OCR & Vote from external to Normal or high. 1)  Create New diskgroup(CRS) with suitable redundancy for OCR and Voting files....

Popular Posts