Description:

This Shell script is very useful to calculate and review total no of database shutdown in the year or month. We can schedule the script to crontab for every month.

Script:

#!/bin/sh
date
location=`find / -name alert_$ORACLE_SID.log 2>/dev/null`
read -p “Please enter which year you want ( Please Provide month in sysdate format ( ie : 2018 or 18)) : ” year
read -p “Select any Month Please ( Provide date in sysdate format ( ie : Jul or 07)) : ” month
read -p “If you need DB Shutdown status in detail ? (y/n):” a
if test “$a” = “y”
then
cat $location | grep -B2 “Shutting down instance” | grep -i $year | grep -i $month
else
cat $location | grep -B2 “Shutting down instance” | grep -i $year | grep -i $month | wc -l
fi

 

Note : This is successfully run in Linux Environment.

 

Recent Posts

Start typing and press Enter to search