Wednesday 24 July 2019

Rac commands

Cluster Related     Commands
---------------         --------
crs_stat -t        Shows HA resource status (hard to read)
crsstat            Ouptut of crs_stat -t formatted nicely
ps -ef|grep d.bin    crsd.bin evmd.bin ocssd.bin
crsctl check crs    CSS,CRS,EVM appears healthy
crsctl stop crs        Stop crs and all other services
crsctl disable crs*    Prevents CRS from starting on reboot
crsctl enable crs*    Enables CRS start on reboot
crs_stop -all        Stops all registered resources
crs_start -all        Starts all registered resources

NOTE
----
* These commands update the file /etc/oracle/scls_scr/<node>/root/crsstart which contains the string “enable” or “disable” as appropriate.

Database Related Commands
-------------------------
srvctl start instance -d <db_name> -i <inst_name>    Starts an instance
srvctl stop instance -d <db_name> -i <inst_name>    Stops an instance
srvctl status instance -d <db_name> -i <inst_name>    Checks an individual instance

srvctl start database -d <db_name>            Starts all instances
srvctl stop database -d <db_name>            Stops all instances, closes database
srvctl status database -d <db_name>            Checks status of all instances

srvctl start service -d <db_name> -s <service_name>    Starts a service
srvctl stop service -d <db_name> -s <service_name>    Stops a service
srvctl status service -d <db_name>            Checks status of a service

examples

srvctl stop service -d DWDB -s DWDB_SRI_ETLUSER
srvctl add service -d DWDB -s DWDB_SRI_ETLUSER -r DWDB1,DWDB2 -a DWDB1,DWDB2
srvctl add service -d DWDB -s DWDB_SRI_ETLUSER -r DWDB1 -a DWDB2
srvctl add service -d DWDB -s DWDB_export_import -r DWDB1 -a DWDB2
srvctl modify service -db DWDB -service DWDB_SRI_USER -n -preferred DWDB1,DWDB2
srvctl relocate service -s DWDB_SRI_USER -d DWDB -i DWDB1 -t DWDB2
srvctl modify service -db DWDB -service DWDB_SRI_USER -n -preferred DWDB1,DWDB2 -a DWDB1,DWDB2
srvctl config service -db DWDB
srvctl modify service -db DWDB -service DWDB_sri_user -modifyconfig -available DWDB1,DWDB2


relocating services


[oracle@rac1 ~]$ srvctl status service -d orcl -s myservice
Service myservice is running on instance(s) orcl1


[oracle@rac1 ~]$ srvctl relocate service -d orcl -s myservice -i orcl1 -t orcl2

[oracle@rac1 ~]$ srvctl relocate service -d orcl -s myservice -i orcl1 -t orcl2
-i represents an old instance

-t represents a new instance

Now check the status of service.


[oracle@rac1 ~]$ srvctl status service -d orcl -s myservice
Service myservice is running on instance(s) orcl2
[oracle@rac1 ~]$

srvctl start nodeapps -n <node_name>            Starts gsd, vip, listener, and ons
srvctl stop nodeapps -n <node_name>            Stops gsd, vip and listener

_________________________________________________________________________

BACKGROUND PROCESSES
----------------------------------
There are three main background processes you can see when doing a ps –ef|grep d.bin.  They are normally started by init during the operating system boot process.  They can be started and stopped manually by issuing the command /etc/init.d/init.crs {start|stop|enable|disable}

/etc/rc.d/init.d/init.evmd
/etc/rc.d/init.d/init.cssd
/etc/rc.d/init.d/init.crsd

SERVICES
------------
Once the above processes are running, they will automatically start the following services in the following order if they are enabled.  This list assumes you are using ASM and have a service set up for TAF/load balancing.

1.The nodeapps (gsd, VIP, ons, listener) are brought online.
2.The ASM instances are brought online.
3.The database instances are brought online.
4.Any defined services are brought online.





























Node Startup Sequence:


Operating System > Oracle Clusterware > ASM > Instance > Listener > Service


================================================================================================
CRSCTL (Clusterware Control utility)                    (crsctl)
CRS_STAT (Cluster Ready Services Statistics)            (crs_stat -h)
OCRCHECK (Oracle Cluster Registry Check Utility)        (ocrcheck -help)
OCRCONFIG (Oracle Cluster Registry Config Utility)      (ocrconfig -help)
CLSCFG (Clusterware Config Tool)                        (clscfg -help)
CLUVFY (Clusterware Verification Utility)               (cluvfy)
================================================================================================

Node Verification:
------------------

olsnodes Clusterware command is used to list the node name and their numbers configured in a cluster:

olsnodes -n
olsnodes -p
olsnodes -i

================================================================================================

Use the crs_stat command to verify the status and state of the cluster sources such as gsd, ons, and vip. Ensure all resources Target and State are flagged as ONLINE

crs_stat -t

================================================================================================

OS-level background processes that belong to the cluster

ps -ef | grep init.d

================================================================================================

cluster stack daemon processes that are running at the OS level

ps -ef | grep d.bin


================================================================================================

For init deamon processess

cd /etc/init.d
pwd
ls -l ini*


================================================================================================

Ensure that the following entries exist in the /etc/inittab OS file to facilitate the Clusterware auto startup and shutdown operations at system (node) restarts. These entries are added at the time of the root.sh script execution.


cat /etc/inittab

# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
h1:35:respawn:/etc/init.d/init.evmd run >/dev/null 2>&1 </dev/null
h2:35:respawn:/etc/init.d/init.cssd fatal >/dev/null 2>&1 </dev/nul l
h3:35:respawn:/etc/init.d/init.crsd run >/dev/null 2>&1 </dev/null

================================================================================================

To display Oracle High Availability Services automatic startup configuration:
crsctl config crs

crsctl stop cluster   (for clusterstack)
crsctl stop crs       (for HA Services)
crsctl start cluster   (for clusterstack)
crsctl start crs       (for HA Services)

crsctl enable/disable crs       (for HA Services)


crsctl check crs      (for specific Node)
crsctl check cluster
crsctl check cluster -all   (for all Nodes)


crsctl query css votedisk


crsctl query crs activeversion
crsctl query crs softwareversion [hostname]


cluvfy comp crs -n all -verbose  (checks the complete Cluster Stack)


For OCR Check:
--------------


ocrcheck -config
ocrcheck -local

(OR)

NOTE:  The location of the OCR file can be determined by using the cat /etc/oracle/ocr.loc command. Because these files are always located on shared storage, the command can be executed from any node.


To check the integrity of the OCR file:
---------------------------------------

$ ocrcheck
$ cluvfy comp ocr –n all –verbose


To chek Voting Disk integrity or Voting Disk Issues:
----------------------------------------------------

To check the integrity of the voting disks, examine ocssd.log. Errors with the voting disks appear in the log. The following is a snippet of the output that indicates what an error may look like:

$ grep voting ocssd.log

[    CSSD]2008-09-09 10:47:09.711 [100494224] >ERROR:   clssnmvReadFatal: voting device corrupt (0x00000000/0x00000000/1//dev/sda6)
[    CSSD]2008-09-09 10:47:09.711 [3082128272] >ERROR:   clssnmvReadFatal: voting device corrupt (0x00000000/0x00000000/2//dev/sda7)


Locating OCR Backup:
--------------------

ocrconfig -showbackup auto
ocrconfig -manualbackup
ocrconfig –showbackup manual


Virtual IP (VIP) host name, VIP address, VIP subnet mask and VIP interface name:
--------------------------------------------------------------------------------

srvctl config nodeapps -a
srvctl status nodeapps -n host01


Public, private, and storage interfaces for Oracle Clusterware:
---------------------------------------------------------------

oifcfg getif


current IP address for the VIP address:
---------------------------------------
srvctl config vip -n host01


To view SCAN LISTENER configuration:
------------------------------------

srvctl config scan_listener


To view SCAN VIP configuration:
-------------------------------

srvctl config scan




NOTE:  srvctl -help   (OR)   srvctl  -h


================================================================================================

onsctl ping
onsctl start


SELECT name FROM v$database;
SELECT instance_name FROM v$instance;
SELECT instance_name FROM gv$instance;
SELECT instance_name, host_name FROM gv$instance;

To verify that instances are running, on any node:

SELECT * FROM V$ACTIVE_INSTANCES;

SELECT * FROM gv$cluster_interconnects;


srvctl -h
srvctl verb noun -h


srvctl config database -d orcl  (to display current policy of the Database orcl)
srvctl status database -d orcl -v
srvctl getenv database –d racdb
srvctl status instance -d orcl -i orcl1, orcl2
srvctl status -o oracle_home
srvctl status asm -a
srvctl status asm -n host01
srvctl config asm -n host02
srvctl status service -d orcl


srvctl stop instance -d db_unique_name -i inst_name -n node_name
srvctl start/stop/config/status -d db_unique_name

srvctl start instance -d orcl -i orcl1,orcl2
srvctl stop instance -d orcl -i orcl1,orcl2
srvctl start database -d orcl -o open
srvctl stop database -d orcl
srvctl stop instance -d orcl -i orcl1


srvctl modify database -d <dbname> -y AUTOMATIC|MANUAL
srvctl modify database -d orcl -y MANUAL;


==============================================================



SQL> select instance_name, host_name from gv$instance;

 col host_name for a20

select instance_name, host_name from gv$instance;


ps -ef | grep ora_ | grep orcl2  current running oracle process


– stop the execution of all rdbms processes (by sending the STOP signal)

[root@host02 ~]#  ps -ef | grep ora_ | grep orcl2 | awk ‘{print $2}’ | while read PID
                               do
                               kill -STOP $PID
                               done





No comments:

Post a Comment

Featured post

Postgres commads

 [oracle@Tesdb ~]$ systemctl status postgresql-15 ● postgresql-15.service - PostgreSQL 15 database server    Loaded: loaded (/usr/lib/system...