Sanjay Adkar
Sanjay Adkar

Reputation: 1

Get BizTalk host instance status from BizTalkMgmtDB

I am trying to query BizTalkMgmtDB database to get list of host instance with their status. Where can i find its current status i.e Running, Stopped and Not Applicable

SELECT 
    h.Name AS HostInstanceName,
    CASE 
        WHEN h.HostType = 1 THEN 'In-Process'
        WHEN h.HostType = 2 THEN 'Isolated'
        ELSE 'Unknown' 
    END AS HostType,
    s.Name AS ServerName,
   CASE 
        WHEN hi.DisableHostInstance = -1 THEN 'Yes'
        WHEN hi.DisableHostInstance = 0 THEN ''
        ELSE 'Unknown' 
    END AS IsDisabled
FROM 
    adm_HostInstance hi
JOIN 
    adm_Server2HostMapping shm ON hi.Svr2HostMappingId = shm.Id
JOIN 
    adm_Host h ON shm.HostId = h.Id
JOIN 
    adm_Server s ON shm.ServerId = s.Id
ORDER BY 
    HostInstanceName;

I didnt find any column which might represent this status

Upvotes: 0

Views: 44

Answers (1)

Ashot
Ashot

Reputation: 11

I think it's better to use a WMI script rather than a direct SQL query to the database. Here's how to get all running host instances:

gwmi MSBTS_HostInstance  -namespace 'root\MicrosoftBizTalkServer' | WHERE {$_.ServiceState -eq 4 }

and get all stopped host instances:

gwmi MSBTS_HostInstance  -namespace 'root\MicrosoftBizTalkServer' | WHERE {$_.ServiceState -eq 1 }

Upvotes: 1

Related Questions