Oracle DBA Scripts All in One -1 – RAC Scripts

Hi,

I will share all Oracle DBA Scripts ( Oracle RAC, Dataguard, Performance Tuning, Monitoring and etc.. ) in this tutorial series.

 

Oracle DBA ( Database Administrator ) needs useful scripts to monitor, analyze and check Oracle database for routine database operations and monitoring.

 

Oracle DBA Scripts All in One post will be updated with new Oracle DBA Scripts.

 

 

Before Oracle DBA Scripts, If you don’t know Oracle database and want to learn, click following link to start learning Oracle database with this tutorial.

 

 

 

Oracle RAC Administration and Monitoring Scripts

To check clusterware status, execute following command.

[root@MehmetSalih1 ~]$ . oraenv
ORACLE_SID = [root] ? +ASM1

[root@MehmetSalih ~]$ 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

[root@MehmetSalih ~]$




To check cluster status, execute following command.

[root@MehmetSalih ~]$ crsctl check cluster  
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online

[root@MehmetSalih ~]$


To check all cluster resource status, execute following command.

[root@Devecidbadm01 ~]# crsctl status resource -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATAC1.dg
               ONLINE  ONLINE       Devecidbadm01              STABLE
               ONLINE  ONLINE       Devecidbadm02              STABLE
ora.DBFS_DG.dg
               ONLINE  ONLINE       Devecidbadm01              STABLE
               ONLINE  ONLINE       Devecidbadm02              STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       Devecidbadm01              STABLE
               ONLINE  ONLINE       Devecidbadm02              STABLE
ora.RECOC1.dg
               ONLINE  ONLINE       Devecidbadm01              STABLE
               ONLINE  ONLINE       Devecidbadm02              STABLE
ora.asm
               ONLINE  ONLINE       Devecidbadm01              Started,STABLE
               ONLINE  ONLINE       Devecidbadm02              Started,STABLE
ora.net1.network
               ONLINE  ONLINE       Devecidbadm01              STABLE
               ONLINE  ONLINE       Devecidbadm02              STABLE
ora.ons
               ONLINE  ONLINE       Devecidbadm01              STABLE
               ONLINE  ONLINE       Devecidbadm02              STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       Devecidbadm02              STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       Devecidbadm01              STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       Devecidbadm01              STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       Devecidbadm01              169.254.94.159,STABL
                                                             E
ora.cvu
      1        ONLINE  ONLINE       Devecidbadm01              STABLE
ora.dbm01.db
      1        ONLINE  OFFLINE                               STABLE
      2        ONLINE  OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.ebys.db
      1        ONLINE  ONLINE       Devecidbadm01              Open,STABLE
      2        ONLINE  ONLINE       Devecidbadm02              Open,STABLE
ora.ebytest.db
      1        OFFLINE OFFLINE                               STABLE
      2        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.mgmtdb
      1        ONLINE  ONLINE       Devecidbadm01              Open,STABLE
ora.oc4j
      1        ONLINE  ONLINE       Devecidbadm01              STABLE
ora.repdb.db
      1        ONLINE  ONLINE       Devecidbadm01              Open,STABLE
      2        ONLINE  ONLINE       Devecidbadm02              Open,STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       Devecidbadm02              STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       Devecidbadm01              STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       Devecidbadm01              STABLE
ora.test.db
      1        OFFLINE OFFLINE                               STABLE
      2        ONLINE  OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.test.db
      1        OFFLINE OFFLINE                               STABLE
      2        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.Deveci.db
      1        ONLINE  ONLINE       Devecidbadm01              Open,STABLE
      2        ONLINE  ONLINE       Devecidbadm02              Open,STABLE
ora.Devecidbadm01.vip
      1        ONLINE  ONLINE       Devecidbadm01              STABLE
ora.Devecidbadm02.vip
      1        ONLINE  ONLINE       Devecidbadm02              STABLE
--------------------------------------------------------------------------------
[root@Devecidbadm01 ~]#


To stop Clusterware on specific node, execute following command. Set ASM profile before executing crsctl command.

[root@MehmetSalih1 ~]$ . oraenv
ORACLE_SID = [root] ? +ASM1

[root@MehmetSalih ~]$ crsctl stop crs



To start Clusterware on specific node, execute following command. Set ASM profile before executing crsctl command.

[root@MehmetSalih1 ~]$ . oraenv
ORACLE_SID = [root] ? +ASM1

[root@MehmetSalih ~]$ crsctl start crs


To disable Clusterware on specific node, execute following command. Set ASM profile before executing crsctl command.

[root@MehmetSalih ~]$ crsctl disable crs



To enable Clusterware on specific node, execute following command. Set ASM profile before executing crsctl command.

[root@MehmetSalih ~]$ crsctl enable crs



To Query Voting disk location, execute following command. Set ASM profile before executing crsctl command.

[oracle@MehmetSalih ~]$ crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE bd81ab8e27a64fbebf7b6b326c5f614d (/dev/mapper/HDD_E0_S03_1418288932p1) [DATA]
2. ONLINE 450684e276874ff9bff52d481befa809 (/dev/mapper/HDD_E0_S15_1420185788p1) [DATA]
3. ONLINE fd1efd6de5204f6bbfe9793a480c517f (/dev/mapper/HDD_E0_S06_1423843312p1) [DATA]
Located 3 voting disk(s).



To find OCR files location, execute following command.

[root@MehmetSalih ~]# cat /etc/oracle/ocr.loc
#Device/file +DATA getting replaced by device +DATA/Deveci-c/OCRFILE/registry.255.923150247
ocrconfig_loc=+DATA/Deveci-c/OCRFILE/registry.255.923150247
local_only=false

[root@MehmetSalih ~]#
[root@MehmetSalih ~]#




To check the status of the Oracle Cluster registry , execute following command.

[root@MehmetSalih ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 4
Total space (kbytes) : 409568
Used space (kbytes) : 2412
Available space (kbytes) : 407156
ID : 2022573354
Device/File Name : +DATA
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

[root@MehmetSalih ~]#




To add voting disk, execute following command. Set ASM profile before executing crsctl command.

crsctl add css votedisk new_vote_disk_path



To Delete voting disk, execute following command. Set ASM profile before executing crsctl command.

crsctl delete css votedisk new_vote_disk_path


To Add voting disk to ASM Disk, execute following command.

crsctl add votedisk asm_disk_group



To Replace or Migrate voting disk, execute following command.

crsctl replace votedisk asm_diskgroup / vote_disk_path


To find OCR backup location,  execute following command. Set ASM profile before executing crsctl command.

ocrconfig –showbackup auto


To change OCR Backup location, execute following command.

ocrconfig –backuploc Shared_PATH


To Add OCR files location, execute following command.

ocrconfig –add Location_PATH

 

To Replace or Change OCR files location, execute following command.

ocrconfig –replace New_PATH


To Repair OCR files location, execute following command. Cluster or Oracle RAC Services should be power off.

ocrconfig –repair –add +DATAC1

 

 

 

You can access the second Oracle DBA scripts related to Dataguard with following link.

 

 

Oracle DBA Scripts All in One post will be updated with new Oracle DBA Scripts.

Mehmet Salih Deveci

I am Founder of IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress mehmetsalih.deveci@outlook.com.-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  mehmetsalih.deveci@outlook.com a mail atabilirsiniz.

6 thoughts on “Oracle DBA Scripts All in One -1 – RAC Scripts

Leave a Reply

Your email address will not be published. Required fields are marked *