Last day, I was at one training for Oracle installation and service start & shutdown. There I came to know about some Linux commands to start and shutdown an Oracle instance on a Linux machine.
To identify the instance running : The command below will return all Oracle instances which are currently running on that machine.
ps -ef | grep pmon
This command returns following results:
oracle 823 1 0 Dec03 ? 00:00:17 ora_pmon_instance1
oracle 19632 1 0 Nov17 ? 00:06:35 ora_pmon_instance2
oracle 24199 1 0 Nov20 ? 00:05:23 ora_pmon_instance3
Where instance1
, instance2
and instance3
are 3 installations of Oracle on Linux, which are currently running.
My query: So, ps -ef
will only show processes currently running. Suppose, instance3
is down and you need to start that instance. But, you don't know how many Oracle instances there are on the machine.
How would you get to know that this instance is down?
In Windows, there is a way called services, where you could came to know that these installations are done on Windows for Oracle.
Best Answer
There's no fool-proof way, but here's a list of ideas for you:
/etc/oratab:
Little script to give you a list of SIDs in the
oratab
:$ORACLE_HOME/dbs
You can adapt the above script to look in all
$ORACLE_HOME
s listed in theoratab
, and search for initSID.ora and spfiles for any instances:tnsnames.ora / listener.ora
Another option is to look in each
$ORACLE_HOME/network/admin
and analyse thetnsnames.ora
andlistener.ora
files to see which instances have been configured.Already Running Instances
You've already covered this with your
pmon
search. You can also uselsnrctl status
to see which instances the listener is currently servicing requests for.