Logo

UNIX Shell Script

Show Installed Oracle Version

Tested on Oracle 8.1 Tested on Oracle 8.0 Tested on Oracle 7

Updated : 8-January-2002
Version : 1.1

Description

This script will list out all Oracle products installed by the last Oracle install. It provides a simple way to get all versions of all Oracle products installed on a UNIX environment and does NOT need the database to be started. It uses the oratab file as it's starting point, so make sure it's up to date.

Now works better with 8i installs.

Parameters

None.

Shell Source

#! /bin/ksh
# Locate oratab file, exit if we can't find it
if [ -f /etc/oratab ]; then
  ORATAB="/etc/oratab" ;
elif [ -f /var/opt/oracle/oratab ]; then
  ORATAB="/var/opt/oracle/oratab" ;
else
  echo
  echo "ERROR: Unable to locate oratab file"
  exit 1 ;
fi

# Display Simple Header
echo
echo "Oracle Software Version(s) Installed on" `date`
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

# LOOP for each unique ORACLE_HOME found in the oratab
# Get the oracle version from the install log

for i in `egrep '^[a-zA-Z].*:.*:.*$' $ORATAB | awk -F: '{ print $2}' | sort -u `
do
     echo
     echo "Software Installed In ORACLE_HOME = " $i
     echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"

  if [ -f $i/install/unix.rgs ]; then
     grep '"rdbms"' $i/install/unix.rgs | awk -F\" '{ print $6 " " $4}'

     echo
     echo "Consists of the following Software"
     echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"

     cat $i/install/unix.rgs | sort

   elif [ -f $i/orainst/unix.rgs ]; then

     grep '"rdbms"' $i/orainst/unix.rgs | awk -F\" '{ print $6 " " $4}'

     echo
     echo "Consists of the following Software"
     echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"

     grep -v '"rdbms"' $i/orainst/unix.rgs | awk -F\" '{print $6 " " $4}' | sort

   else

     echo "ERROR: Unable to locate installation registry"
     return 1 ; 

   fi
done
exit 0                                                                          

Return to Index of SQL Scripts


Home | Company Profile | Services | Contact Us | SQL scripts and tips | Quiz
Legal

Logo