Shell Script to Ping Hostnames and Send SMS if Host is not Available

We use the below procedure to ping hosts and based on availability send SMS to our team. The SMS is send by calling a web service from the BASH Shell script using curl  The hosts are defined in a file called hosts.txt -- Shell Script -- #!/bin/bash current_time=$(date "+%Y%m%d%H%M%S%3N") #### Above Date Format is in … Continue reading Shell Script to Ping Hostnames and Send SMS if Host is not Available

Check ASM Diskgroup Space and Directory Size

The script below can be used to check the Disk Group Space Free and also Check Directory sizes for each Disk Group The script is written by somebody at Pythian but i cannot re-collect the original link to the blog. eg: ./asmcmd_du.sh DiskGroup Total_MB Free_MB % Free --------- -------- ------- ------ DATAC1 15962112 11215880 70 … Continue reading Check ASM Diskgroup Space and Directory Size

Query to check sessions writing to flashcache on Exadata

Query to check sessions writing to flashcache on Exadata select se.sid, sn.name, s.value, se.program from v$sesstat s natural join v$statname sn left join v$session se on (s.sid = se.sid) where sn.name in ('physical write requests optimized', 'cell writes to flash cache', 'cell overwrites in flash cache') and s.value <> 0 order by s.sid,name;

Shell Script to Monitor Oracle Tablespace and Send Email Alert Only If Threshold Exceeds

[code language="bash"] export MMSG=/tmp/$$.mail export ADDR="email address here" export ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1 export ORACLE_SID=appdev1 file=/tmp/${$}_`date +%Y%m%d` sqlplus -s system/password << .eof > $file set pages 0 select df.tablespace_name tspace, round(sum(fs.bytes)/(df.bytes) * 100) "%_free", round(sum(fs.bytes)/(1024*1024)) free_ts_size, df.bytes/(1024*1024) tot_ts_size from dba_free_space fs, (select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name ) df where fs.tablespace_name = df.tablespace_name group by … Continue reading Shell Script to Monitor Oracle Tablespace and Send Email Alert Only If Threshold Exceeds

Simple Shell Script to Check Diskspace and Send Email on AIX

The below simple shell script will check all filesystems and create output file for only filesystems which are more than 80% full and send the log by email. The below has been checked on AIX7.1 , not too Sure if it works on Solaris. I suppose the -P flag does not work on Solaris. [code language="bash"] … Continue reading Simple Shell Script to Check Diskspace and Send Email on AIX

Shell Script to Monitor AIX Filesystem and Send Email

The Below Shell Script checks the Filesystem mount points and using AWK outputs all filesystem exceeding 90% space to a file called diskspacepoll. Once that is done the sed command removes any special character like '%' from the output file and cleans it to a file called output.log The next important logic is in the … Continue reading Shell Script to Monitor AIX Filesystem and Send Email

How many cores is a process using in Linux

Script to check no. of cores being utilized by a process in linux. Save the script below as a shell script and execute: [root@~]#  sh check_cpu_cores.sh  1111 #!/bin/bash pids=() while [ $# != 0 ]; do pids=("${pids[@]}" "$1") shift done if [ -z "${pids[0]}" ]; then echo "Usage: $0 <pid1> [pid2] ..." exit 1 fi for … Continue reading How many cores is a process using in Linux

Script to Check Total No. of Blocks in Buffer Cache for each User Object

COLUMN object_name FORMAT A40 COLUMN number_of_blocks FORMAT 999,999,999,999 SELECT o.object_name, COUNT(*) number_of_blocks FROM DBA_OBJECTS o, V$BH bh WHERE o.data_object_id = bh.OBJD AND o.owner != 'SYS' GROUP BY o.object_Name ORDER BY COUNT(*);

ASH and AWR Scripts for Checking Wait Events and Top Consuming SQL’s

http://gavinsoorma.com/2012/11/ash-and-awr-performance-tuning-scripts/