iSelfSchooling.com - Community of Sharing

Click here for Online Oracle 8i, 9i, 10g, 11g and 12c Training

from www.iSelfSchooling.com

September 22, 2017, 08:57:51 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1] |   Go Down
  Send this topic  |  Print  
Author Topic: How to get a list of all my oracle databases with different Oracle home?  (Read 38846 times)
AllanDBA
AllanDBA
Newbie
Newbie
*
Posts: 0


« on: June 25, 2015, 08:45:23 AM »

How to get a list of all my oracle databases with different Oracle home?

The following UNIX shell script will list all the Oracle active databases and make files for each Oracle version.
For example: F_12102.txt contains all the Oracle SID names of release of 12.1.0.2, F_12101.txt contains all the Oracle SID names of release 12.1.0.1, F_all.txt contains all versions.

#!/bin/bash

ps -ef|grep pmon > F_xxx;
 > F_12101.txt;
 > F_11203.txt;
 > F_12102.txt;
 > F_all.txt;

while read -r xxxline;
do
{
   ## echo $xxxline;
   ## echo $xxxline | cut -d' ' -f2 -- pid
   ## echo $xxxline | cut -d' ' -f3 -- by pass
   i=`echo $xxxline | cut -d' ' -f2`

   echo $i;
   if [ `pargs -e ${i} | grep ORACLE_HOME= | cut -d: -f2 | cut -d'/' -f5` = '12.1.0.2' ]
      then
         pargs -e ${i} | grep ORACLE_SID= | cut -d: -f2 | cut -d'=' -f2 >> F_12102.txt;
         pargs -e ${i} | grep ORACLE_SID= | cut -d: -f2 | cut -d'=' -f2 >> F_all.txt;

   fi

   if [ `pargs -e ${i} | grep ORACLE_HOME= | cut -d: -f2 | cut -d'/' -f5` = '12.1.0.1' ]
      then
         pargs -e ${i} | grep ORACLE_SID= | cut -d: -f2 | cut -d'=' -f2 >> F_12101.txt;
         pargs -e ${i} | grep ORACLE_SID= | cut -d: -f2 | cut -d'=' -f2 >> F_all.txt; 

   fi

   if [ `pargs -e ${i} | grep ORACLE_HOME= | cut -d: -f2 | cut -d'/' -f5` = '11.2.0.3' ]
      then
         pargs -e ${i} | grep ORACLE_SID= | cut -d: -f2 | cut -d'=' -f2 >> F_11203.txt;
         pargs -e ${i} | grep ORACLE_SID= | cut -d: -f2 | cut -d'=' -f2 >> F_all.txt; 

   fi

}
done <./F_xxx

Good luck!
--admin
Logged
Pages: [1] |   Go Up
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!