Monday, February 27, 2006

One or more instances of the orchestration still exist

Lately I tried to redeploy a BizTalk 2006 solution from Visual Studio 2005. Unfortunately I was confronted with the following error message “Could not change the bindings for orchestration '.', Version=1.0.0.0,Culture=neutral, PublicKeyToken=c380e04620d206e8' as one or more instances of the orchestration still exist”.
When I tried to Unenlist and delete the Orchestration from the BizTalk Administration tool, I received the same error.

I found out that I had a few suspended instances. These instances need to be terminated before you can undeploy/redeploy the orchestration.

Terminating instances can be done in several manners:
- the polite manner: by terminating the instances using the BizTalk Administration Tool
- the not so polite manner: by using a Stored Procedure to clean up the MessageBox

Removing instances using the BizTalk Administration Tool
In the BizTalk Administration Group click in the left pane on ‘BizTalk Group [Name of Computer/Name of Management database]’. In the right pane the ‘Group Overview’ appears. Click on the tab page ‘New query’ to create a query that searches for the suspended instances. In the ‘Query Expression’ grid the first Search field is already selected, namely ‘Search For’, also the ‘Equals’ operator is already filled in in the second field. All we have to do in the ‘Value’-field is search for suspended instances. And… lucky us: when we open the dropdown box we see that ‘Suspended Service Instances’ is one of the values we can choose! Next, we run the query by hitting the button with the label 'Run Query'. The grid ‘Query results’ now contains all suspended instances found. All we need to do is select all suspended instances, right click on the selection and choose ‘Terminate Instances’. The BizTalk Administration Tool asks for confirmation and removes the instances. When you rerun the query, the instances will be removed and the orchestration can be undeployed/redeployed. So far for the polite manner.

Removing instances using a Stored Procedure
The less polite manner to remove suspended instances is by running a Stored Procedure which will clean up the MessageBox. Attention: this is NOT a recommended procedure on production environments!
Open the SQL Server Management Studio and connect to the database server. In the left pane expand the server-node and the Databases-node. Next, click on the MessageBox-database (BizTalkMsgDb) and hit the ‘New Query’-button in the toolbar. In the right pane you can enter SQL commands. Since you selected the MessageBox-database in the left pane, the commands are executed against that database. Now type: 'exec bts_CleanupMsgbox 0' (without the quotes) and hit the ‘! Execute’-button in the toolbar. All suspended instances will now be removed. You can now undeploy/redeploy the orchestration.

3 comments:

Anonymous said...

Is there a way to remove an active instance of a service? I have an instance I just can't budge.

Lex Hegt said...

I'm sorry for reacting so late. Lately I haven't been much working, since I moved to another place.
But here I am, from TechEd Barcelona.

Yes, you should be able to delete Active instances in the same manner. However when I tried to delete an active instance myself (BTS2006) with the Stored Procedure it did not work, I haven't found out yet, why it did not work.

Anonymous said...

The stored procedure is empty on BTS2006 install - unless you create it with
C:\Program Files\Microsoft BizTalk Server 2006\Schema\msgbox_cleanup_logic.sql
You need to run the stored procedure with "0" as argument, and restart the host instance.