Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Monthly Count of Database Startup And Shutdown

$
0
0

Steps
 
      -Set Your Environment file or .bash_profile
        - export Your ORACLE_SID
         -Save the Below Script in “.sh” format

Monthly Count of Database Startup :

#!/bin/sh
date
location=`find / -name alert_$ORACLE_SID.log 2>/dev/null`
read -p "Please enter which year you want  : " year
echo -e "\e[96m Month in based on your Oracle Version \e "
echo -e "\e[31m Up to 12.1 enter month in words ie:Jul,Aug,Jan.... in 12.2 enter month in numbers ie:02,03,07...."
echo -e "\e[39m"
read -p "Select any Month Please : " month
read -p "If you need DB Startup status in detail ? (y/n):" a
if test "$a" = "y"
then
cat $location | grep -B2 "Starting ORACLE instance" | grep -i $year | grep -i $month
else
cat $location | grep -B2 "Starting ORACLE instance" | grep -i $year | grep -i $month | wc -l
fi

 
 




Monthly Count of Database Downtime :

#!/bin/sh
date
location=`find / -name alert_$ORACLE_SID.log 2>/dev/null`
read -p "Please enter which year you want  : " year
echo -e "\e[96m Month in based on your Oracle Version \e "
echo -e "\e[31m Up-to 12.1 enter month in words ie:Jul,Aug,Jan....in 12.2 enter month in numbers ie:02,03,07....:"
echo -e "\e[39m"
read -p "Select any Month Please : " month
read -p "If you need DB Shutdown status in detail ? (y/n):" a
if test "$a" = "y"
then
cat $location | grep -B2 "Instance shutdown complete" | grep -i $year | grep -i $month
else
cat $location | grep -B2 "Instance shutdown complete" | grep -i $year | grep -i $month | wc -l
fi

 

 

 


Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>