Which databases are running on the machine

From dbawiki
Jump to: navigation, search

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