This discussion is archived
4 Replies Latest reply: Sep 17, 2009 8:06 AM by 722875 RSS

Query to find number of host running on windows

722875 Newbie
Currently Being Moderated
Hi to all,
I am new in this database field.
I have a small query that how can i find the number of database running on a particular host in windows environment by query??

Please help me......
Waiting for reply.......
  • 1. Re: Query to find number of host running on windows
    Deepak_DBA Pro
    Currently Being Moderated
    hi,


    there is no query... use net start in cmd prompt and check for oracleserviceSID... count number of services.. its equal to number of database in that machine.. or else see in services.msc..


    regards,
    Deepak
  • 2. Re: Query to find number of host running on windows
    CharlesHooper Expert
    Currently Being Moderated
    user11207304 wrote:
    Hi to all,
    I am new in this database field.
    I have a small query that how can i find the number of database running on a particular host in windows environment by query??

    Please help me......
    Waiting for reply.......
    You might want to verify that Oracle's definition of database matches what you believe is a database. There is no query in Oracle which will show you the database instances on a Windows server. That said, here is a portion of a WMI script from the book "Expert Oracle Practices: Oracle Database Administration from the Oak Table" which will do it for you as long as the database instance is started (even on a remote server if you have administrator privileges on the remote server):
    Dim objWMIService
    Dim strSQL
    Dim strComputer
    Dim colItems
    Dim objItem
    
    strSQL = "SELECT * FROM Win32_Process Where Name like 'Oracle%'"
    
    strComputer = "."  ' the . indicates the local computer 
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\CIMV2") 
    
    Set colItems = objWMIService.ExecQuery(strSQL,"WQL",48)
    
    For Each objItem in colItems
      Wscript.Echo "Instance: " & objItem.CommandLine & vbCrLf
    Next
    To run the above script, save it as a text file with the extension .VBS. Open a Windows command prompt, and type cscript followed by the name of the script:
    C:\> cscript c:\databases.vbs
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

    Edited by: Charles Hooper on Sep 16, 2009 10:16 AM
    Added how to run the script
  • 3. Re: Query to find number of host running on windows
    722875 Newbie
    Currently Being Moderated
    Thanks Charles for the reply.
    Now my doubt is clear.
  • 4. Re: Query to find number of host running on windows
    722875 Newbie
    Currently Being Moderated
    Thanks Deepak for the reply.
    It resolve my query.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points