Difference between revisions of "Which databases are running on the machine"

From dbawiki
Jump to: navigation, search
(How to see what databases have been defined (running or not))
(From Windows)
 
Line 6: Line 6:
  
 
==From Windows==
 
==From Windows==
 +
This shows the service name and its state
 
<pre>
 
<pre>
sc query | perl -00 -ne 'print "$1 $2\n"  if /^SERVICE_NAME: OracleService(\w+).DISPLAY.+?STATE\s+:\s+\d\s+(\w+)/s'
+
sc query | perl -00 -ne 'print "$1 $2\n"  if /^SERVICE_NAME: OracleService(\w+).TYPE.+?STATE\s+:\s+\d\s+(\w+)/s'
 +
</pre>
 +
<pre>
 +
DEV running
 +
</pre>
 +
To see the value of ORACLE_HOME on Windows, use another sc query:
 +
<pre>
 +
sc qc OracleServiceDEV
 +
</pre>
 +
The ORACLE_HOME and the instance name can be found on the 'BINARY_PATH_NAME' line.
 +
<pre>
 +
SERVICE_NAME: OracleServiceDEV
 +
DISPLAY_NAME: Oracle Instance
 +
        TYPE              : 10  WIN32_OWN_PROCESS
 +
        START_TYPE        : 3  DEMAND_START
 +
        ERROR_CONTROL      : 1  NORMAL
 +
        BINARY_PATH_NAME  : c:\oracle\product\11.2.0\db\bin\ORACLE.EXE DEV
 +
        LOAD_ORDER_GROUP  :
 +
        TAG                : 0
 +
        DISPLAY_NAME      : OracleServiceDEV
 +
        DEPENDENCIES      :
 +
        SERVICE_START_NAME : LocalSystem
 
</pre>
 
</pre>

Latest revision as of 13:58, 20 June 2017

From Unix[edit]

The 'uniq' should not be necessary!

ps -ef|grep [o]ra_pmon|sed -e 's/.*_//'|sort|uniq

From Windows[edit]

This shows the service name and its state

sc query | perl -00 -ne 'print "$1 $2\n"  if /^SERVICE_NAME: OracleService(\w+).TYPE.+?STATE\s+:\s+\d\s+(\w+)/s'
DEV running

To see the value of ORACLE_HOME on Windows, use another sc query:

sc qc OracleServiceDEV

The ORACLE_HOME and the instance name can be found on the 'BINARY_PATH_NAME' line.

SERVICE_NAME: OracleServiceDEV
DISPLAY_NAME: Oracle Instance
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 3   DEMAND_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : c:\oracle\product\11.2.0\db\bin\ORACLE.EXE DEV
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : OracleServiceDEV
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem