This is 2 node Cluster: Node1 & Node2
[oraprod@node1 ~]$ ps -ef|grep smon
root 13869 1 1 00:09 ? 00:00:56 /u01/app/19.0.0.0/grid/bin/osysmond.bin
oracle 14278 1 0 00:10 ? 00:00:00 asm_smon_+ASM1
oracle 15184 1 0 00:10 ? 00:00:00 ora_smon_ORA19C
oraprod 15276 1 0 00:10 ? 00:00:00 ora_smon_SINGLE
oracle 15351 1 0 00:10 ? 00:00:00 ora_smon_CDBDB1
oracle 15378 1 0 00:10 ? 00:00:00 ora_smon_RAC12C1
oracle 15678 1 0 00:10 ? 00:00:00 ora_smon_CDB1
oracle 15759 1 0 00:10 ? 00:00:00 ora_smon_PRIMDB1
oraprod 22165 1 0 00:26 ? 00:00:00 ora_smon_ORAPROD1
oraprod 30323 20060 0 01:05 pts/0 00:00:00 grep --color=auto smon
[oraprod@node1 ~]$
[oraprod@node2 ~]$ ps -ef|grep smon
root 4178 1 1 Jan01 ? 1-13:27:12 /u01/app/19.0.0.0/grid/bin/osysmond.bin
oracle 5663 1 0 Jan01 ? 00:02:48 asm_smon_+ASM2
oraprod 8630 28730 0 01:04 pts/0 00:00:00 grep --color=auto smon
oracle 22302 1 0 Feb29 ? 00:01:52 ora_smon_CDBDB2
oracle 22308 1 0 Feb29 ? 00:01:01 mdb_smon_-MGMTDB
oracle 22359 1 0 Feb29 ? 00:01:59 ora_smon_RAC12C2
oracle 22771 1 0 Feb29 ? 00:03:05 ora_smon_PRIMDB2
oracle 26469 1 0 Mar23 ? 00:00:16 ora_smon_CDB2
oracle 30889 1 0 Jan06 ? 00:03:16 ora_smon_RAC1N_2
oraprod 31546 1 0 00:26 ? 00:00:00 ora_smon_ORAPROD2
[oraprod@node2 ~]$
This 2 node RAC cluster has +DATA and +RECO diskgroup
[oraprod@node1 ~]$ . oraenv
ORACLE_SID = [+ASM1] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oraprod@node1 ~]$
[oraprod@node1 ~]$ env |grep ORA
ORACLE_SID=+ASM1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/19.0.0.0/grid
[oraprod@node1 ~]$
[oraprod@node1 ~]$ asmcmd -p lsdg
State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 512 4096 4194304 81904 8572 0 8572 0 Y DATA/
MOUNTED EXTERN N 512 512 4096 4194304 40952 18948 0 18948 0 N RECO/
[oraprod@node1 ~]$
These +DATA and +RECO diskgroups have multiple sub directories inside
[oraprod@node1 ~]$ asmcmd -p
ASMCMD [+] > cd DATA/
ASMCMD [+DATA] > ls -l
Type Redund Striped Time Sys Name
Y ASM/
N CDB/
N CDBDB/
Y ORA19C/
N ORAPROD/
N PRIMDB/
N RAC12C/
N RAC1N/
N SINGLE/
N _mgmtdb/
CONTROLFILE UNPROT FINE MAR 07 13:00:00 N cdbdbsnapcf_cdbdb1.f => +DATA/CDBDB/CONTROLFILE/Backup.256.1106324849
Y node-clu/
CONTROLFILE UNPROT FINE MAR 07 13:00:00 N ora19csnapcf_ora19c.f => +DATA/ORA19C/CONTROLFILE/Backup.257.1106324849
ASMCMD [+DATA] > cd +RECO/
ASMCMD [+RECO] > ls -l
Type Redund Striped Time Sys Name
N CDB/
N CDBDB/
Y ORAPROD/
Y PRIMDB/
Y RAC12C/
Y RAC1N/
Y SINGLE/
ASMCMD [+RECO] > exit
[oraprod@node1 ~]$
With helpf of this find_ASM_direcory_size.sh automation script we can figure out which directory or database consumes more space and take a necessary action accordngly
[oraprod@node1 ~]$ cd /mnt/script/
[oraprod@node1 script]$ ll find_ASM_direcory_size.sh
-rwxr-xr-x 1 oracle oinstall 1016 Jan 26 2023 find_ASM_direcory_size.sh
[oraprod@node1 script]$ sh find_ASM_direcory_size.sh
Please provide a directory !
[oraprod@node1 script]$
Below command will get all the directory usage under +DATA diskgroup
[oraprod@node1 script]$ sh find_ASM_direcory_size.sh DATA
DATA subdirectories size
Subdir Used MB Mirror MB
------ ------- ---------
ASM/ 0 0
CDB/ 10008 10008
CDBDB/ 8456 8456
ORA19C/ 64 64
ORAPROD/ 5460 5460
PRIMDB/ 9684 9684
RAC12C/ 6560 6560
RAC1N/ 4012 4012
SINGLE/ 3696 3696
_mgmtdb/ 24976 24976
cdbdbsnapcf_cdbdb1.f 0 0
node-clu/ 208 208
ora19csnapcf_ora19c.f 0 0
------ ------- ---------
Total 73124 73124
[oraprod@node1 script]$
Below command will get all the directory usage under +RECO diskgroup
[oraprod@node1 script]$ sh find_ASM_direcory_size.sh RECO
RECO subdirectories size
Subdir Used MB Mirror MB
------ ------- ---------
CDB/ 1508 1508
CDBDB/ 2504 2504
ORAPROD/ 3020 3020
PRIMDB/ 5080 5080
RAC12C/ 5136 5136
RAC1N/ 2456 2456
SINGLE/ 2132 2132
------ ------- ---------
Total 21836 21836
[oraprod@node1 script]$
Even we can further drilldown and check the each sudirectorywise utilisation
Below command will get all the sub-directory usage under +RECO/PRIMDB directory
[oraprod@node1 script]$ sh find_ASM_direcory_size.sh RECO/PRIMDB/
RECO/PRIMDB/ subdirectories size
Subdir Used MB Mirror MB
------ ------- ---------
ARCHIVELOG/ 3180 3180
CONTROLFILE/ 64 64
ONLINELOG/ 1836 1836
------ ------- ---------
Total 5080 5080
[oraprod@node1 script]$
Script:
[root@oracledb script]# cat find_ASM_direcory_size.sh
#!/bin/bash
#
# du of each subdirectory in a directory for ASM
#
# Purpose: This script will help in finding the size of the all the direcotirs and subdirectories inside ASM DiskGroup
# AUTHOR: Mallikarjun Ramadurg
# SCRIPT Name: find_ASM_direcory_size.sh
# Usage: Run this script at OS level after setting enviromental variable to ASM with input parameters as shown below
# Example: sh find_ASM_direcory_size.sh DATA
# Example: sh find_ASM_direcory_size.sh DATA/ORADB
#
D=$1
if [[ -z $D ]]
then
echo "Please provide a directory !"
exit 1
fi
(for DIR in `asmcmd ls ${D}`
do
echo ${DIR} `asmcmd du ${D}/${DIR} | tail -1`
done) | awk -v D="$D" ' BEGIN { printf("\n\t\t%40s\n\n", D " subdirectories size") ;
printf("%25s%16s%16s\n", "Subdir", "Used MB", "Mirror MB") ;
printf("%25s%16s%16s\n", "------", "-------", "---------") ;}
{
printf("%25s%16s%16s\n", $1, $2, $3) ;
use += $2 ;
mir += $3 ;
}
END { printf("\n\n%25s%16s%16s\n", "------", "-------", "---------");
printf("%25s%16s%16s\n\n", "Total", use, mir) ;} '
[root@oracledb script]#
Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com / info@vismotechnologies.com
No comments:
Post a Comment