Monday, 18 February 2019

All Oracle RAC commands

# adding a datafile in asm/rac
===============================
alter tablespace abc add datafile '+DATA' size 4000M;

# resizing a datafile in asm/rac
=================================
alter database datafile '+DATA/vigp/datafile/abc.337.735734779' resize 4500m;


To check all diskgroups and total and free space in each giskgroups;
===================================================
SQL> select name,total_mb,free_mb,state from v$asm_diskgroup;

NAME                             TOTAL_MB    FREE_MB STATE
------------------------------ ---------- ---------- -----------
OCR_VOTE                            17263      16867 MOUNTED
ARCH                                34524      27696 MOUNTED
DATA                              2382220    1464356 MOUNTED


To check cluster services are up or not
======================================
ps -ef|grep d.bin


TO modify the spfile use below command.
=======================================
srvctl modify database -d erppgrt1 -p '+ERPDEVT1_DATA/ERPDEVT1/PARAMETERFILE/spfile.715.811079031'


To check the configuation of the database
============================
srvctl config database -d ERPDEVT1


To count the number of datafiles in asm
========================================
grid@tsgsq4914 $ asmcmd ls -l +ERPDEVT1_DATA/ERPDEVT1/DATAFILE/* |wc -l
    1247
grid@tsgsq4914 $


To check the diskgroup
+++++++++++++++++++++
ASMCMD> lsdg ERPDEVT1_DATA
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576   1514516    23749                0           23749              0             N  ERPDEVT1_DATA/
ASMCMD>

SQL> select NAME,GROUP_NUMBER,TOTAL_MB,USABLE_FILE_MB,FREE_MB from V$ASM_DISKGROUP where name like '%ERPDEVT1%';

NAME                           GROUP_NUMBER   TOTAL_MB USABLE_FILE_MB    FREE_MB
------------------------------ ------------ ---------- -------------- ----------
ERPDEVT1_ACFS                            40     219144           2795       2795
ERPDEVT1_ARCH                            41      32771           5292       5292
ERPDEVT1_DATA                            42    1514516          23749      23749



Lists information about current Oracle ASM clients from the V$ASM_CLIENT view.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SQL> select GROUP_NUMBER,DB_NAME,STATUS from V$ASM_CLIENT;

GROUP_NUMBER DB_NAME  STATUS
------------ -------- ------------
          42 ERPDEVT1 CONNECTED
          41 ERPDEVT1 CONNECTED

SQL>


ASMCMD> lsct ERPDEVT1_DATA
DB_Name   Status     Software_Version  Compatible_version  Instance_Name  Disk_Group
ERPDEVT1  CONNECTED        11.2.0.2.0          11.2.0.0.0  ERPDEVT1      ERPDEVT1_DATA
ASMCMD>


to check how many disk are there in the disk group
=====================================================

-G diskgroup    - Specifies the disk group that contains the open disks

lsod -G ERPDEVT1_DATA
Instance Process                      OSPID Path
2        oracle@cssdd (DBW0)      10560 /dev/rdsk/c0t60060E8016012500000101250000A3C4d0s0
2        oracle@cssdd (DBW0)      10560 /dev/rdsk/c0t60060E8016012500000101250000A3DDd0s0
2        oracle@cssdd (DBW0)      10560 /dev/rdsk/c0t60060E8016012500000101250000A3E5d0s0



The example shows disk space used in the  directory in data, including all of the directories under the DATAFILE directory.
==================================================================

ASMCMD> du ERPDEVT1/DATAFILE
Used_MB      Mirror_used_MB
1463070             1463070

  ORASMCMD> du DATAFILE
Used_MB      Mirror_used_MB
1463070             1463070
ASMCMD>


How to use find command in asmcmd prompt
============================================
ASMCMD> find ERPDEVT1_DATA undo*
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.354.786964749
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.666.786960981
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.719.786962615
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.730.786963069
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.734.786962497
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.735.786962661
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.738.786962991
ASMCMD>

or
grid@csssd $ asmcmd find ERPDEVT1_DATA undo*
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.290.844340797
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.299.844343459
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.380.844342391
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.596.844347911
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.640.844338441
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.734.844340941
+ERPDEVT1_DATA/ERPDEVT1/DATAFILE/UNDOTBS.803.844340967
grid@csssd $



To list disks of a specific diskgroup, say, ERPDEVT1_DATA, you can use the -d flag as shown below
=======================================================

  ASMCMD> lsdsk -t -G ERPDEVT1_DATA
Create_Date  Mount_Date  Repair_Timer  Path
15-MAY-12    28-MAY-12   0             /dev/rdsk/c0t60060E8016012500000101250000A3C4d0s0
15-MAY-12    28-MAY-12   0             /dev/rdsk/c0t60060E8016012500000101250000A3DCd0s0
15-MAY-12    28-MAY-12   0             /dev/rdsk/c0t60060E8016012500000101250000A3DDd0s0
15-MAY-12    28-MAY-12   0             /dev/rdsk/c0t60060E8016012500000101250000A3DEd0s0
15-MAY-12    28-MAY-12   0             /dev/rdsk/c0t60060E8016012500000101250000A3E4d0s0
15-MAY-12    28-MAY-12   0             /dev/rdsk/c0t60060E8016012500000101250000A3E5d0s0
ASMCMD>


Displays the Oracle Restart configuration information for the Oracle ASM instance.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
oracle@csssd $ srvctl config asm -a

ASM home: /opt/oracle/product/grid/11.2.0.3
ASM listener: LISTENER
ASM is enabled.

An example of this command to display configuration and enabled/disabled status for the database with the DB_UNIQUE_ID orcl is:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
oracle@csssd $ srvctl config database -d erpdevt1 -a
Database unique name: erpdevt1
Database name:
Oracle home: /erpdevt1/oracle/11.2.0
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: erpdevt1
Database instances: erpdevt11,erpdevt12
Disk Groups: ERPDEVT1_DATA,ERPDEVT1_ARCH
Mount point paths:
Services:
Type: RAC
Database is enabled
Database is administrator managed
oracle@csssd $


To check disk group status
++++++++++++++++++++++++++
oracle@csssd5906 $    srvctl status diskgroup -g ERPDEVT1_DATA
Disk Group ERPDEVT1_DATA is running on csssd5930,csssd5908,csssd5932,csssd5906,csssd5990,csssd599


Checking where scan listener is running
++++++++++++++++++++++++++++++++++++++++
oracle@csssd5906 $ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node csssd5906
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node csssd5930
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node csssd5992


To check all the nodes in the cluster
+++++++++++++++++++++++++++++++++++
csssd5906 > olsnodes -n
csssd5906       1
csssd5908       2
csssd5930       3
csssd5932       4
csssd5990       5
csssd5992       6


csssd5906 > ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       9548
         Available space (kbytes) :     252572
         ID                       :  771726667
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

To check the disk timeout
+++++++++++++++++++++++++++
csssd5906 > csssd5906 > crsctl get css disktimeout
CRS-4678: Successful get disktimeout 200 for Cluster Synchronization Services.

To check the miscount
+++++++++++++++++++++++++++
csssd5906 > crsctl get css misscount
CRS-4678: Successful get misscount 30 for Cluster Synchronization Services.


Status of all instances and services
=====================================
$ srvctl status database -d orcl
Instance orcl1 is running on node node1
Instance orcl2 is running on node ndoe2


Status of a single instance
====================================
$ srvctl status instance -d orcl -i orcl2
Instance orcl2 is running on node node2

Status of node applications on a particular node
================================================
$ srvctl status nodeapps -n node1
VIP is running on node: node1
GSD is running on node: node1
Listener is running on node: node1
ONS daemon is running on node: node1


Status of an ASM instance
===============================
$ srvctl status asm -n node1
ASM instance +ASM1 is running on node node1.


List all configured databases
================================
$ srvctl config database
orcl


Display configuration for our RAC database
==============================================
$ srvctl config database -d orcl
node1 orcl1 /u01/app/oracle/product/10.1.0/db_1
node2 orcl2 /u01/app/oracle/product/10.1.0/db_1


Display all services for the specified cluster database
=====================================================
$ srvctl config service -d orcl
orcltest PREF: orcl2 orcl1 AVAIL:


Display the configuration for node applications - (VIP, GSD, ONS, Listener)
==========================================================
$ srvctl config nodeapps -n node1 -a -g -s -l
VIP exists.: /vip-linux1/192.168.101.5/255.255.255.0/eth0:eth1
GSD exists.
ONS daemon exists.
Listener exists.


Display the configuration for the ASM instance(s)
========================================================
$ srvctl config asm -n node1
+ASM1 /u01/app/oracle/product/10.1.0/db_1



How to check scan status
++++++++++++++++++++++++
srvctl status scan


Check config of scan
+++++++++++++++++++
srvctl config scan


Starting scan listener
++++++++++++++++++++++
$GRID_HOME/bin/srvctl start scan_listener

Relocate Scan
++++++++++++++
srvctl relocate scan -i 1 -n csssddbuat01 -- (cssddbuat01 is a new node name where u want to reallocate scan 1)

Start Cluster services on bi1
+++++++++++++++++++++++++++++++
crsctl start cluster -n oraclebi1

Stop resource
++++++++++++++
crsctl stop resource ora.crsd

start resource
++++++++++++++
crsctl start resource ora.crsd


Stop diskgroups and ASM instance
+++++++++++++++++++++++++++++
srvctl stop diskgroup -g data
srvctl stop diskgroup -g backup
srvctl stop asm



csssd5906 > ocrconfig -showbackup

csssd5906     2013/11/22 21:13:32     /opt/oracle/product/grid/11.2.0.3/cdata/er

csssd5906     2013/11/22 17:13:26     /opt/oracle/product/grid/11.2.0.3/cdata/er

csssd5906     2013/11/22 13:13:22     /opt/oracle/product/grid/11.2.0.3/cdata/er

csssd5906     2013/11/21 13:12:57     /opt/oracle/product/grid/11.2.0.3/cdata/er

csssd5906     2013/11/15 13:09:55     /opt/oracle/product/grid/11.2.0.3/cdata/er
PROT-25: Manual backups for the Oracle Cluster Registry are not available

To know cluster Name
+++++++++++++++++++++++++++
csssd5906 > olsnodes -c
csssd12

To check CRS status
+++++++++++++++++++++++++++
csssd5906 > crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online.

To check cluster status
+++++++++++++++++++++++
csssd5906 > crsctl check cluster
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
csssd5906 >


How to go for help on olsnode
+++++++++++++++++++++++++++++++
$ ./olsnodes -h
Usage: olsnodes [ [-n] [-i] [-s] [-t] [<node> | -l [-p]] | [-c] ] [-g] [-v]
where
-n print node number with the node name
-p print private interconnect address for the local node
-i print virtual IP address with the node name
<node> print information for the specified node
-l print information for the local node
-s print node status - active or inactive
-t print node type - pinned or unpinned
-g turn on logging
-v Run in debug mode; use at direction of Oracle Support only.
-c print clusterware name




To find cluster node status/print node status - active or inactive
========================
[root@csssd5933 ~]# olsnodes -s
csssd5911       Active
csssd5913       Active
csssd5931       Active
csssd5933       Active

To find virtual IP address
======================
[root@csssd5933 ~]# olsnodes -i
csssd5911       csssd5911-vip
csssd5913       csssd5913-vip
csssd5931       csssd5931-vip
csssd5933       csssd5933-vip

To find print information for the local node
============================================
[root@csssd5933 cpu]# olsnodes -l
csssd5933
[root@csssd5933 cpu]#


To find nodes are pinned/unpinned
================================
[root@csssd5933 ~]# olsnodes -t
csssd5911       Unpinned
csssd5913       Unpinned
csssd5931       Unpinned
csssd5933       Unpinned
[root@csssd5933 ~]

Relocate resource to other node
=================================
[root@csssd5911 grid]#  crsctl relocate resource appcssd2.appvip -n csssd5933 -f
CRS-2673: Attempting to stop 'appcssd2_em_agent' on 'csssd5911'
CRS-2677: Stop of 'appcssd2_em_agent' on 'csssd5911' succeeded
CRS-2673: Attempting to stop 'appcssd2.appvip' on 'csssd5911'


Stop particular resource in RAC and check status
==============================
grid@csssd5906 $ crsctl stop res erpdevt1_conc_mgr
CRS-2673: Attempting to stop 'erpdevt1_conc_mgr' on 'csssd5932'
CRS-2677: Stop of 'erpdevt1_conc_mgr' on 'csssd5932' succeeded

grid@csssd5906 $ crsctl status res erpdevt1_conc_mgr
NAME=erpdevt1_conc_mgr
TYPE=conc_mgr
TARGET=OFFLINE
STATE=OFFLINE

No comments:

Post a Comment