Friday 5 April 2013

BizTalk BAM Undeploy definitions


Many times I use to forget the BAM Definition file where I saved and struggled to un-deploy the BAM definition without BAM definition file. Hope many of you faced this situation.
Here is easy way of creating definition file even you missed the file.


All you have to do is Create the BAM definition struction as mentioned below.


Run the below query to get Activity and view xml structures which was  already deployed in your server.

Use [BAMPrimaryImport]

SELECT  A.[ActivityName],
A.ViewName,
B.[DefinitionXml] 'ActivityXml', 
C.[DefinitionXml] 'ViewXml' 
FROM
[dbo].[bam_Metadata_ActivityViews] A 
Inner Join [dbo].[bam_Metadata_Activities] B
On A.[ActivityName]= B.[ActivityName]
Inner Join [dbo].[bam_Metadata_Views] C 
On A.ViewName = C.ViewName

Copy the ActivityXMl and ViewXML to the newly created BAM definition xml file.

Now you need execute the undeploy command.

"C:\Program Files (x86)\Microsoft BizTalk Server 2010\Tracking\bm.exe" remove-all -DefinitionFile:"NewDefinitionFile.xml"