Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Listing Oracle Databases on Windows

375 views
Skip to first unread message

dan1...@attbi.com

unread,
Mar 2, 2003, 4:11:58 AM3/2/03
to
Hi Oracle DBAs,

In UNIX, to get a list of Oracle databases on a server, I do this in my
script:
grep ^[A-Z,a-z] /etc/oratab

Is there a way that I can script out getting a list of Oracle databases and
its Oracle Home in a Windows environment? I'm trying to write a script that
will run for each Oracle database on a server.

Also, is there a way of doing this using PERL?

Thanks in advance.


Sybrand Bakker

unread,
Mar 2, 2003, 11:51:02 AM3/2/03
to


You would probably need VBscrpt to call the Windows API to retrieve a
list of appropiate services.

A database in sqlserver equates a schema in Oracle.
Your post distinctly smells of having way too many instances on a
server


Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address

Bill Davison

unread,
Mar 2, 2003, 7:58:49 PM3/2/03
to
Since each database in Windows has its own service, you can search for
service names. There's a command line utility in the Windows 2000 Resource
Kit called Service List (sclist.exe). I can email it to you off list if you
like, size is only 6KB. One caveat - depending on how you shut down your
databases it's possible for the database to be down even though its service
is still running.

Finding the Oracle home for each DB is trickier, I think the only answer is
to pull it out of the registry. There are probably some add-on Perl
packages you can download for this. On Windows 2000 I think you're looking
for
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\OracleService<your_sid>
\ImagePath. There's another windows resource kit tool called regdmp.exe
that you can use instead of Perl, but it spits out everything under
OracleService<your_sid>, so you'd have more output than you want.

Here are the details on sclist:

usage: SCLIST [-?] [-r] [-s] [MachineName]
[-?] Display this message
[-r] Display only running services
[-s] Display only stopped services
[-MachineName] Machine name to list services

Output looks like this (only have the listener and one database running on
this machine):

C:\>sclist -r

--------------------------------------------
- Service list for Local Machine (running)
--------------------------------------------
running Alerter Alerter
running AvSynMgr AVSync Manager
running BITS Background Intelligent
Transfer Service
running Browser Computer Browser
running Dhcp DHCP Client
running dmserver Logical Disk Manager
running Dnscache DNS Client
running Eventlog Event Log
running EventSystem COM+ Event System
running lanmanserver Server
running lanmanworkstation Workstation
running LmHosts TCP/IP NetBIOS Helper
Service
running LogWatch Event Log Watch
running McShield McShield
running Netman Network Connections
running NtmsSvc Removable Storage
running Oracle8i_homeTNSListener Oracle8i_homeTNSListener
running OracleServiceTEST OracleServiceTEST
running PlugPlay Plug and Play
running ProtectedStorage Protected Storage
running RasMan Remote Access Connection
Manager
running RemoteRegistry Remote Registry Service
running RpcSs Remote Procedure Call
(RPC)
running SamSs Security Accounts Manager
running Schedule Task Scheduler
running seclogon RunAs Service
running SENS System Event Notification
running Spooler Print Spooler
running TapiSrv Telephony
running TrkWks Distributed Link Tracking
Client
running WinMgmt Windows Management
Instrumentation
running WMDM PMSP Service WMDM PMSP Service
running Wmi Windows Management
Instrumentation Driver Extensions
running wuauserv Automatic Updates

<dan1...@attbi.com> wrote in message
news:yVj8a.310694$HN5.1...@rwcrnsc51.ops.asp.att.net...

Paul Drake

unread,
Mar 3, 2003, 1:19:49 AM3/3/03
to
"Bill Davison" <wdav...@fpcc.net> wrote in message news:<3e62...@news.starnetinc.com>...

> Since each database in Windows has its own service, you can search for
> service names. There's a command line utility in the Windows 2000 Resource
> Kit called Service List (sclist.exe). I can email it to you off list if you
> like, size is only 6KB. One caveat - depending on how you shut down your
> databases it's possible for the database to be down even though its service
> is still running.
>
> Finding the Oracle home for each DB is trickier, I think the only answer is
> to pull it out of the registry. There are probably some add-on Perl
> packages you can download for this. On Windows 2000 I think you're looking
> for
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\OracleService<your_sid>
> \ImagePath. There's another windows resource kit tool called regdmp.exe
> that you can use instead of Perl, but it spits out everything under
> OracleService<your_sid>, so you'd have more output than you want.
>
> <dan1...@attbi.com> wrote in message
> news:yVj8a.310694$HN5.1...@rwcrnsc51.ops.asp.att.net...
> > Hi Oracle DBAs,
> >
> > In UNIX, to get a list of Oracle databases on a server, I do this in my
> > script:
> > grep ^[A-Z,a-z] /etc/oratab
> >
> > Is there a way that I can script out getting a list of Oracle databases
> > and its Oracle Home in a Windows environment?
> > I'm trying to write a script that
> > will run for each Oracle database on a server.
> > Also, is there a way of doing this using PERL?
> >
> > Thanks in advance.
> >
> >

Bill,

I was hoping to find such a tool at:
http://www.microsoft.com/windows2000/techinfo/reskit/tools/default.asp

where microsoft provides a subset of W2K Resource Kit tools.
Its not there. Might just have to shell out the bucks to get the
Resource Kit.
The Professional version is only $38.25 on bookpool.
The Server version lists at $299 - discounted to $164.95, but out of
stock.
That's too steep for me.

As sclist appeared to only provide details as to services that are
running, I think that a simple "net start" command could provide the
same info.

If one dumps out a "system info report" (w2K) aka "diagnostics report"
(nt4) one could parse the contents of that, but again, the tool to
create such a report in a command line fashion is part of the resource
kit. This report tends to have all services - whether started or not -
listed.

other thoughts:

If the server is configured in an OFA fashion,

1. examine all of the password file names in each
%ORACLE_HOME%\Database
2. examine all of the ifiles names in each %ORACLE_HOME%\Database
3. examine all of the folders under %ORACLE_BASE%\Admin

guess that isn't much help.

Paul

Rauf Sarwar

unread,
Mar 3, 2003, 2:06:52 AM3/3/03
to
<dan1...@attbi.com> wrote in message news:<yVj8a.310694$HN5.1...@rwcrnsc51.ops.asp.att.net>...


Each installed database on a Windows NT based systems has a service
entry in the registry. Service name is like "OracleService<SID>". To
query regisrty, there is an NT resource kit utility called REG.EXE
which you can download for free from
http://www.dynawell.com/support/Reskit/winnt.asp. Look for "Registry
command line utility". Once you have that, you can use following
sequence of commands from a batch script,

I have two instances on my laptop TEST920 and TEST817

@ECHO OFF
SET REGSTR=HKLM\SYSTEM\CURRENTCONTROLSET\SERVICES
FOR /F "delims=[,]" %%A IN ('REG QUERY %REGSTR%^|find /i
"OracleService"') DO (
REG QUERY %REGSTR%\%%A\ImagePath) >> OUT.TXT
FOR /F "tokens=1-4" %%A IN (OUT.TXT) DO ECHO %%D

Will display

TEST817
TEST920

If I use the last command as,

FOR /F "tokens=1-4" %%A IN (OUT.TXT) DO ECHO %%C

Will display Oracle.exe executable with complete path for both
databases like,

C:\Oracle\Ora817\bin\Oracle.exe
C:\Oracle\Ora920\bin\Oracle.exe

You can easily parse out these to extract Oracle home.

Regards
/Rauf Sarwar

Andreas Necker

unread,
Mar 3, 2003, 8:15:17 AM3/3/03
to
Hi,

dan1...@attbi.com wrote:
> Hi Oracle DBAs,
>
> In UNIX, to get a list of Oracle databases on a server, I do this in my
> script:
> grep ^[A-Z,a-z] /etc/oratab
>
> Is there a way that I can script out getting a list of Oracle databases and
> its Oracle Home in a Windows environment? I'm trying to write a script that
> will run for each Oracle database on a server.
>

you can get the service names with an NET START:

-------------------------------------------------------
C:\>net start
Folgende Windows 2000-Dienste sind gestartet:
...
OracleDEFAULT_HOMETNSListener
OracleServiceTECD
...
-------------------------------------------------------

> Also, is there a way of doing this using PERL?
>

You can use the package "Win32::TieRegistry" for querying
"HKLM\Software\Oracle\HOMEn".

hth
Andreas

Brian E Dick

unread,
Mar 3, 2003, 10:32:14 PM3/3/03
to
You can also get a list of services and just about everything else running
on Win2K by using Windows Management Instrumentation (WMI) in VBScript or
JavaScript. And it's all part of the OS.

"Paul Drake" <drak...@yahoo.com> wrote in message
news:1ac7c7b3.03030...@posting.google.com...

0 new messages