Showing posts with label Terminate Active Isolated Adapter Isolated Host Instances Suspend. Show all posts
Showing posts with label Terminate Active Isolated Adapter Isolated Host Instances Suspend. Show all posts

Thursday, 30 April 2015

Terminate Active Isolated Adapter (Isolated Host Instances ) Instances - SQL Script


I have been trying to delete the Active Instances in my BizTalk Admin Console which are related to IsolatedHost Instance.

I knew that I have to be patient enough to suspend/ terminate or may be Restart IIS could give a bit of breathing to clear them from console.

What if you curious to terminate them quickly ( not in production ) ? here is the simple Database script which would help you to crack the wall.


USE BizTalkMsgBoxDb

DECLARE @ServiceInstanceID VARCHAR(100)
DECLARE @ServiceID VARCHAR(100)

DECLARE ActiveInstance_cursor CURSOR FOR SELECT [uidInstanceID] ,[uidServiceID] FROM [BizTalkMsgBoxDb].[dbo].[Instances]  WHERE nState = 2

OPEN ActiveInstance_cursor

FETCH NEXT FROM ActiveInstance_cursor  INTO @ServiceInstanceID, @ServiceID
PRINT 'Note : Please start all BizTalk HostInstances before running this script..'
PRINT 'Warning : Start terminating the Active instances... please be aware that, you could potentially missing the data..! '

WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @out INT
BEGIN TRANSACTION
exec dbo.int_AdminTerminateInstance_BizTalkServerIsolatedHost @ServiceInstanceID, @ServiceID ,@out
COMMIT

FETCH NEXT FROM ActiveInstance_cursor INTO  @ServiceInstanceID, @ServiceID
END

CLOSE ActiveInstance_cursor
DEALLOCATE ActiveInstance_cursor

PRINT 'Completed...!'


Drop a comment if this article helped you to solve your problem. you can reach me @ raj.webjunky@yahoo.com