Quantcast
Channel: Configuration – SANDRO PEREIRA BIZTALK BLOG
Viewing all 74 articles
Browse latest View live

BizTalk 2013 Installation and Configuration – Configure SQL Server Network Configuration protocols (Part 10)

$
0
0

Under certain stress conditions (such as clients accessing SQL Server from the same computer), the SQL Server Shared Memory protocol may lower BizTalk Server performance. You can resolve this problem by disabling the use of the Shared Memory network protocol in SQL Server Network Configuration. Also, to facilitate transactions between SQL Server and BizTalk Server, you must enable TCP/IP and Named Pipes in SQL Server.

To configure the protocols for SQL Server:

  • Press the “Windows key” to switch to Metro UI and type “SQL Server Configuration Manager” and click in “SQL Server Configuration Manager” option on Apps menu.

BTS-2013-SQLNet-01-SQL-Server-Configuration-Manager-metro-UI

  • In SQL Server Configuration Manager windows, from the left-hand pane expand “SQL Server Network Configuration” option and then click “Protocols for MSSQLSERVER”
    • Verify that both “TCP/IP” and “Named Pipes” are enabled;
      • If not, right-click in the protocol, and then click “Enable”
      • Repeat to enable the other protocol if necessary.
    • Verify that “Shared Memory” id Disable.
      • If not, right-click Shared Memory, and then click “Disable”

BTS-2013-SQLNet-02-SQL-Server-Configuration-Manager-Protocols-for-MSSQLSERVER

  • In the left-hand pane, click “SQL Server Services”, right-click “SQL Server (MSSQLSERVER)”, and then click “Stop”. After the service has stopped, right-click “SQL Server (MSSQLSERVER)” again, and then click “Start”.

BTS-2013-SQLNet-03-SQL-Server-Configuration-Manager-SQL-Server-Services-restart

  • Close SQL Server Configuration Manager.

Related links



BizTalk 2013 Installation and Configuration – Validate Mail account used by BizTalk to send BAM Alerts (Part 11)

$
0
0

After you configure with success BizTalk Server 2013 BAM Alerts, the configurator will create a new Database Mail Account called “BAM_Alerts_Account” that will be used by BizTalk to send BAM Alerts.

To Validate Mail account used by BizTalk to send BAM Alerts:

  • Press the “Windows key” to switch to Metro UI and type “SQL Management” or “SQL” and click in “SQL Server Management Studio” option on Apps menu.
  • In Object Explorer panel, connect to the SQL Server instance you want to configure Database Mail on, and expand the server tree.
  • Expand the “Management” node and double click “Database Mail” to open the Database Mail Configuration Wizard.
  • On the Welcome to Database Mail Configuration Wizard page, click “Next” to continue
  • On the Select Configuration Task page, select “Manage Database Mail accounts and profiles” option and click “Next”
  • On the Manage Profiles and Accounts page, select “View, change or delete an existent account” option, and click “Next”

BTS-2013-BAM-Database-Mail-01-Manage-Profiles-and-Accounts-page

  • On the Manage Existent Account page, select “BAM_Alerts_Account” option under “Account name” and validate the configuration. After that click “Next” to make any change or “Cancel” to exit.

BTS-2013-BAM-Database-Mail-02-Manage-Existent-Account-page

Finally you should test sending an email with this Database Mail Account, to do that:

  • Right-click on Database Mail and select “Send Test E-Mail…”

BTS-2013-BAM-Database-Mail-03-Send-Test-E-Mail

  • On the Send Test E-mail from windows, specify a “To:” email and click “Send Test E-Mail”

BTS-2013-BAM-Database-Mail-04-Send-Test-E-Mail-details

If all goes well you should receive the email in a few seconds. If you have received the email, you have been able to configure Database Mail successfully.

Related links


BizTalk 2013 Installation and Configuration – Installing BizTalk Adapter Pack (Part 12)

$
0
0

BizTalk Adapter Pack 2010 along with BizTalk AppFabric Connect, RFID features, UDDI services and ESB Toolkit are not automatically installed with the default installation process, instead you have to additional install this features

The Microsoft BizTalk Adapter Pack contains adapters that enable enterprise applications and databases to interface with each other by implementing a common adapter framework. Similar to programming to Web services, adapters enable clients to program to different enterprise applications. Technically, adapters are a binding to Windows Communication Framework (WCF). The BizTalk Adapter Pack consists of the following adapters:

  • Microsoft BizTalk Adapter for Oracle Database (Oracle Database adapter).
  • Microsoft BizTalk Adapter for Oracle E-Business Suite (Oracle E-Business adapter).
  • Microsoft BizTalk Adapter for mySAP Business Suite (SAP adapter). This also includes the .NET Framework Data Provider for mySAP Business Suite (Data Provider for SAP).
  • Microsoft BizTalk Adapter for Siebel eBusiness Applications (Siebel adapter). This also includes the .NET Framework Data Provider for Siebel eBusiness Applications (Data Provider for Siebel).
  • Microsoft BizTalk Adapter for SQL Server (SQL adapter).

To install BizTalk Adapter Pack:

  • Close any programs you have open. Run the BizTalk Server 2013 installer as Administrator.
  • On the Start screen, click “Install Microsoft BizTalk Adapters

BTS-2013-Adapter-Pack-01-Install-Microsoft-BizTalk-Adapters

  • In the next Start screen, the first step is to install WCF LOB Adapter SDK, select the “Step 1. Install Microsoft WCF LOB Adapter SDK”. An installer of SDK is launched.

BTS-2013-Adapter-Pack-02-Step-1-Install-Microsoft-WCF-LOB-Adapter-SDK

    • The WCF LOB Adapter SDK is a collection of a run-time engine and tools that help adapter developers create service-oriented interfaces to existing LOB systems by using WCF. The goal of the SDK is to facilitate uniform development of reusable, metadata-oriented, WCF-based adapters that enable enterprise applications, databases, and messaging platforms to integrate with each other.
    • On the Welcome to the Windows Communication Foundation LOB adapter SDK Setup Wizard screen, click “Next”

BTS-2013-Adapter-Pack-03-Welcome-Windows-Communication-Foundation-LOB-adapter-SDK-Setup-Wizard-screen

    • On the End-User License Agreement screen, select “I accept the terms in the License Agreement” to accept the license agreement and click “Next”

BTS-2013-Adapter-Pack-04-End-User-License-Agreement-screen

    • In the Choose Setup Type screen, select the installation type “Complete”:
      • Typical: will install the common run time and tools,
      • Custom: will allow you to select the features that you want to install and the installation location.
      • Complete: will install all the features.

BTS-2013-Adapter-Pack-05-Choose-Setup-Type-screen

    • On the Ready to install WCF LOB adapter SDK screen, click “Install”

BTS-2013-Adapter-Pack-06-Ready-install-WCF-LOB-adapter-SDK-screen

    • On the Completed the Windows Communication Foundation LOB Adapter SDK Setup Wizard screen, click “Finish”

BTS-2013-Adapter-Pack-07-Completed-screen

  • Back to the Start screen, the second step is installation of the Adapter Pack (x86), select the “Step 2. Install Microsoft BizTalk Adapter Pack”. An installer of SDK is launched.

BTS-2013-Adapter-Pack-08-Step-2-Install-Microsoft-BizTalk-Adapter-Pack

    • On the Welcome to the Microsoft BizTalk Adapter Pack Setup Wizard screen, click “Next”

BTS-2013-Adapter-Pack-09-Welcome-Microsoft-BizTalk-Adapter-Pack-Setup-Wizard-screen

    • On the End-User License Agreement screen, select “I accept the terms in the License Agreement” to accept the license agreement and click “Next”

BTS-2013-Adapter-Pack-10-End-User-License-Agreement-screen

    • In the Choose Setup Type screen, select the installation type “Complete”:
      • Typical: will install the common run time and tools,
      • Custom: will allow you to select the features that you want to install and the installation location.
      • Complete: will install all the features.

BTS-2013-Adapter-Pack-11-Choose-Setup-Type-screen

    • On the Ready to install Microsoft BizTalk Adapter Pack screen, click “Install”

BTS-2013-Adapter-Pack-12-Ready-install-Microsoft-BizTalk-Adapter-Pack-screen

    • On the Customer Experience Improvement Program screen, select if you want to join the customer experience improvement program or not and click “OK”

BTS-2013-Adapter-Pack-13-Customer-Experience-Improvement-Program-screen

    • On the Completed the Microsoft BizTalk Adapter Pack Setup Wizard screen, click “Finish”

BTS-2013-Adapter-Pack-14-Completed-Microsoft-BizTalk-Adapter-Pack-Setup-Wizard-screen

  • Back to the Start screen, the next step is installing the Microsoft BizTalk Adapter Pack (x64) – note that before you install this pack you have to install x86 first – select the “Step 3. Install Microsoft BizTalk Adapter Pack(x64)”. An installer of SDK is launched.

BTS-2013-Adapter-Pack-15-Step-3-Install-Microsoft-BizTalk-Adapter-Pack(x64)

    • On the Welcome to the Microsoft BizTalk Adapter Pack(x64) Setup Wizard screen, click “Next”

BTS-2013-Adapter-Pack-16-Welcome-Microsoft-BizTalk-Adapter-Pack(x64)-Setup-Wizard-screen

    • On the End-User License Agreement screen, select “I accept the terms in the License Agreement” to accept the license agreement and click “Next”

BTS-2013-Adapter-Pack-17-End-User-License-Agreement-screen

    • In the Choose Setup Type screen, select the installation type “Complete”:
      • Typical: will install the common run time and tools,
      • Custom: will allow you to select the features that you want to install and the installation location.
      • Complete: will install all the features.

BTS-2013-Adapter-Pack-18-Choose-Setup-Type-screen

    • On the Ready to install Microsoft BizTalk Adapter Pack(x64), click “Install”

BTS-2013-Adapter-Pack-19-Ready-install-Microsoft-BizTalk-Adapter-Pack(x64)

    • On the Customer Experience Improvement Program screen, select if you want to join the customer experience improvement program or not and click “OK”

BTS-2013-Adapter-Pack-20-Customer-Experience-Improvement-Program-screen

    • On the Completed the Microsoft BizTalk Adapter Pack(x64) Setup Wizard screen, click “Finish”

BTS-2013-Adapter-Pack-21-Completed-Microsoft-BizTalk-Adapter-Pack(x64)-Setup-Wizard-screen

  • Back to the Start screen, the final step is installing the Microsoft BizTalk Adapters for Enterprise Applications, select the “Step 4. Install Microsoft BizTalk Adapters for Enterprise Applications”. An installer of SDK is launched.

BTS-2013-Adapter-Pack-22-Step-4-Install-Microsoft-BizTalk-Adapters-for-Enterprise-Applications

    • On the Welcome to the Microsoft BizTalk Adapters for Enterprise Applications Setup Wizard screen, click “Next”

BTS-2013-Adapter-Pack-23-Welcome-Microsoft-BizTalk-Adapters-for-Enterprise-Applications-Setup-Wizard-screen

    • On the End-User License Agreement screen, select “I accept the terms in the License Agreement” to accept the license agreement and click “Next”

BTS-2013-Adapter-Pack-24-End-User-License-Agreement-screen

    • In the Customer Information screen, type your User Name and Organization and click “Next” to continue.

BTS-2013-Adapter-Pack-25-Customer-Information-screen

    • In the Choose Setup Type screen, select the installation type “Complete”:
      • Custom: will allow you to select the features that you want to install and the installation location.
      • Complete: will install all the features.

BTS-2013-Adapter-Pack-26-Choose-Setup-Type-screen

    • On the Choose Destination Location screen, choose the folder location that to want to install this features and click “Next”

BTS-2013-Adapter-Pack-27-Choose-Destination-Location-screen

    • On the Ready to install screen, click “Install”

BTS-2013-Adapter-Pack-28-Ready-install-screen

    • On the Completed the Microsoft BizTalk Adapters for Enterprise Applications Setup Wizard screen, click “Finish”

BTS-2013-Adapter-Pack-29-Completed-Microsoft-BizTalk-Adapters-for-Enterprise-Applications-Setup-Wizard-screen

  • Close the Start screen, click “Exit”.

BTS-2013-Adapter-Pack-30-Success

Microsoft BizTalk Adapter Pack and Microsoft BizTalk Adapter Pack (x64)

If I’m preparing an x64 environment machine why do I need to install both x86 and x64 Microsoft BizTalk Adapter Pack and not only x64 pack?

On any computer where you want to perform design-time tasks using either Visual Studio or BizTalk MMC, you must install the 32-bit adapter because:

  • BizTalk Server Administration console runs as a 32-bit Microsoft Management Console (MMC) application.
  • Visual Studio is also a 32-bit application (and there isn’t any 64-bit version of Visual Studio)

However for BizTalk run time perspective:

  • If you want to run the adapters under a 32-bit BizTalk process (Host Instance): you need to install Microsoft BizTalk Adapter Pack.
  • If you want to run the adapters under a 64-bit BizTalk process (Host Instance): you need to install Microsoft BizTalk Adapter Pack (x64).

So you always have to install Microsoft BizTalk Adapter Pack, or in other cases, you always need to install the 32-bit adapter if you want to perform any operation at design-time, especially, configuring the adapters in the administrative console.

Add adapters to BizTalk Administration Console

As it happens with all adapters that we installed on our BizTalk Servers before we can begin to use it we need to register or add the adapter. So the next step is adding the appropriate adapters in BizTalk Administration Console. To accomplish that we need to:

· Open BizTalk Administration Console by pressing the “Windows key” to switch to Metro UI and type “BizTalk Server Administration” or “BizTalk”, right-click “BizTalk Server Administration” option on Apps menu

  • In the console left tree, expand “BizTalk Server Administration –> BizTalk Group –> Platform Settings” and then “Adapters”
  • Right-click on “Adapters” and add a new adapter by selecting the option “New –> Adapter”

BTS-2013-Adapter-Pack-31-Add-adapters-BizTalk-Administration-Console

  • In the “Adapter Properties” window
    • In the Name box, type a descriptive name for this adapter.
    • In the Adapter combo box, select the adapter from the drop-down that you want to add.
    • In the Description box, type a description for the adapter (this is optional).

BTS-2013-Adapter-Pack-32-WCF-OracleDB-Adapter-Properties

  • Click “OK” to complete the process of adding the adapter.
  • Repeat steps to add the other adapters.

Note: This configurations requires that you restart the host instance associated with the adapter.

Related links


BizTalk 2013 Installation and Configuration – Install and Configure Microsoft UDDI Services (Part 13)

$
0
0

UDDI Services provides Universal Description, Discovery, and Integration (UDDI) capabilities for sharing information about Web services within an organization’s intranet, between business partners on an extranet, or on the Internet. UDDI Services can help improve the productivity of developers and information technology (IT) professionals with more reliable and manageable applications. With UDDI Services you can prevent duplication of effort by promoting reuse of existing development work.

In a stand-alone installation, all default and optional components are installed on a single server. An instance of SQL Server must be installed before installing UDDI Services. When installing UDDI Services, the local instance of SQL Server is used to host the UDDI Services Database. UDDI Services Web Application and Notification Service are then configured to use the local UDDI Services Database.

To install Microsoft UDDI Services:

  • Close all applications before running setup. Run the BizTalk Server 2013 installer as Administrator.
  • On the Start screen, click “Install Microsoft UDDI Services”

BTS-2013-UDDI-01-Install-Microsoft-BizTalk-Adapters

  • On the License Agreement screen, select “Yes, I accept the terms in the license agreement” to accept the license agreement and click “Next”

BTS-2013-UDDI-02-License-Agreement-screen

  • On the Component Installation screen:
    • In “Available Components”: select and click from the available components you want to install
    • In “Install To”: specify a location to install UDDI Services components
    • And then click “Next” to continue

BTS-2013-UDDI-03-Component-Installation-screen

  • On the Summary screen, review installation details and then click Install.

BTS-2013-UDDI-04-Summary-screen

  • On the Installation Completed screen, select "Launch Microsoft UDDI Services Configuration" option and then click “Finish” to start the UDDI Services configuration.

BTS-2013-UDDI-05-Installation-Completed-screen

  • On the Microsoft UDDI Services Configuration screen, apply the following configurations and then click “Configure” to continue:
    • Select “Basic configuration” option
    • In the “Database server name” field under “Database” properties, enter the name of the local computer that will hosts the UDDI database.
    • In the “Service credential” properties, type the User name and Password for the account that the UDDI services will run under

BTS-2013-UDDI-06-Microsoft-UDDI-Services-Configuration-screen

  • Note: You may receive a warning if you enter a user name with administrative credentials on this computer. Click “Yes” to continue.

BTS-2013-UDDI-07-Microsoft-UDDI-Services-Configuration-warning-screen

  • On the Summary screen, review configuration information, and then click “Next”
    • You may receive an warning on the UDDI Services Notification Service, don’t worry, we’ll deal with that later

BTS-2013-UDDI-08-Summary-screen

  • On the Completed screen, review configuration information:
    • If UDDI Services Notification Service is failed, which is the case
      • Select “Launch Custom Configuration” option
    • And then click “Finish”

BTS-2013-UDDI-09-Completed-screen

  • On the Microsoft BizTalk Server Configuration (UDDI) screen, from the left pane, select “UDDI Services Notification Service” option and configure the following settings:
    • Select “Enable UDDI Services Notification Service” option
    • Under “Windows Service”, set the service account under which the UDDI Notification Service runs.
    • Under “SMTP”, type the SMTP server for sending e-mail notifications.
    • Under “E-mail address”, type the address of the e-mail account used for sending e-mail notifications.
    • Under “SMTP Authentication”, specify the type of authentication used when authenticating with the SMTP server.
    • When finish, click “Apply Configuration”

BTS-2013-UDDI-10-Enable-UDDI-Services-Notification-Service

  • Click “Apply Configuration” to apply the configuration that you made.
  • On the Summary screen, review configuration information, and then click “Next”

BTS-2013-UDDI-11-UDDI-Services-Notification-Service-Summary-screen

  • On the Completed screen, review configuration information and then click “Finish”

BTS-2013-UDDI-12-UDDI-Services-Notification-Service-Completed-screen

Verify Your Installation

To verify that Microsoft UDDI Services is installed correctly:

  • Open Internet Explorer and type http://localhost/uddi, and then hit Enter
    • If UDDI Services is installed correctly, you will see the Welcome to Microsoft UDDI Services page.

BTS-2013-UDDI-12-Microsoft-UDDI-Services-browser

Related links


BizTalk 2013 Installation and Configuration – Install and Configure the Microsoft BizTalk ESB Toolkit (Part 14)

$
0
0

BizTalk Server includes a powerful publish/subscribe mechanism for messaging applications that works by creating and filling subscriptions, which provides a highly efficient and scalable platform for service-oriented architecture (SOA) applications. The BizTalk ESB Toolkit extends the functionality of BizTalk Server to provide a range of new capabilities focused on building robust, connected, service-oriented applications that incorporate itinerary-based service invocation for lightweight service composition, dynamic resolution of endpoints and maps, Web service and WS-* integration, fault management and reporting, and integration with third-party SOA governance solutions.

The good news is that with BizTalk Server 2013, Microsoft BizTalk ESB Toolkit is integrated with the BizTalk Server setup.

To install the Microsoft BizTalk ESB Toolkit

  • Close any programs you have open. Run the BizTalk Server 2013 installer as Administrator.
  • On the BizTalk Server installation Start screen, click “Install Microsoft BizTalk ESB Toolkit”.

BTS-2013-UDDI-01-Install-Microsoft-BizTalk-ESB-Toolkit

  • On the License Agreement screen, select “Yes, I accept the terms of the license agreement” to accept the license agreement and click “Next”

BTS-2013-UDDI-02-License-Agreement-screen

  • On the Component Installation screen, select the components you want to install and then click “Next”

BTS-2013-UDDI-03-Component-Installation-screen

  • On the Summary screen, review installation details and then click Install.

BTS-2013-UDDI-04-Summary-screen

  • On the Installation Completed screen, click “Finish” to close the installation wizard.

BTS-2013-UDDI-05-Installation-Completed-screen

To configure the Microsoft BizTalk ESB Toolkit

  • Press the “Windows key” to switch to Metro UI and type “ESB Configuration tool” or “ESB”, right-click “ESB Configuration tool” option on Apps menu, and then click “Run as Administrator”.
    • Note: You must run the ESB Configuration Tool as an administrator.

BTS-2013-UDDI-06-ESB-Configuration-Tool-metro-UI

  • In the ESB Configuration Tool screen, from the left pane, select “ESB Configuration” and on the right pane:
    • For “Database Server (Defaults)”: specify the database server name where the databases required for BizTalk ESB Toolkit will be created.
    • In the “IIS Web Services (Defaults)” box:
      • Specify the user credentials under which the applications required for BizTalk ESB Toolkit will be created.
      • Also specify the name of the website in IIS under which the applications will be created.
    • The “BizTalk User Groups (Defaults)” box lists the default user groups available for ESB configuration.
      • Leave the default values
      • Important: At this stage, you can click “Apply Configuration” towards the top of the ESB Configuration Tool to configure the Microsoft BizTalk ESB Toolkit with the default settings. However, we will continue to configure the remains steps for a custom configuration.

BTS-2013-UDDI-07-ESB-Configuration-Tool-screen-ESB-Configuration

  • From the left pane, expand “Exception Management” and do the following:
    • Click in the “Database” option and on the right pane:
      • Select “Enable Exception Management Database” check box to configure an exception management database.
      • In “Database server name”: specify the database server name where you want to create this database (specify the same database server name that you specify in the ESB Configuration panel under Database Server (Default) option)
      • In “Database name”: leave the default name “EsbExceptionDb”.
      • Leave the default groups

BTS-2013-UDDI-08-ESB-Exception-Management-Database

    • Click on the “Exception Web Services” option from the left pane and on the right pane:
      • Select “Enable Exception Services” check box to configure these services.
      • In “User Account” and “user Account Password”: specify the user account and password under which this services will run.
      • In “BizTalk Isolated Group” – Leave the default value “BizTalk isolated Host Users”
      • In “Website Name”: specify the website where you want to run these services.

BTS-2013-UDDI-09-ESB-Exception-Management-Exception-Web-Services

  • From the left pane, expand “ESB Core Components”, and do the following:
    • Click the “Itinerary Database” option and on the right pane:
      • Select the “Itinerary Database” check box to configure an itinerary database.
      • In “Database server name”: specify the database server name where you want to create this database (specify the same database server name that you specify in the ESB Configuration panel under Database Server (Default) option)
      • In “Database name”: leave the default name “EsbItineraryDb”.
      • Leave the default groups

BTS-2013-UDDI-10-ESB-ESB-Core-Components-Itineray-Database

    • Click on the “Core Web Services” option from the left pane and on the right pane:
      • Select the “Enable Core Services” check box to configure these services.
      • In “User Account” and “user Account Password”: specify the user account and password under which this services will run.
      • In “BizTalk Isolated Host Group” – Leave the default value “BizTalk isolated Host Users”
      • In “Website Name”: specify the website where you want to run these services.

BTS-2013-UDDI-11-ESB-ESB-Core-Components-Core-Web-Services

  • From the left pane, click “Configuration” to specify the SSO configuration.
    • If you are installing and configuring the Microsoft BizTalk ESB Toolkit in a single server environment, you should select “File Configuration Source”, which is the default selection. However, if you are setting up a multiple-machine deployment, you must select the “SSO Configuration Source”, and then provide the following values.
      • SSO Server: Name of the SSO server.
      • Configuration file: Click the ellipsis button (…), and then browse to the Esb.config file, which is included in the ​Microsoft BizTalk ESB Toolkit
      • Application Name: Type a name for the SSO application. For example, ESB Toolkit.
      • Contact Information: Type the appropriate contact information in the following format: someone@example.com.
      • Administrator Group Name: Click the ellipsis button (…), and then browse to the appropriate name
      • User Group Name: Click the ellipsis button (…), and then browse to the appropriate name
    • Select “File Configuration Source”

BTS-2013-UDDI-12-ESB-Configuration

  • Click “Apply Configuration” on the top of the ESB Configuration Tool to configure the Microsoft BizTalk ESB Toolkit. Open IIS and notice that the applications required for Microsoft BizTalk ESB Toolkit are now created under the website you specified.

BTS-2013-UDDI-13-ESB-IIS

  • Back to the “ESB Configuration Tool”, from the left pane, click “ESB BizTalk Applications” option, from the right pane, do the following:
    • Select the “Enable ESB Core Components in BizTalk Server” check box to create the application in the BizTalk Server Administration console.
      • Select the “Use Default Binding” to bind this application to the default host.
      • Optional you can select the “Do not use Default Binding” if you do not want to bind the application to the default host. In such a case, you must explicitly bind the application to a host, once the application is created.
    • Select the “Enable ESB JMS/WMQ Components in BizTalk Server” check box to create the application in the BizTalk Server Administration console.
      • Select the “Use Default Binding” to bind this application to the default host.
      • Optional you select the “Do not use Default Binding” if you do not want to bind the application to the default host. In such a case, you must explicitly bind the application to a host, once the application is created.

BTS-2013-UDDI-14-ESB-ESB-BizTalk-Applications

  • Click “Apply Configuration” on the top of the ESB Configuration Tool to create the applications you selected. Verify that the applications are created in the BizTalk Server Administration console.

BTS-2013-UDDI-15-ESB-BizTalk-Applications

Install Critical Windows Updates and BizTalk Server Cumulative Update Package

Once again, after all of this installations, I like to do a Windows update and if necessary restart the server, this step is not necessary.

However I will like to mention that until this date there’s already one Cumulative Update for BizTalk Server 2013 (Cumulative update package 1 for BizTalk Server 2013) that you should install to solve or fix minor problems that were detected.

Another great news in BizTalk Server 2013 is that cumulative packages for BizTalk Server will be available and delivery using Microsoft Update:

  • Check for windows update
  • Notice available fixes for BizTalk Server under optional updates
  • Select the update and install

The CU will also be available through the hotfix download as well.

Related links


BizTalk 2013 Installation and Configuration – Configure BizTalk Server SQL Jobs (Part 15)

$
0
0

BizTalk Server databases and their health are very important for a successful BizTalk Server database messaging environment. BizTalk is shipped out with a total of 13 SQL Agent jobs. By default, the following BizTalk jobs aren’t configured and enabled upon installation.

  • Backup BizTalk Server (BizTalkMgmtDb)
  • DTA Purge and Archive (BizTalkDTADb)
  • MessageBox_Message_Cleanup_BizTalkMsgBoxDb

The two jobs that needs configuration are the two most important jobs: the “Backup BizTalk Server” and the “DTA Purge and Archive“. If you want these functionalities you must configure and enabled them.

BTS-2013-SQLJobs-01-SQL-Server-Agent-Jobs

How to configure Backup BizTalk Server (BizTalkMgmtDb)

This is the job provided by Microsoft to do a best practice backup of the BizTalk databases. This job has to be configured for it to be able to run.

This Job consists of four steps:

  • Step 1 – Set Compression Option – Enable or disable compression during backup.
  • Step 2 – BackupFull – Performs full database backups of the BizTalk Server databases.
  • Step 3 – MarkAndBackUpLog – Backs up the BizTalk Server database logs.
  • Step 4 – Clear Backup History – Specifies for how long the backup history is kept.

To configure the Backup BizTalk Server job:

  • Press the “Windows key” to switch to Metro UI and type “SQL Management” or “SQL” and click in “SQL Server Management Studio” option on Apps menu.
  • In Object Explorer panel, connect to the SQL Server instance and expand the server tree.
    • Expand the “SQL Server Agent” node
    • Expand “Jobs” node
  • Double click “Backup BizTalk Server (BizTalkMgmtDb)” to open the job properties window.
  • In the Job Properties – Backup BizTalk Server (BizTalkMgmtDb) dialog box, under “Select a page”, click “Steps”.
  • In the “Job step list”, click in the job you want to edit, and then click “Edit”

BTS-2013-SQLJobs-02-Job-Properties-Backup-BizTalk-Server-(BizTalkMgmtDb)

Step 1 – Set Compression Option

Since BizTalk Server 2010, BizTalk Server supports compression for its SQL Server database backups thereby providing some benefits like: less space needed for the backup files, fewer I/O operations for the backup and restore and so on.

This job step calls a stored procedure named sp_SetBackupCompression on the BizTalk management database (BizTalkMgmtDb by default) to set the value on the adm_BackupSettings table.

The original script is:

exec [dbo].[sp_SetBackupCompression] @bCompression = 0 /*0 - Do not use Compression, 1 - Use Compression */

The stored procedure has only one parameter:

  • @bCompression: By default, Set Compression Option is set to 0, which makes backup compression off by default. To change the default, change Set Compression Option to 1.

Change the script to:

exec [dbo].[sp_SetBackupCompression] @bCompression = 1 /*0 - Do not use Compression, 1 - Use Compression */
Step 2 – BackupFull

The BackupFull step is responsible for performing a full backup of the database.

The original script is:

exec [dbo].[sp_BackupAllFull_Schedule] 'd' /* Frequency */, 'BTS' /* Name */, '<destination path>' /* location of backup files */

Where:

  • Frequency: The default is d (daily). This is the recommended setting. Other values include h (hourly), w (weekly), m (monthly), or y (yearly).
  • Name: The default is BTS. The name is used as part of the backup file name.
  • Location of backup files: Replace ‘<destination path>’ with the full path (the path must include the single quotes) to the computer and folder where you want to back up the BizTalk Server databases.

There are also three optional parameters:

  • Force full backup after partial backup failures (@ForceFullBackupAfterPartialSetFailure): The default is 0 when not specified, which means that if a log backup fails, no full backups are done until the next full backup frequency interval is reached. Replace with 1 if you want a full backup to be made whenever a log backup failure occurs.
  • Local time hour for the backup process to run (@BackupHour): The default is NULL when not specified, which means that backup job will not be associated with the time zone of the BizTalk Server computer and will run at midnight UTC time (0000). If you want to backup to run at a particular hour in the time zone of the BizTalk Server computer, specify an integer value from 0 (midnight) to 23 (11 PM) as the local time hour for the BackupHour parameter.
  • Use local time (@UseLocalTime): This is an extra parameter that you can also add that tells the procedure to use local time
    • The default value is 0
      • If set to 0, then it uses current UTC time – GETUTCDATE() – 2007-05-04 01:34:11.933
      • If set to 1, then it uses local time – GETDATE() – 2007-05-03 18:34:11.933

Change the script to:

exec [dbo].[sp_BackupAllFull_Schedule] 'd' /* Frequency */, 'BTS' /* Name */, '<your_destination_path>\BizTalk Database\Full' /* location of backup files */
Step 3 – MarkAndBackUpLog

The MarkAndBackupLog step is responsible for marking the logs for backup, and then backing them up.

The original script is:

exec [dbo].[sp_MarkAll] 'BTS' /*  Log mark name */, '<destination path>' /* location of backup files */

Where:

  • @MarkName: Log mark name is part of the naming convention for backup files:
    • <Server Name>_<Database Name>_Log_< Log Mark Name >_<Timestamp>
  • @BackupPath:. You must change the destination path this to a valid one. It may be local or a UNC path to another server.

There is also one optional parameter:

  • @UseLocalTime: This is an extra parameter that you can also add that tells the procedure to use local time
    • exec [dbo].[sp_MarkAll] 'BTS' /* Log mark name */,'<destination path>'  /*location of backup files */ , 1
      

Change the script to:

exec [dbo].[sp_MarkAll] 'BTS' /* Log mark name */, '< your_destination_path>\BizTalk Database\Logs' /* location of backup files */
Step 4 – Clear Backup History

The Clear Backup History step is responsible for perform a cleanup of the backup history according for how long a backup should be kept.

The original script clear out the instances in the MarkLog table older than 14 days:

exec [dbo].[sp_DeleteBackupHistory] @DaysToKeep=14

Where:

  • @DaysToKeep: specifies how long the backup history is kept in the Adm_BackupHistory table. Periodically clearing the backup history helps to maintain the Adm_BackupHistory table at an appropriate size. The default value for the DaysToKeep parameter is 14 days.

There is also one optional parameter:

  • @UseLocalTime: This is an extra parameter that you can also add that tells the procedure to use local time
    • exec [dbo].[sp_DeleteBackupHistory] @DaysToKeep=14 , @UseLocalTime =1
      

In this particular case I like to leave the default settings.

Note: This job step does not provide functionality for deleting backup files that have accumulated over time.

You can solve this problem by implementing you custom sp_DeleteBackupHistory:

  • Start SQL Server Management Studio, and then connect to the BizTalk Management Database. By default, this database is named BizTalkMgmtDb.
  • Click New Query to open a Query Editor window.
  • Run the following Transact-SQL script to create the sp_DeleteBackupHistoryAndFiles stored procedure:
CREATE PROCEDURE [dbo].[sp_DeleteBackupHistoryAndFiles] @DaysToKeep smallint = null
AS
BEGIN
   set nocount on
   IF @DaysToKeep IS NULL OR @DaysToKeep <= 1
      RETURN
   /* Only delete full sets
   If a set spans a day in such a way that some items fall into the deleted group and the other does not, do not delete the set */
   DECLARE DeleteBackupFiles CURSOR
   FOR SELECT 'del "' + [BackupFileLocation] + '\' + [BackupFileName] + '"' FROM [adm_BackupHistory]
   WHERE  datediff(dd, [BackupDateTime], getdate()) >= @DaysToKeep
   AND [BackupSetId] NOT IN (SELECT [BackupSetId] FROM [dbo].[adm_BackupHistory] [h2] WHERE [h2].[BackupSetId] = [BackupSetId] AND datediff(dd, [h2].[BackupDateTime], getdate()) < @DaysToKeep)
   DECLARE @cmd varchar(400)
   OPEN DeleteBackupFiles
   FETCH NEXT FROM DeleteBackupFiles INTO @cmd
   WHILE (@@fetch_status <> -1)
   BEGIN
      IF (@@fetch_status <> -2)
      BEGIN
         EXEC master.dbo.xp_cmdshell @cmd, NO_OUTPUT
         delete from [adm_BackupHistory] WHERE CURRENT OF DeleteBackupFiles
         print @cmd
      END
      FETCH NEXT FROM DeleteBackupFiles INTO @cmd
   END
   CLOSE DeleteBackupFiles
   DEALLOCATE DeleteBackupFiles
END
GO
  • Change the “Clear Backup History” step of the Backup BizTalk Server job so that it calls the sp_DeleteBackupHistoryAndFiles stored procedure instead of the sp_DeleteBackupHistory stored procedure.

Note: However I don’t like this approach and I really prefer to take advantage of all features that SQL gives me and create a maintenance plan with a Cleanup task to remove this files.

After properly configure, to enable the Backup BizTalk Server job:

  • Under “Jobs” in SQL Server Management Studio Object Explorer, Right click in the name of the job “Backup BizTalk Server (BizTalkMgmtDb)” and select “Enable” option.

BTS-2013-SQLJobs-03-Enable-Backup-BizTalk-Server-(BizTalkMgmtDb)

  • In the result screen, click “Close”.

BTS-2013-SQLJobs-04-Enable-Backup-BizTalk-Server-(BizTalkMgmtDb)-result-screen

How to configure DTA Purge and Archive (BizTalkDTADb)

This job automates the archiving of tracked messages and the purging of the BizTalk Tracking database to maintain a healthy system and to keep the tracking data archived for future use.

And it’s configured to call the stored procedure dtasp_BackupAndPurgeTrackingDatabase, which uses the six parameters you must configure in this job:

  • @nLiveHours: Any completed instance older than the (live hours) + (live days) will be deleted along with all associated data. Default is 0 hours.
  • @nLiveDays: Any completed instance older than the (live hours) + (live days) will be deleted along with all associated data. Default interval is 1 day.
  • @nHardDeleteDays: All data (even if incomplete) older than this will be deleted. The time interval specified for HardDeleteDays should be greater than the live window of data. The live window of data is the interval of time for which you want to maintain tracking data in the BizTalk Tracking (BizTalkDTADb) database. Anything older than this interval is eligible to be archived at the next archive and then purged. Default is 30 days.
  • @nvcFolder: Folder in which to put the backup files.
  • @nvcValidatingServer: Server on which validation will be done. NULL value indicates no validation is being done. Default is NULL.
  • @fForceBackup: Default is 0. This is reserved for future use.

To configure the DTA Purge and Archive job:

  • Press the “Windows key” to switch to Metro UI and type “SQL Management” or “SQL” and click in “SQL Server Management Studio” option on Apps menu.
  • In Object Explorer panel, connect to the SQL Server instance and expand the server tree.
    • Expand the “SQL Server Agent” node
    • Expand “Jobs” node
  • Double click “DTA Purge and Archive (BizTalkDTADb)” to open the job properties window.
  • In the Job Properties – DTA Purge and Archive (BizTalkDTADb) dialog box, under “Select a page”, click “Steps”.
  • In the “Job step list”, click Archive and Purge, and then click Edit.

BTS-2013-SQLJobs-05-Job-Properties-DTA-Purge-and-Archive-(BizTalkDTADb)

The original script after installing BizTalk looks like this:

exec dtasp_BackupAndPurgeTrackingDatabase
0, --@nLiveHours tinyint, --Any completed instance older than the live hours +live days
1, --@nLiveDays tinyint = 0, --will be deleted along with all associated data
30, --@nHardDeleteDays tinyint = 0, --all data older than this will be deleted.
null, --@nvcFolder nvarchar(1024) = null, --folder for backup files
null, --@nvcValidatingServer sysname = null,
0 --@fForceBackup int = 0 --

This means that:

  • Any completed instance that is older than the live days plus live hours will be deleted, as will any associated data.
  • Any data older than the HardDeleteDays will be deleted.

Normally I use these configurations for production environments:

exec dtasp_BackupAndPurgeTrackingDatabase 0, 10, 20, '<destination path>', null, 0

However in a development machine we don’t need to maintain the archived tracking data, so I just purge it periodically. BizTalk gives you the option to Archive and Purge the tracking data or just simple purge the data without archiving:

  • Change the SQL Statement inside “DTA Purge and Achieve” SQL Job to
declare @dtLastBackup datetime set @dtLastBackup = GetUTCDate() exec dtasp_PurgeTrackingDatabase 1, 0, 7, @dtLastBackup

After properly configure, to enable the Backup BizTalk Server job:

  • Under “Jobs” in SQL Server Management Studio Object Explorer, Right click in the name of the job “DTA Purge and Archive (BizTalkDTADb)” and select “Enable” option.
  • In the result screen, click “Close”.
MessageBox_Message_Cleanup_BizTalkMsgBoxDb

This job removes all messages that are not referenced by any subscribers in the BizTalkMsgBoxDb database tables.

Important: This job is also started by the MessageBox_Message_ManageRefCountLog_BizTalkMsgBoxDb job. Therefore, we recommend that you disable this job.

Related links


BizTalk 2013 Installation and Configuration – Configure BizTalk Server Windows Services (Part 16)

$
0
0

By default, the “Startup type” propriety of BizTalk Windows Services, Enterprise Single Sign-On Service, Microsoft UDDI Notification Service and the new BAMAlerts service are set as “Automatic”, however some of this Windows Services may not start automatically after a system restart, to avoid this behavior you must configure the “Startup type” to “Automatic (Delayed Start)” option in this services:

  • BAMAlerts
  • Microsoft UDDI Notification Service

The previous version of BizTalk Server also had this problem for:

  • Enterprise Single Sign-On Service
  • BizTalk Service BizTalk Group : BizTalkServerApplication Service

However this problem has been resolved in this release, despite being configured as “Automatic“, the Recovery properties are configured to restart the service after failures

BTS-2013-Srvices-01-BizTalk-Service-BizTalk-Group-BizTalkServerApplication-Service

To proper configure the “BAMAlerts” and “Microsoft UDDI Notification Service” Windows service:

  • Press the “Windows key” to switch to Metro UI and type “Services” and click in “View local services” option on Settings menu.

BTS-2013-Srvices-02-Services-metro-UI

  • In the Services window, on the Services (Local) panel select the BAMAlerts service, right click and select “Properties” option.

BTS-2013-Srvices-03-Services-Properties

  • On the BAMAlerts Properties (Local Computer) window:
    • On the General tab apply the following configuration.
      • Startup type: “Automatic (Delayed Start)”

BTS-2013-Srvices-04-BAMAlerts-Properties-General

    • On the Recovery tab, apply the following configuration:
      • First failure: “Restart the Service”
      • Second failure: “Restart the Service”
      • Subsequent failures: “Restart the Service”
      • Reset fail count after … day: 1
      • Restart service after … minutes: 1

BTS-2013-Srvices-04-BAMAlerts-Properties-Recovery

    • Click “OK” to apply the changes and close the window
  • Repeat the steps for the other services.

Related links


BizTalk 2013 – Redistributable CAB Files

$
0
0

BizTalk Server relies on diverse products and technologies to provide essential services and features. If not already present, some software that is required by BizTalk Server is installed on your computer during the BizTalk installation process, such as:

  • Microsoft SQL XML 4.0 with Service Pack 1
  • Microsoft Office Web Components
  • Microsoft ADO MD.Net 9.0
  • Microsoft ADO MD.Net 10.0

Microsoft BizTalk Server 2013 Installation Wizard, in the “Redistributable Prerequisites” screen, gives you the option to:

  • Manually install the redistributable prerequisites: By selecting this option you are choosing that you want to manually install the redistributable files that are required for the installation process to continue. In this case the installation process is canceled.

BizTalk-Server-2013-redistributable-prerequisites-canceled

  • Automatically install the redistributable prerequisites from the Web: By selecting this option the Wizard will download and install the necessary components automatically for you. The disadvantage is that this option requires an internet connection.
  • Download the redistributable prerequisites CAB file: By selecting this option the Wizard will automatically download the correct version of the redistributable prerequisites CAB file which is compatible with the operating system that is running the Installation Wizard, to your computer so that you can install later and will exit the installation process. Again this option requires an internet connection.
  • Automatically install the redistributable prerequisites from a CAB file: y selecting this option the Wizard will automatically install the redistributable prerequisites from a CAB file that you have previous downloaded. So the disadvantage is that you already must have downloaded the correct CAB file before running the setup but in return you don’t need Internet connection.

BizTalk-Server-2013-redistributable-prerequisites

The CAB file containing all the prerequisites needed, however, if you are choosing the last option “Automatically install the redistributable prerequisites from a CAB file”:

  • Be sure you are using the correct CAB file according to your language and operating system.
  • And you cannot use CAB files from previous versions of BizTalk Server to install BizTalk Server 2013.
List of Redistributable CAB Files for BizTalk Server 2013

CAB Files for 64-bit Editions (EN)

CAB Files for 32-bit Editions (EN)

Other languages


How to install and configure BizTalk360 on BizTalk Server 2013 standalone machine running on Windows Server 2012

$
0
0

Are you planning to install BizTalk360 on a Windows Server 2012 machine? Check out Installing and Configuring BizTalk360 on Windows Server 2012 / BizTalk Server 2013 (user guide) available for download on BizTalk36o website.

BizTalk360-Installing-and-Configuring-BizTalk360-on-Windows-Server-2012

This user guide will explain how to install and configure BizTalk360 in an existing Microsoft BizTalk Server 2013 standalone machine (single computer) running under Windows Server 2012. This information will help you plan the BizTalk360 installation and configuration process and components on which it depends.

What is BizTalk360?

BizTalk360 (http://www.biztalk360.com/) is a web based (RIA) designed primarily to perform monitoring and support for BizTalk Server environments (Production, Test, Development). It addresses some of the common problems customers face today like governance/auditing, fine grained authentication, remote access and so on. It also makes life easy for people who support production BizTalk systems by providing various dashboard and greater visibility.

This tool is developed by Kovai Limited, based in London UK, but everyone knows this tool through its CTO Saravana Kumar, Microsoft BizTalk Server MVP since 2007 and a well-recognized member of the BizTalk community. Version 6.5.191.0 is available for download here, give it a try!

You can download user guide from:

Installing and Configuring BizTalk360 on Windows Server 2012 / BizTalk Server 2013 (user guide)
BizTalk360


PowerShell to Configure BizTalk Server Host and Host Instances according to some of the Best Practices

$
0
0

Personally I like to create all my BizTalk Server installation and configuration process manually at least one time or maybe from time to time, but when we are dealing with several environments and even worse each environment with several BizTalk Servers… this can be very annoying and time consuming. In this case automation is the key!

One of the task that we need to do in all our new BizTalk environment over and over again is creating and configuring the Host, Host Instances and of course the adapter handlers.

What’s is Host, Host Instances and Adapter Handlers?

The BizTalk Host is a logical process and security boundary within BizTalk Server that represents a logical set of zero or more run-time processes in which you can deploy BizTalk Server services and artifacts (such as adapter handlers, receive locations, and orchestrations). Each host has a security group assigned to it and may contain multiple host instances, each on an individual machine, that perform the work of the host.

In turn, a host instance is the physical instance of a host on a computer running BizTalk Server. Each host instance belongs to exactly one host, and the service account of the host instance belongs to the security group of the host. The security group may be used to grant permissions to physical resources such as databases for use by any host instances in the host.

An adapter handler is an instance of a BizTalk host in which the adapter code runs. When you specify a send or receive handler for an adapter you are specifying which host instance the adapter code will run in the context of. An adapter handler is responsible for executing the adapter and contains properties for a specific instance of an adapter. A default BizTalk Server configuration will create adapter handlers for all of the installed adapters, but you may want to create additional adapter handlers for purposes of load balancing or to provide process isolation for a particular adapter handler.

Best practices to Configuring Hosts and Host Instances

As the official documentation specify, in addition to the high availability aspects of the host instance configuration, you should separate sending, receiving, processing, and tracking functionality into multiple hosts. This provides flexibility when configuring the workload in your BizTalk group and is the primary means of distributing processing across a BizTalk group.

This also allows you to stop one host without affecting other hosts. For example, you may want to stop sending messages to let them queue up in the MessageBox database, while still allowing the inbound receiving of messages to occur.

Separating host instances by functionality also provides some of the following benefits:

  • Each host instance has its own set of resources such as memory, handles, and threads in the .NET thread pool.
  • Multiple BizTalk Hosts will also reduce contention on the MessageBox database host queue tables since each host is assigned its own work queue tables in the MessageBox database.
  • Throttling is implemented in BizTalk Server at the host level. This allows you to set different throttling characteristics for each host.
  • Security is implemented at the host level; each host runs under a discrete Windows identity.

However this also may bring some potential drawbacks if too many host instances are created because each host instance is a Windows service (BTSNTSvc.exe or BTSNTSvc64.exe), which generates additional load against the MessageBox database and consumes computer resources (such as CPU, memory, threads), so you need to be careful.

Normally we read that we need to create at least 4 host instances: sending, receiving, processing, and tracking, but that’s not absolutely true because, at least with the newer environments, we typically use 64-bits versions and in this case we also need to create at least one Host Instance that will run on 32-bits because FTP adapter, SQL adapter, POP3 adapter and MIME Decoder on 64-bit host instances is not supported by the product (http://technet.microsoft.com/en-us/library/aa560166.aspx)

We can define that one of the best practices for hosts and host instances is the following:

  • BizTalkServerTrackingHost: A BizTalk Host that hosts tracking is responsible for moving the DTA and BAM tracking data from the MessageBox database to the BizTalk Tracking (DTA) and BAM Primary Import databases. This movement of tracking data has an impact on the performance of other BizTalk artifacts that are running in the same host that is hosting tracking. Thus, you should use a dedicated host that does nothing but host tracking.
    • Only the optionAllow Host Tracking” must be selected because we only will use this host for tracking.
  • BizTalkServerReceiveHost: All options (Allow Host Tracking”, “32-bits only” or “Make this default host in the group”) should be unselected. This host will be responsible for processing messages after they are picked up in a receive location. When a host contains a receiving item, such as a receive location (with a pipeline), the message decoding and decrypting occurs in a pipeline within this host.
    • All receive handlers, except the isolated ones like SOAP, HTTP, WCF-BasicHttp, WCF-WsHttp or WCF-CustomIsolated and 32 bit adapters (FTP,SQL and POP3) will be configured for this host. This will mean also that all receive locations will run in this host instance.
  • BizTalkServerReceive32Host: has the same goal as the previous however this must have the “32-bits only” option select so that we can run the 23-bits adapters.
    • The receive handlers for the FTP, SQL and POP3 adapters will be configured for this host.
  • BizTalkServerSendHost: All options (Allow Host Tracking”, “32-bits only” or “Make this default host in the group”) should be unselected. This host will be responsible for processing messages before they are sent out to the send port. When a host contains a sending item, such as a send port, the message signing and encryption occurs in a pipeline within this host.
    • All send handlers, except 32 bit adapters like native SQL and FTP adapter, will be configured for this host. This will mean also that all send ports will run in this host instance.
  • BizTalkServerSend32Host: has the same goal as the previous however this must have the “32-bits only” option select so that we can run the 32-bits adapters.
    • The Send handlers for the FTP and SQL adapters will be configured for this host.
  • BizTalkServerApplication: Only the option32-bits only” should be select in this host. This host will be responsible for process messages based on the instructions in orchestrations that need to run in 32-bits.
  • BizTalkServerApplication64Host: Only the optionMake this default host in the group” should be select in this host. This host will be responsible for process messages based on the instructions in all or most common orchestrations.

Note: You can create other Application Host if you want to separate process base in some application logic.

How can I automate this task?

Windows PowerShell is a Windows command-line shell designed especially for system administrators and can be used by BizTalk administrators to help them in automating tasks.

This is a simple script to configure the Host, Host Instance and Adapter Handlers described earlier in this post:
Function that will create a new BizTalk Host

function CreateBizTalkHost([string]$hostName, [int]$hostType, [string]$ntGroupName, [bool]$authTrusted, [bool]$isTrackingHost, [bool]$is32BitOnly)
{
    try
    {
        [System.Management.ManagementObject]$objHostSetting = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_HostSetting").CreateInstance()

        $objHostSetting["Name"] = $hostName
        $objHostSetting["HostType"] = $hostType
        $objHostSetting["NTGroupName"] = $ntGroupName
        $objHostSetting["AuthTrusted"] = $authTrusted
        $objHostSetting["IsHost32BitOnly"] = $is32BitOnly
        $objHostSetting["HostTracking"] = $isTrackingHost

        $putOptions = new-Object System.Management.PutOptions
        $putOptions.Type = [System.Management.PutType]::CreateOnly;

        [Type[]] $targetTypes = New-Object System.Type[] 1
        $targetTypes[0] = $putOptions.GetType()

        $sysMgmtAssemblyName = "System.Management"
        $sysMgmtAssembly = [System.Reflection.Assembly]::LoadWithPartialName($sysMgmtAssemblyName)
        $objHostSettingType = $sysMgmtAssembly.GetType("System.Management.ManagementObject")

        [Reflection.MethodInfo] $methodInfo = $objHostSettingType.GetMethod("Put", $targetTypes)
        $methodInfo.Invoke($objHostSetting, $putOptions)

		Write-Host "Host $hostName was successfully created" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
		if ($_.Exception.Message.Contains("Another BizTalk Host with the same name already exists in the BizTalk group.") -eq $true)
        {
			Write-Host "$hostName can't be created because another BizTalk Host with the same name already exists in the BizTalk group." -Fore DarkRed
        }
		else{
        	write-Error "$hostName host could not be created: $_.Exception.ToString()"
		}
    }
}

Function that will update an existent BizTalk Host

function UpdateBizTalkHost([string]$hostName, [int]$hostType, [string]$ntGroupName, [bool]$authTrusted, [bool]$isTrackingHost, [bool]$is32BitOnly, [bool]$isDefaultHost)
{
    try
    {
        [System.Management.ManagementObject]$objHostSetting = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_HostSetting").CreateInstance()

        $objHostSetting["Name"] = $hostName
        $objHostSetting["HostType"] = $hostType
        $objHostSetting["NTGroupName"] = $ntGroupName
        $objHostSetting["AuthTrusted"] = $authTrusted
        $objHostSetting["IsHost32BitOnly"] = $is32BitOnly
        $objHostSetting["HostTracking"] = $isTrackingHost
		$objHostSetting["IsDefault"] = $isDefaultHost

        $putOptions = new-Object System.Management.PutOptions
        $putOptions.Type = [System.Management.PutType]::UpdateOnly; # This tells WMI it's an update.

        [Type[]] $targetTypes = New-Object System.Type[] 1
        $targetTypes[0] = $putOptions.GetType()

        $sysMgmtAssemblyName = "System.Management"
        $sysMgmtAssembly = [System.Reflection.Assembly]::LoadWithPartialName($sysMgmtAssemblyName)
        $objHostSettingType = $sysMgmtAssembly.GetType("System.Management.ManagementObject")

        [Reflection.MethodInfo] $methodInfo = $objHostSettingType.GetMethod("Put", $targetTypes)
        $methodInfo.Invoke($objHostSetting, $putOptions)

		Write-Host "Host $hostName was successfully updated" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
        write-Error "$hostName host could not be updated: $_.Exception.ToString()"
    }
}

Function that will create a new BizTalk Host Instance

function CreateBizTalkHostInstance([string]$hostName, [string]$serverName, [string]$username, [string]$password)
{
    try
    {
        [System.Management.ManagementObject]$objServerHost = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_ServerHost").CreateInstance()

        $objServerHost["HostName"] = $hostName
        $objServerHost["ServerName"] = $serverName
        $objServerHost.Map()

        [System.Management.ManagementObject]$objHostInstance = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_HostInstance").CreateInstance()

        $name = "Microsoft BizTalk Server " + $hostName + " " + $serverName
        $objHostInstance["Name"] = $name
        $objHostInstance.Install($username, $password, $true)

		Write-Host "HostInstance $hostName was mapped and installed successfully. Mapping created between Host: $hostName and Server: $Server);" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
		if ($_.Exception.Message.Contains("Another object with the same key properties already exists.") -eq $true)
        {
			Write-Host "$hostName host instance can't be created because another object with the same key properties already exists." -Fore DarkRed
        }
		else{
        	write-Error "$hostName host instance on server $Server could not be created: $_.Exception.ToString()"
		}
    }
}

Function that will delete an existent host handlers in the adapters

function DeleteBizTalkAdapterHandler([string]$adapterName, [string]$direction, [string]$hostName)
{
	try
    {
		if($direction -eq 'Receive')
		{
			[System.Management.ManagementObject]$objHandler = get-wmiobject 'MSBTS_ReceiveHandler' -namespace 'root\MicrosoftBizTalkServer' -filter "HostName='$hostName' AND AdapterName='$adapterName'"
	        $objHandler.Delete()
		}
		else
		{
			[System.Management.ManagementObject]$objHandler = get-wmiobject 'MSBTS_SendHandler2' -namespace 'root\MicrosoftBizTalkServer' -filter "HostName='$hostName' AND AdapterName='$adapterName'"
	        $objHandler.Delete()
		}

		Write-Host "$direction handler for $adapterName / $hostName was successfully deleted" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
        if ($_.Exception.Message -eq "You cannot call a method on a null-valued expression.")
        {
			Write-Host "$adapterName $direction Handler for $hostName does not exist" -Fore DarkRed
        }
        elseif ($_.Exception.Message.IndexOf("Cannot delete a receive handler that is used by") -ne -1)
        {
			Write-Host "$adapterName $direction Handler for $hostName is in use and can't be deleted." -Fore DarkRed
        }
		elseif ($_.Exception.Message.IndexOf("Cannot delete a send handler that is used by") -ne -1)
        {
			Write-Host "$adapterName $direction Handler for $hostName is in use and can't be deleted." -Fore DarkRed
        }
		elseif ($_.Exception.Message.IndexOf("Cannot delete this object since at least one receive location is associated with it") -ne -1)
        {
			Write-Host "$adapterName $direction Handler for $hostName is in use by at least one receive location and can't be deleted." -Fore DarkRed
        }
        else
        {
            write-Error "$adapterName $direction Handler for $hostName could not be deleted: $_.Exception.ToString()"
        }
    }
}

Function that will create a handler for a specific adapter on the host

function CreateBizTalkAdapterHandler([string]$adapterName, [string]$direction, [string]$hostName, [string]$originalDefaulHostName, [boolean]$isDefaultHandler, [boolean]$removeOriginalHostInstance)
{
	if($direction -eq 'Receive')
	{
		[System.Management.ManagementObject]$objAdapterHandler = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_ReceiveHandler").CreateInstance()
		$objAdapterHandler["AdapterName"] = $adapterName
	    $objAdapterHandler["HostName"] = $hostName
	}
	else
	{
		[System.Management.ManagementObject]$objAdapterHandler = ([WmiClass]"root/MicrosoftBizTalkServer:MSBTS_SendHandler2").CreateInstance()
		$objAdapterHandler["AdapterName"] = $adapterName
	    $objAdapterHandler["HostName"] = $hostName
	    $objAdapterHandler["IsDefault"] = $isDefaultHandler
	}

    try
    {
        $putOptions = new-Object System.Management.PutOptions
        $putOptions.Type = [System.Management.PutType]::CreateOnly;

        [Type[]] $targetTypes = New-Object System.Type[] 1
        $targetTypes[0] = $putOptions.GetType()

        $sysMgmtAssemblyName = "System.Management"
        $sysMgmtAssembly = [System.Reflection.Assembly]::LoadWithPartialName($sysMgmtAssemblyName)
        $objAdapterHandlerType = $sysMgmtAssembly.GetType("System.Management.ManagementObject")

        [Reflection.MethodInfo] $methodInfo = $objAdapterHandlerType.GetMethod("Put", $targetTypes)
        $methodInfo.Invoke($objAdapterHandler, $putOptions)

        Write-Host "$adapterName $direction Handler for $hostName was successfully created" -Fore DarkGreen
    }
    catch [System.Management.Automation.RuntimeException]
    {
		if ($_.Exception.Message.Contains("The specified BizTalk Host is already a receive handler for this adapter.") -eq $true)
        {
			Write-Host "$hostName is already a $direction Handler for $adapterName adapter." -Fore DarkRed
        }
		elseif($_.Exception.Message.Contains("The specified BizTalk Host is already a send handler for this adapter.") -eq $true)
        {
			Write-Host "$hostName is already a $direction Handler for $adapterName adapter." -Fore DarkRed
        }
		else {
        	write-Error "$adapterName $direction Handler for $hostName could not be created: $_.Exception.ToString()"
		}
    }

	if($removeOriginalHostInstance)
	{
		DeleteBizTalkAdapterHandler $adapterName $direction $originalDefaulHostName
	}
}

Function that will have the logic you want to implement to create the default hosts and host instances and add configure the host instances to the various handlers

function ConfiguringBizTalkServerHostAndHostInstances
{
	# Separate sending, receiving, processing, and tracking functionality into multiple hosts.
	# This provides flexibility when configuring the workload and enables you to stop one host without affecting other hosts.
	# you can use a common well use convention to define the name of the host:
	#  - <Job>_<bit support>_<seq>_<adapter/functionality>_<throughput>_<priority>_<clustered>
	# Sample 'Rcv_x32_1_FTP_L_Critical_Clustered'
	# But I will use a more simple convencion
	# Defining the names of the hosts
	[string]$receiveHostName = 'BizTalkServerReceiveHost'
	[string]$sendHostName = 'BizTalkServerSendHost'
	[string]$processingHostName = 'BizTalkServerApplication64Host' # use this to create another processing host
	[string]$trackingHostName = 'BizTalkServerTrackingHost'
	# Note: why we need to create 32bits hosts? FTP, POP3 and SQL doesn't support 64bits
	[string]$receive32HostName = 'BizTalkServerReceive32Host'
	[string]$send32HostName = 'BizTalkServerSend32Host'

	# 'BizTalkServerApplication' is the default host instance created when you install the biztalk on your box.
	# This application will be running on "32-bit only".
	[string]$defaultHostName = 'BizTalkServerApplication'

 	##############################
	# Creating hosts for receiving
	# HostType: Invalid: 0, In-process:	1, Isolated: 2
	CreateBizTalkHost $receiveHostName 1 $ntHostGroupName $false $false $false
	CreateBizTalkHost $receive32HostName 1 $ntHostGroupName $false $false $true

	# Create a host instances for receiving associated with the previous hosts created
	CreateBizTalkHostInstance $receiveHostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword
	CreateBizTalkHostInstance $receive32HostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword

	# Set adapters that should be handled by receiving host instance
	CreateBizTalkAdapterHandler 'FILE' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'MQSeries' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'MSMQ' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-Custom' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetMsmq' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetNamedPipe' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetTcp' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'Windows SharePoint Services' 'Receive' $receiveHostName $defaultHostName $false $removeOriginalAdapterHandler
	#32 bits adapters
	CreateBizTalkAdapterHandler 'FTP' 'Receive' $receive32HostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'POP3' 'Receive' $receive32HostName $defaultHostName $false $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'SQL' 'Receive' $receive32HostName $defaultHostName $false $removeOriginalAdapterHandler

 	##############################
	# Creating hosts for sending
	# HostType: Invalid: 0, In-process:	1, Isolated: 2
	CreateBizTalkHost $sendHostName 1 $ntHostGroupName $false $false $false
	CreateBizTalkHost $send32HostName 1 $ntHostGroupName $false $false $true

	# Create a host instances for sending associated with the previous hosts created
	CreateBizTalkHostInstance $sendHostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword
	CreateBizTalkHostInstance $send32HostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword

	# Set adapters that should be handled by sending host instance
	CreateBizTalkAdapterHandler 'FILE' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'HTTP' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'MQSeries' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'MSMQ' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'SOAP' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'SMTP' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-BasicHttp' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-Custom' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetMsmq' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetNamedPipe' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-NetTcp' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'WCF-WSHttp' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'Windows SharePoint Services' 'Send' $sendHostName $defaultHostName $true $removeOriginalAdapterHandler
	#32 bits adapters
	CreateBizTalkAdapterHandler 'FTP' 'Send' $send32HostName $defaultHostName $true $removeOriginalAdapterHandler
	CreateBizTalkAdapterHandler 'SQL' 'Send' $send32HostName $defaultHostName $true $removeOriginalAdapterHandler

	# Create a host for tracking
	CreateBizTalkHost $trackingHostName 1 $ntHostGroupName $false $true $false

	# Create a host for orchestrations
	CreateBizTalkHost $processingHostName 1 $ntHostGroupName $false $false $false

	# Create a host instance for orchestrations
	CreateBizTalkHostInstance $processingHostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword

	# Create a host instance for tracking
	CreateBizTalkHostInstance $trackingHostName $bizTalkServerName $hostCredentials.UserName $hostCredentialsPassword

	# Remove "Allow Host Tracking" options from BizTalkServerApplication Host
	UpdateBizTalkHost $defaultHostName 1 $ntHostGroupName $false $false $true $true

	# Updating the processinh host to be the default host
	UpdateBizTalkHost $processingHostName 1 $ntHostGroupName $false $false $false $true
}

And in the last the main script

Write-Host "Starting configure the BizTalk Server environment..." -Fore DarkGreen

# General variables
# Defining the BizTalk Server Name, this line will read the Server name on which the script is running
$bizTalkServerName = $(Get-WmiObject Win32_Computersystem).name

# STEP 1
# The Windows group is used to control access of a specif host and associated host instances to databases and other
# resources. Each instance of this host must run under a user account that is a member of this group.
# Note that you can change the Windows group only if no instances of this host exist.
# Defining the name of the group the BizTalk hosts should run under
[string]$ntHostGroupName = Read-Host -Prompt "Please enter windows group to control access to Hosts and ssociated Host Instances"

# STEP 2
# This account must have SQL Server permissions. The recommended way to grant these permissions is to add this account
# to the BizTalk Server Host Windows group.
# BizTalk Server will add this account to the "Log on as a service" security policy.
# For domain accounts, use "domain\user" format
# Defining the credentials in witch the host instance should run under.
try
{
	$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
	$domainName = $domain.name
}
catch
{
	$domainName = $(Get-WmiObject Win32_Computersystem).name
}
$hostCredentials = $Host.ui.PromptForCredential("Logon Credentials","This account must have SQL Server permissions. The recommended way to grant these permissions is to add this account to the BizTalk Server Host Windows group.

BizTalk Server will add this account to the 'Log on as a service' security policy", $domainName + "\", "");
[String]$hostCredentialsPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($hostCredentials.Password));

# STEP 3
# Defining the option if you want to automatically try to remove the BizTalkServerApplication Host Instance from
# the Adapters handlers
$windowsShell = new-object -comobject wscript.shell
$questionResult = $windowsShell.popup("Do you want to try to remove the BizTalkServerApplication Host Instance from the Adapters handlers?

Note: The script cannot remove the default host instances if there are any receiveports, sendports or orchestrations configured.",
						  0,"BizTalk Applications, Receive and Send Ports",4)

If ($questionResult -eq 6) {
	$removeOriginalAdapterHandler = $true
}
else {
	$removeOriginalAdapterHandler = $false
}

# STEP 4
# Create default hosts, host instances and handlers
Write-Host "Creating hosts and host instances..." -Fore DarkGreen
ConfiguringBizTalkServerHostAndHostInstances

# STEP 5
# This configurations changes requires host instances restart for the changes to take effect.
# Check if you want to restart the Host Instances
Write-Host "Host and Host Instance configuration is almost completed..." -Fore DarkGreen
$questionResult = $windowsShell.popup("This configurations changes requires host instances restart for the changes to take effect.

Do you want to restart the Host Instances now?", 0,"Please restart Host Instances",4)
If ($questionResult -eq 6) {
	get-service BTS* | foreach-object -process {restart-service $_.Name}
	Write-Host "Restart Host Instance completed..." -Fore DarkGreen
}

# STEP 6
# Check if you want to properly configure BizTalk Services and Enterprise Single Sign-On Service 'Startup type' property
# to Automatic (Delayed Start)
$questionResult = $windowsShell.popup("By default, the 'Startup type' propriety of BizTalk Services and Enterprise Single Sign-On Service are set as 'Automatic', however BizTalk Server services may not start automatically after a system restart, to avoid this behavior you must config the 'Startup type' to 'Automatic (Delayed Start)'.

Do you want to configure BizTalk Services to 'Automatic (Delayed Start)'?", 0,"Configure BizTalk Services to Automatic (Delayed Start)",4)
If ($questionResult -eq 6) {
	#=== Name of the Enterprise Single Sign-On Service. ===#
	$entSSOServiceName = 'ENTSSO'

	#=== Change the startup type for BizTalk services to Automatic (Delayed Start) ===#
	get-service BTSSvc* | foreach-object -process { SC.EXE config $_.Name start= delayed-auto}

	#=== Change the startup type for Enterprise Single Sign-On Service to Automatic (Delayed Start) ===#
	SC.EXE config $entSSOServiceName start= delayed-auto

	Write-Host "BizTalk Services and SSO configured successfully..." -Fore DarkGreen
}

Write-Host "Your BizTalk Server environment is now properly configured" -Fore DarkGreen

The script can be found and download on Microsoft TechNet Gallery:
PowerShell to Configure BizTalk Server Host and Host Instances (7.4 KB)
Microsoft TechNet Gallery


Backup BizTalk Server job failed: The last step to run was step 2 (BackupFull). The job was requested to start at step 1 (Set Compression Option)

$
0
0

For several years I’ve been setting up dozens of times the Backup BizTalk Server job without any kind of problems… but there’s a first time for everything and when I was trying to help remotely a friend configuring this job, we got stuck with this error when we try to start it:

Log Job History (Backup BizTalk Server (BizTalkMgmtDb))
Step ID 0
Job Name Backup BizTalk Server (BizTalkMgmtDb)
Step Name (Job outcome)
Message
The job failed. The Job was invoked by User domain\user. The last step to run was step 2 (BackupFull). The job was requested to start at step 1 (Set Compression Option).

Backup-BizTalk-Server-job-error-message

I knew that the job was configured correctly but unfortunately I didn’t have access to the SQL Server in order to see if I could find out more information about what was happening… Well, according to the error message we know that the job started in the first task “Set Compression Option” but failed in the second “BackupFull”. Beyond that the error message doesn’t help us much.

By going to the job history (right click in “Backup BizTalk Server (BizTalkMgmtDb)” job and select “View History” option)) we can validate that the problem in the BackupFull task but again the message described there doesn’t help us much.

Backup-BizTalk-Server-job-error-history

CAUSE

Unfortunately this error can happen for several reasons and we need to check what the best option for us is::

  • In Microsoft BizTalk Server 2004 and later, the Backup BizTalk Server job fails, and problems occur that relate to limited disk space. This happens when the backup files accumulate over time. This fills up the disk that houses the backup files.
    • This issue occurs because the SQL Server Agent job that is named “Backup BizTalk Server” does not provide functionality for deleting backup files that have accumulated over time. See: The “Backup BizTalk Server” job fails when backup files accumulate over time in the Microsoft BizTalk Server database server
    • Or you can create a Maintenance Plan to delete BizTalk Database Backups files see more here
    • I found also this great suggestion by Tord Glad Nordahl: “Verify that the compression option for the database is correct, after this open the management database located the table called “adm_BackupSettings” update this column “ForceFull” and set the value to 1. Then manually run the backup job again.” In this forum question.

But none of these suggestions work for me, in fact this was the first time that we were trying to run the job.

However sometimes solutions are simpler than it seems. If you check the parameters of the BackupFull step you will see that the third parameter is the location of backup files and this location must exist in the file system… so because I didn’t have access to the SQL Server machine, I asked to my friend to:

  1. Validate if the folder exist in the file system;
  2. See in the event viewer of the SQL Server if there was more information about the error;

The result was:

  1. The folder didn’t exist… never a good sign
  2. In the event viewer of the SQL Server Machine there was an entry saying the exact problem:

BackupDiskFile::CreateMedia: Backup device ‘K:\Backups\BizTalk Database\Full\BTS2013LAB01_BAMAlertsApplication_Full_BTS_2013_11_11_16_45_25_870.bak’ failed to create. Operating system error 3(The system cannot find the path specified.).

SOLUTION

You must remember that you need to ensure that all the paths specified in the BizTalk jobs must exist in the file system. In my case, we create the folder on the file system and run the job again with success.

Backup-BizTalk-Server-job-success


Backup BizTalk Server job failed: The job failed. The Job was invoked by Schedule 9 (MarkAndBackupLogSched). The last step to run was step 2 (BackupFull).

$
0
0

After writing my last post I remembered that in the past I got a related error to this problem but with a different cause and solution. So I decided to emulate the error in my lab environment and make a second part of this topic.

I remember that on occasion, in order to be faster, I copied all the job configuration text from of my blog and pasted in the BackupFull step job window. However when I try to run I got a similar error:

SQL Server Scheduled Job ‘Backup BizTalk Server (BizTalkMgmtDb)’ (0x4020953E49DEFA43B8FEC18D6AD9B062) – Status: Failed – Invoked on: 2013-11-11 17:45:00 – Message: The job failed. The Job was invoked by Schedule 9 (MarkAndBackupLogSched). The last step to run was step 2 (BackupFull).

Backup-BizTalk-Server-job-error-message-MarkAndBackupLogSched

Again the error message doesn’t help us much, so what you should do is go to the Backup BizTalk Server job history:

  • Right click in “Backup BizTalk Server (BizTalkMgmtDb)” job and select “View History” option

And try so see if you can obtain more information about the error.

Unlike the event viewer and the error that I put in the previous post, in this case the log history show as much more information:

Date 11/11/2013 17:45:00
Log Job History (Backup BizTalk Server (BizTalkMgmtDb))
Step ID 2
Job Name Backup BizTalk Server (BizTalkMgmtDb)
Step Name BackupFull
Message
Executed as user: NT SERVICE\SQLSERVERAGENT. Incorrect syntax near ‘´’. [SQLSTATE 42000] (Error 102) Unclosed quotation mark after the character string ‘ /* location of backup files */ ‘. [SQLSTATE 42000] (Error 105). The step failed.

Backup-BizTalk-Server-job-error-history-Unclosed-quotation-mark

CAUSE

The copy of the text from my blog brought a wrong ASCII format transforming the single quotation mark character in an accent (´).

All the parameter of the sp_BackupAllFull_Schedule must be placed between single quotation marks:

  • Frequency: 'd', 'w' and so on
  • Name: 'BTS'
  • Location of backup files: 'c:\backups'

SOLUTION

Fix the job to ensure that all the parameters of the sp_BackupAllFull_Schedule is between single quotation marks.


Backup BizTalk Server job failed: The job failed. The Job was invoked by User domain\user. The last step to run was step 3 (MarkAndBackupLog). The job was requested to start at step 1 (Set Compression Option).

$
0
0

Now I’m playing a little with this topic hehehe… but be with me, this have a final goal that I will reveal soon (probably two weeks from now since next week I will be away in the MVP Summit and BizTalk Summit in Seattle). Until then let’s try to find some of the “basic” possible errors that you can find in the Backup BizTalk Server job.

In my previous posts (here and here), I have explained two possible errors that you can find when trying to run this job, today we will talk about this one:

SQL Server Scheduled Job ‘Backup BizTalk Server (BizTalkMgmtDb)’ (0x4020953E49DEFA43B8FEC18D6AD9B062) – Status: Failed – Invoked on: 2013-11-12 08:50:46 – Message: The job failed. The Job was invoked by User BTS2013LAB01\Administrator. The last step to run was step 3 (MarkAndBackupLog). The job was requested to start at step 1 (Set Compression Option).

 

 

Backup-BizTalk-Server-job-warning-message-MarkAndBackupLog

Although the execution of job ‘Backup BizTalk Server (BizTalkMgmtDb)’ failed, no error is register in the event viewer only the warning showed above. This probably happens because the main task of this job: “BackupFull” responsible for performing a full database backups of the BizTalk Server databases, is properly executed. You can validate this in the tables “adm_BackupSettings” and “adm_BackupHistory”, or on the file system where the backup files are saved.

However, and as the message states, the job was not entirely performed and there is a problem in the third task: MarkAndBackupLog. Again the error message doesn’t help us much, so what you should do is go to the Backup BizTalk Server job history to try so see if you can obtain more information’s. In this case the log history show as much more information:

Log Job History (Backup BizTalk Server (BizTalkMgmtDb))
Step ID 3
Job Name Backup BizTalk Server (BizTalkMgmtDb)
Step Name MarkAndBackupLog
Sql Severity 15
Sql Message ID 105
Message
Executed as user: NT SERVICE\SQLSERVERAGENT. Incorrect syntax near ‘´’. [SQLSTATE 42000] (Error 102) Unclosed quotation mark after the character string ‘ /* location of backup files */ ‘. [SQLSTATE 42000] (Error 105). The step failed.

Backup-BizTalk-Server-job-error-history-MarkAndBackupLog

 

CAUSE

The MarkAndBackupLog step is responsible for marking the logs for backup, and then backing them up. This step execute the “sp_MarkAll” stored procedure that accepts two mandatory parameters:

  • @MarkName: Log mark name is part of the naming convention for backup files
  • @BackupPath:. You must change the destination path this to a valid one. It may be local or a UNC path to another server

And one optional parameter:

  • @UseLocalTime: This is an extra parameter that you can also add that tells the procedure to use local time

The mandatory parameters (MarkName and BackupPath) must be placed between single quotation marks:

  • MarkName: 'BTS', 'BTS2013LAB01' and so on
  • BackupPath: 'c:\backups'

The problem here is that for some reason I’m not using a single quotation mark:

exec [dbo].[sp_MarkAll] ‘BTS’ /* Log mark name */, C ….’ …

SOLUTION

Fix the job to ensure that all the parameters of the sp_MarkAll is between single quotation marks.

 

Another error that you can find in the Job history is:

Log Job History (Backup BizTalk Server (BizTalkMgmtDb))
Step ID 3
Job Name Backup BizTalk Server (BizTalkMgmtDb)
Step Name MarkAndBackupLog
Sql Severity 16
Sql Message ID 3013
Message
Executed as user: NT SERVICE\SQLSERVERAGENT. Cannot open backup device ‘K:\Backups\BizTalk Database\Logs\BTS2013LAB01_BAMAlertsApplication_Log_BTS_2013_11_12_17_51_07_990.bak’. Operating system error 3(The system cannot find the path specified.). [SQLSTATE 42000] (Error 3201) BACKUP LOG is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.

In this case you also get one or several errors in the Event Viewer:

BackupDiskFile::CreateMedia: Backup device ‘K:\Backups\BizTalk Database\Logs\BTS2013LAB01_BAMAlertsApplication_Log_BTS_2013_11_12_17_51_07_990.bak’ failed to create. Operating system error 3(The system cannot find the path specified.).

Backup-BizTalk-Server-job-error-message-MarkAndBackupLog

CAUSE

If you check the parameters of the “sp_MarkAll” stored procedure you will see that the second parameter is the location of backup files and this location must exist in the file system.

SOLUTION

You must remember that you need to ensure that all the paths specified in the BizTalk jobs must exist in the file system. In my case, we create the folder on the file system and run the job again with success.


White Paper: Installing BizTalk Server 2013 in a Standalone Machine

$
0
0

I couple of months ago I published two white papers through BizTalk360, an initiative came from an invitation of Saravana Kumar that I promptly accepted. However I had never mentioned my White Papers in my blog… what a shame!

Installing BizTalk Server 2013 in a Standalone Machine (complete user guide)

Installing BizTalk Server 2013 in a Standalone MachineThis white paper explains in detailed how to install and configure Microsoft BizTalk Server 2013 on a single computer running Windows Server 2012. This guide will help you plan the installation and configuration BizTalk Server 2013, applications and components on which it depends focused on creating a development environment (you can also follow this tutorial to help you create production environments, however if this is the case you need to skip some steps)

We will assume that the machine already have installed the operating system: Windows Server 2012 and latest critical Windows updates from Microsoft.

This is a complete step-by-step user guide with 128 page that will perform a full installation of Microsoft BizTalk Server, with the exception of the deprecated SharePoint Adapter (SharePoint Services Service Side Object Model (SSOM)). The following components will be installed:

  • Enterprise Single Sign-On (SSO).
  • BizTalk Group.
  • BizTalk Runtime.
  • Business Rule Engine.
  • BAM Tools and Alerts.
  • BAM Portal.
  • BizTalk EDI/AS2 Runtime
  • Microsoft BizTalk Adapters for Enterprise Applications (BizTalk Adapter Pack)
  • Microsoft UDDI Services
  • Microsoft BizTalk ESB Toolkit

The white paper is available for download in BizTalk360 website:

Installing BizTalk Server 2013 in a Standalone Machine (complete user guide)
BizTalk360 White Papers

 

This white paper is basically an improved version of my BizTalk 2013 Installation and Configuration post series published in my blog. Why improved? Because I have the pleasure of having extraordinary BizTalk experts reviewing and give their feedback. So thanks Nino Crudele (Microsoft Integration MVP), Steej-Jan Wiggers (Microsoft Integration MVP), Tord Glad Nordahl (Microsoft Integration MVP) and Ricardo Torre (Technical Pre-Sales & Product Strategist at BizTalk360 and former PFE at Microsoft) for spending your time reviewing this white paper.

I hope you enjoy reading this paper and any comments or suggestions are welcome.


White Paper: Installing and Configuring BizTalk360 on Windows Server 2012/BizTalk Server 2013

$
0
0

The second white paper I initial wrote for a client who wished to try BizTalk360 tool, then I converted to this document that was reviewed by Saravana Kumar and its team.

Installing and Configuring BizTalk360 on Windows Server 2012 / BizTalk Server 2013 (user guide)

Installing and Configuring BizTalk360 on Windows Server 2012 / BizTalk Server 2013 (user guide)You can download the BizTalk360 installation package here: http://www.biztalk360.com/content/download. A basic user registration is required before downloading the BizTalk360 MSI package and you will have a 14 days free trial key that will be emailed to the registered email address. The trial key is valid for both standard and enterprise edition and can be tested in as many environment as required.

This article explains how to install and configure BizTalk360 in an existing Microsoft BizTalk Server 2013 standalone machine (single computer) running under Windows Server 2012. This information will help you plan the BizTalk360 installation and configuration process and components on which it depends.

We will assume that the machine already have installed all basic BizTalk Server 2013 components like:

  • Enterprise Single Sign-On (SSO).
  • BizTalk Group.
  • BizTalk Runtime.

In this scenario we will perform a full installation of BizTalk360. The following components will be installed:

  • BizTalk360 – Website
  • BizTalk360 – Windows Service
  • BizTalk360 – Database

The white paper is available for download in BizTalk360 website:

Installing and Configuring BizTalk360 on Windows Server 2012 / BizTalk Server 2013 (user guide)
BizTalk360 White Papers

I hope you enjoy reading this paper and find it useful. Any comments or suggestions are welcome.



BAM Portal configuration error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Configuration)

$
0
0

Last week while making a simple BizTalk Server 2013 multi-computer environment (1 SQL Server and 1 BizTalk Server both running Windows Server 2012) configuration I faced several issues to properly configure BAM Portal, this was the first one.

I was able to properly configure all the features: Enterprise SSO, Group, BizTalk Runtime, Business Rules Engine, BizTalk EDI/AS2 Runtime and even BAM Tools without any kind of problem, however every time I tried to configure BAM Portal I was getting the following error:

BAM Portal: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Configuration)

Unexpected-exception-occurred-while-configuring-BAM-Portal

When checking the BizTalk Server Configuration log file, we were able to see something like the following message:

[datetime … Error Configuration Framework] Feature: [BAM Portal] Failed to configure with error message [<Exception Message="Unexpected exception occurred while configuring [BAM Portal].” Source=”" HelpID=”"><Exception Message=”Attempted to read or write protected memory. This is often an indication that other memory is corrupt.” Source=”Configuration” HelpID=”" /></Exception>]

However this is the generic message and doesn’t give us the real cause and doesn’t help us tracking the problem.

Suggestion: When this appends, don’t get stuck in that line, you should continue to read the log file because you will find useful and valid information’s!

In this case the real problem was:

[datetime … Error ConfigHelper] Cannot alter the role ‘NSSubscriberAdmin’, because it does not exist or you do not have permission.

CAUSE

The BizTalk Server Configuration Tool is trying to add the “BAM Management Web Service user” that was specify in the BAM Portal section into a database role called “NSSubscriberAdmin”, which doesn’t exist in the BAM Alert Application Database (BAMAlertsApplication) and for that reason it raises this exception.

SOLUTION

There are some known issue in the BizTalk Server 2013 release that was fixed in the Cumulative Update 1 specially this one regarding BAM Tools: KB article 2832137 – FIX: BAM tools cannot be configured in a multi-node BizTalk Server 2013 environment. I know is not exactly the same error, nevertheless , I advise that before you try to configure BizTalk Server 2013 you should apply the CU’s available.

However in my case to solve the problem you must manually add “NSSubscriberAdmin” Database Role to BAM Alert Application Database (BAMAlertsApplication) by:

  • Expand a server group, and then expand a server.
  • Expand “Databases”, and then expand the BAMAlertsApplication database
  • Expand “Roles”. Right-click over “Roles” and select “New Database Role” option.

Add-SQL-NSSubscriberAdmin-Database-Role

  • In the Name box, enter the following name: “NSSubscriberAdmin”.
  • Click “OK”.

Alternative you can use the following SQL Query:

USE BAMAlertsApplication
CREATE ROLE NSSubscriberAdmin AUTHORIZATION dbo
GO

Fortunately I was able to find this problem in the BizTalk Server: List of Errors and Warnings, Causes, and Solutions TechNet Wiki article which led me to René Brauwers solution.


Microsoft.BizTalk.Bam.Management.BamManagerException: Encountered error while executing command on SQL Server "servername". —> System.Data.SqlClient.SqlException: The EXECUTE permission was denied on the object ‘bam_Metadata_GetProperty’, database ‘BAMPrimaryImport’, schema ‘dbo’

$
0
0

Last week while making a simple BizTalk Server 2013 multi-computer environment (1 SQL Server and 1 BizTalk Server both running Windows Server 2012) configuration I faced several issues to properly configure BAM Portal, this was the first one was described in my previous blog post. This is the second one:

By solving the problem described in my previous post I was able to properly configure all the features in BizTalk Server: Enterprise SSO, Group, BizTalk Runtime, Business Rules Engine, BizTalk EDI/AS2 Runtime, BAM Tools and BAM Portal without any more problems, however we notice that the BAMAlerts service was logging several errors in the Event Viewer and was constantly stopping.

BAMAlerts-Service-stopped

When we check the Event Viewer we were able to see the following messages:

Encountered error while executing command on SQL Server “server name”.
Event ID 0

Of course this was the generic message and doesn’t give us the real cause and doesn’t help us tracking the problem but we were able to get more details in the rest of the logs registered in the Event Viewer:

at Microsoft.BizTalk.Bam.AlertHost.Utility.GetProperty(String dbServer, String dbName, String propertyName, String scope)
at Microsoft.BizTalk.Bam.AlertHost.AlertHost.GetBAMMetadataProperties()
at Microsoft.BizTalk.Bam.AlertHost.AlertHost.Run()

Unhandled exception caught. Stoppping the service.

And finally:

Microsoft.BizTalk.Bam.Management.BamManagerException: Encountered error while executing command on SQL Server “servername”. —> System.Data.SqlClient.SqlException: The EXECUTE permission was denied on the object ‘bam_Metadata_GetProperty’, database ‘BAMPrimaryImport’, schema ‘dbo’.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at Microsoft.BizTalk.Bam.Management.SqlHelper.ExecuteScalar(String cmdText, CommandType cmdType)

When looking at the “bam_Metadata_GetProperty” stored procedure in the database “BAMPrimaryImport” database, we found that no role were defined:

bam_Metadata_GetProperty-stored-procedure-permissions

CAUSE

These problems occurs because the BizTalk Server Configuration Tool didn’t properly configure the right permissions in this stored procedure.

As I described in my previous post, there are some known issue in the BizTalk Server 2013 release that was fixed in the Cumulative Update 1 specially this one regarding BAM Tools: KB article 2832137 – FIX: BAM tools cannot be configured in a multi-node BizTalk Server 2013 environment. I know is not exactly the same error, nevertheless, I think these problems are related to this configuration issue. So again I advise that before you try to configure BizTalk Server 2013 you should apply the CU’s available.

SOLUTION

Again I advise that before you try to configure BizTalk Server 2013 you should apply the CU’s available.

However in my case to solve the problem I had to manually configure the correct permissions on this stored procedure, luckily I have other environments where I can check to see the correct permissions, so to solve this you need to:

  • Expand a server group, and then expand a server.
  • Expand “Databases”, expand the BAMPrimaryImport database, and then expand “Programmability”.
  • Expand “Stored Procedures”, right-click in the “bam_Metadata_GetProperty” procedure to grant permissions on, and then select “Properties” option.
  • From Stored Procedure Properties, select the “Permissions” page.
  • And to grant permissions to a user, database role, or application role you must click “Search” button.
    • In this case we need to give execution privileges to the database role “BAM_ManagementNSReader”

bam_Metadata_GetProperty-stored-procedure-right-permissions

  • Click “OK”.

Alternative you can use the following SQL Query:

USE BAMPrimaryImport
GRANT EXECUTE ON OBJECT::bam_Metadata_GetProperty
    TO BAM_ManagementNSReader;
GO

A different way to Force a Full Backup of the BizTalk Server databases

$
0
0

BizTalk Server databases and their health are very important for a successful BizTalk Server database messaging environment. BizTalk is shipped out with a total of 13 SQL Agent jobs that perform important functions to keep your servers operational and healthy.

Like any other system, all BizTalk Server databases should be backed up and BizTalk Server will provide out-of-the-box a job for accomplished that: Backup BizTalk Server (BizTalkMgmtDb) job.

This job makes both Full and Log backups. By default the Backup BizTalk Server job performs a full backup once a day and performs log backups every 15 minutes. This means that once the full backup is performed you need to wait 24 hours for it to automatically do another full backup of the BizTalk Server databases… even if you try to manually run the job, it will only make the backups of the log files.

But sometimes we need, for several reasons, to have the ability and the possibility to force a full backup:

  • We will have some maintaining plan on the server, or apply a new configuration, and we want to backup the environment
  • Or simple we will install a new integration application and again we want to have a backup in this exact moment

Each company have is policies, so again for several reasons, we sometimes need to force a full backup of all BizTalk Server databases.

The standard way is to use the “BizTalkMgmtDb.dbo.sp_ForceFullBackup” stored procedure. However, and unlike what many people think, this stored procedure does not perform a full backup it only marks internally on BizTalk Server databases that the next time the Backup BizTalk Server job runs it will need to perform a full backup of the data and log files.

All BizTalk Admins know this (if they don’t know, they should!), however sometimes we need to really on DBA Admins to perform this task, and do not misunderstand me, I have nothing against DBA! All the BizTalk Administration team should be composed by several element with different skills: DBA Admins, network admins, Sys Admins and a BizTalk Admins… each playing its role. But sometime DBA don’t really understand the BizTalk infrastructure and BizTalk Administrator should have an important role advising and helping them (like in other situations it will be the opposite).

And because this is not a day by day task people tend to forget all the steps and sometimes they will create custom scripts to perform this task, but you really need to be aware of two important things:

  • The Backup BizTalk Server job is the only supported method for backing up the BizTalk Server databases. Use of SQL Server jobs to back up the BizTalk Server databases in a production environment is not supported.
  • You can use the SQL Server methods to backup the BizTalk Server databases only if the SQL Server service is stopped and if all BizTalk Server processes are stopped.

So to help one of my DBA teams I end up creating this job that is composed by two steps:

  • Step 1: Force Full Backup
    • That will call the “BizTalkMgmtDb.dbo.sp_ForceFullBackup” stored procedure
  • Step 2: Backup BizTalk Server
    • That will call the standard Backup BizTalk Server (BizTalkMgmtDb) job

Force-Full-Backup-BizTalk-Server-BizTalkMgmtDb

Note: Of course this custom job should be disabled and manually executed when you need it!

Hope you find it useful

You can download the custom “Force Full Backup BizTalk Server (BizTalkMgmtDb)” Job from:

Force Full Backup BizTalk Server (BizTalkMgmtDb) Job (863 bytes)
Microsoft | TechNet Gallery

 


Managing and cleaning BizTalk Server MarkLog database tables according to some Best Practices

$
0
0

All the BizTalk database which is being backed up by the ‘Backup BizTalk Server’ job, so all databases with the exception of the BAM Star Schema database (BAMStarSchema), has one table called “MarkLog”.

These tables are holding all the transaction marks (they are actually timestamps in a string format), set to a specific database, created by the 3th step (MarkAndBackUpLog) of the ‘Backup BizTalk Server’ job. This step, MarkAndBackupLog, is responsible for marking the logs for backup, and then backing them up. So each time this step runs, by default each 15 minutes, a string is stored on that table with the following naming convention:

  • Log_<yyyy>_<MM>_<dd>_<HH>_<mm>_<ss>_<fff>

Where:

  • Log”: Constant string
  • yyyy: The year as a four-digit number.
  • MM: The month, from 01 through 12
  • dd: The day of the month, from 01 through 31.
  • HH: The hour, using a 24-hour clock from 00 to 23.
  • mm: The minute, from 00 through 59.
  • ss: The second, from 00 through 59.
  • fff: The milliseconds in a date and time value.

Again this marks are timestamps in which the Log backups were set to be made. Example:

  • BTS_2014_05_06_14_15_01_327

Unfortunately BizTalk has no out-of-the-box possibilities to clean up these tables. And the normal procedure is to run the terminator tool to clean it up. See also: Clean up the MarkLog table with Terminator

Terminator-Tool-Purge-MarkLogs

BizTalk Terminator is an excellent tool that allows for common BizTalk problems to be addressed by scripts provided by the BizTalk Team, but needs to be used carefully and by users who know what they are doing.

Although most of the times this is extremely useful tool and our friend, in this particular operation/situation using this tool it’s not really the best option for two reasons:

  • Using this tool means that we need to stop our environment, i.e., downtime in our integration platform.
  • And if we look at the description of this “PURGE Marklog table” task it says that this operation calls a SQL script that cleans up everything in Marklog table – and maybe this is not a best practices!

I spoke to my dear friend, and one of the best BizTalk Administrator that I know, Tord Glad Nordahl to discuss and know what should be the best practice to maintain these tables:

  • Is these information (timestamps) useful for BizTalk Administrators?
  • Should I clean all the data inside this tables or should I maintain a history?
  • Is safe to clean this information in runtime?

Were some of the questions that we discussed.

Is these information (timestamps) useful for BizTalk Administrators? Should I clean all the data inside this tables or should I maintain a history?

For the same reason that we maintain a Backup history in the Adm_BackupHistory table controlled by the step “Clear Backup History” of the ‘Backup BizTalk Server’ job. This information is important for example to keep an eye on the backup/log shipping history records to see whether the back is working correctly and data/logs are restored correctly in the stand by environment. The information on the MarkLog tables are also useful for the BizTalk Administration team!

So as long as the MarkLog tables have the same info (data from the same dates) as the backup job days to keep you can safely delete the rest of the information.

As a best practices: you should respect the @DaysToKeep parameter that you specify in the “Clear Backup History” step of the ‘Backup BizTalk Server’ job.

And this is why that in my opinion, you shouldn’t use the Terminator tool to perform this operation!

Is safe to clean this information in runtime?

The rows in the Marklog table are not “required” and can be cleaned whenever you want as long the BizTalk Backup Job is not running.

Cleaning MarkLog Tables According to Some of the Best Practices

So the main challenger is how can we safely delete and maintain a history of all MarkLog tables according to some of the best practices described earlier?

My first approach was creating a new job that according to a scheduler would run a stored procedure to delete all the unnecessary information on that tables but I realized I could have two problems with this approach:

  • I need to be sure that BizTalk Backup Job wasn’t running performing the backups;
  • And I didn’t want to have to places to define the @DaysToKeep and I didn’t want to make unnecessary joins or additional selects

I was trying to find an approach for this operation to be carried out in an easy way and as fast as possible.

So I end up recreating sp_DeleteBackupHistory (that is configured is the Backup BizTalk Server (BizTalkMgmtDb) job in the last step) with a different name sp_DeleteBackupHistoryAndMarkLogsHistory and configure the job to run this step:

CREATE PROCEDURE [dbo].[sp_DeleteBackupHistoryAndMarkLogsHistory] @DaysToKeep smallint = null, @UseLocalTime bit = 0
AS
 BEGIN
	set nocount on
	IF @DaysToKeep IS NULL OR @DaysToKeep <= 0
		RETURN
	/*
		Only delete full sets
		If a set spans a day such that some items fall into the deleted group and the other don't don't delete the set

		Delete history only if history of full Backup exists at a later point of time
		why: history of full backup is used in sp_BackupAllFull_Schedule to check if full backup of databases is required or not.
		If history of full backup is not present, job will take a full backup irrespective of other options (frequency, Backup hour)
	*/

	declare @PurgeDateTime datetime
	if (@UseLocalTime = 0)
		set @PurgeDateTime = DATEADD(dd, -@DaysToKeep, GETUTCDATE())
	else
		set @PurgeDateTime = DATEADD(dd, -@DaysToKeep, GETDATE())

	DELETE [dbo].[adm_BackupHistory]
	FROM [dbo].[adm_BackupHistory] [h1]
	WHERE 	[BackupDateTime] < @PurgeDateTime
	AND	[BackupSetId] NOT IN ( SELECT [BackupSetId] FROM [dbo].[adm_BackupHistory] [h2] WHERE [h2].[BackupSetId] = [h1].[BackupSetId] AND [h2].[BackupDateTime] >= @PurgeDateTime)
	AND EXISTS( SELECT TOP 1 1 FROM [dbo].[adm_BackupHistory] [h2] WHERE [h2].[BackupSetId] > [h1].[BackupSetId] AND [h2].[BackupType] = 'db')

	/****** Delete MarkLog History from BAMAlertsApplication database ******/
	DELETE FROM [BAMAlertsApplication].[dbo].[MarkLog]
    WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

	/****** Delete MarkLog History from BAMArchive database* *****/
	DELETE FROM [BAMArchive].[dbo].[MarkLog]
	WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

	/****** Delete MarkLog History from BAMPrimaryImport database ******/
	DELETE FROM [BAMPrimaryImport].[dbo].[MarkLog]
	WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

	/****** Delete MarkLog History from BizTalkDTADb database ******/
	DELETE FROM [BizTalkDTADb].[dbo].[MarkLog]
	WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

	/****** Delete MarkLog History from BizTalkMgmtDb database ******/
	DELETE FROM [BizTalkMgmtDb].[dbo].[MarkLog]
	WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

	/****** Delete MarkLog History from BizTalkMsgBoxDb database ******/
	DELETE FROM [BizTalkMsgBoxDb].[dbo].[MarkLog]
	WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

	/****** Delete MarkLog History from BizTalkRuleEngineDb database ******/
	DELETE FROM [BizTalkRuleEngineDb].[dbo].[MarkLog]
	WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

	/****** Delete MarkLog History from SSODB database ******/
	DELETE FROM [SSODB].[dbo].[MarkLog]
	WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep
 END

Steps required to install/configure

  • Create the sp_DeleteBackupHistoryAndMarkLogsHistory stored procedure described earlier
  • You need to adjust the SQL Script to your environment because some environment may not have all features installed, for example: Business Rules and in this case BizTalkRuleEngineDb database will not exist.
  • Change and configure the 4th step of the ‘Backup BizTalk Server’ job – “Clear Backup History” to call this new stored procedure

sp_DeleteBackupHistoryAndMarkLogsHistory

Note: Do not change or delete the “sp_DeleteBackupHistory”!

Special thanks for Tord Glad Nordahl for reviewing and all the feedback, and to my friends at DevScope Rui Romano and Pedro Sousa for the helping me developing this SQL Query.

Hope you find it useful

You can download the custom sp_DeleteBackupHistoryAndMarkLogsHistory stored procedure from:

BizTalk Server: Cleaning MarkLog Tables According to Some of the Best Practices (1.2 KB)
Microsoft | TechNet Gallery

 


New release: Managing and cleaning BizTalk Server MarkLog database tables: sp_DeleteBackupHistoryAndMarkLogsHistory

$
0
0

Almost three weeks ago in my last post I release a SQL script to manager and delete the unnecessary records in the BizTalk “MarkLog” tables according to some of the best practices (you can read more here: Managing and cleaning BizTalk Server MarkLog database tables according to some Best Practices), however I knew in advance that the script had some limitations:

  • Basically the user needs to update the script manually after “installing” it. He/she needs to add and remove the databases that might not be in use (like BAM).
  • Or add, if more than one MsgBox is used.

But the beautiful of the BizTalk Community is that sometimes they provided awesome feedback, and that was exactly what happened in this case. 10 days after I published my post, I received an email from Mikael Sand, Mikael is a strong BizTalk Community member from Sweden that I had the pleasure of meeting him in person, I think the first time was two years ago in Norway, describing this exact limitations but… you are making a mistake if you think that he only described the limitations!!

Indeed he spent some time describing the limitations but I also provided me with an updated scripts with all the improvement necessary to suppress these limitations! Basically Mikael updated the script using an identical logic from another SP in the backup job so that user doesn’t need to update the script once it is installed. Also, it does not need to be updated if a database (like BAM) is added later or if you are using more than one MsgBox.

Basically the differences between the first release and this one is that:

  • Instead of hard coding implement all the delete necessary queries
/****** Delete MarkLog History from BAMAlertsApplication database ******/
DELETE FROM [BAMAlertsApplication].[dbo].[MarkLog]
WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

/****** Delete MarkLog History from BAMArchive database* *****/
DELETE FROM [BAMArchive].[dbo].[MarkLog]
WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

/****** Delete MarkLog History from BAMPrimaryImport database ******/
DELETE FROM [BAMPrimaryImport].[dbo].[MarkLog]
WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

/****** Delete MarkLog History from BizTalkDTADb database ******/
DELETE FROM [BizTalkDTADb].[dbo].[MarkLog]
WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

/****** Delete MarkLog History from BizTalkMgmtDb database ******/
DELETE FROM [BizTalkMgmtDb].[dbo].[MarkLog]
WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

/****** Delete MarkLog History from BizTalkMsgBoxDb database ******/
DELETE FROM [BizTalkMsgBoxDb].[dbo].[MarkLog]
WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

/****** Delete MarkLog History from BizTalkRuleEngineDb database ******/
DELETE FROM [BizTalkRuleEngineDb].[dbo].[MarkLog]
WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep

/****** Delete MarkLog History from SSODB database ******/
DELETE FROM [SSODB].[dbo].[MarkLog]
WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),'_',''), GETDATE()) > @DaysToKeep
  • Mikael have implementing this same operation dynamically by “stolen” the cursors logic and realservername from the BizTalk procedure “sp_MarkBTSLogs”. The cursor iterates all the databases that are backed up by BizTalk.
DECLARE @BackupServer sysname, @BackupDB sysname, @RealServerName sysname
DECLARE @tsql nvarchar(1024)
DECLARE @ret int
/* Create a cursor */
DECLARE BackupDB_Cursor insensitive cursor for
   SELECT ServerName, DatabaseName
   FROM	admv_BackupDatabases
   ORDER BY ServerName

open BackupDB_Cursor
fetch next from BackupDB_Cursor into @BackupServer, @BackupDB
WHILE (@@FETCH_STATUS = 0)
   BEGIN
      -- Get the proper server name
      EXEC @ret = sp_GetRemoteServerName @ServerName = @BackupServer, @DatabaseName = @BackupDB, @RemoteServerName = @RealServerName OUTPUT

      /* Create the delete statement */
      select @tsql =
      'DELETE FROM [' + @RealServerName + '].[' + @BackupDB + '].[dbo].[MarkLog]
      WHERE DATEDIFF(day, REPLACE(SUBSTRING([MarkName],5,10),''_'',''''), GETDATE()) > ' + cast(@DaysToKeep as nvarchar(5) )
                            
      /* Execute the delete statement */
      exec (@tsql)
      /* Get the next DB. */
      fetch next from BackupDB_Cursor into @BackupServer, @BackupDB
   END
close BackupDB_Cursor
deallocate BackupDB_Cursor

Then I spent some days testing and improving a little more the script, and again by looking to the same SP: “sp_MarkBTSLogs”, I was able to implemented some kind of error handling, just in case of something fails that an exception will be raised, as you can see in this example picture bellow:

sp_DeleteBackupHistoryAndMarkLogsHistory-error-handling

Special thanks for Mikael Sand for the feedback and for this new implementation logic, and of course to the previous persons involved: Tord Glad Nordahl, Rui Romano and Pedro Sousa.

You can download the last version of the custom sp_DeleteBackupHistoryAndMarkLogsHistory stored procedure from:

BizTalk Server: Cleaning MarkLog Tables According to Some of the Best Practices (1.2 KB)
Microsoft | TechNet Gallery


Viewing all 74 articles
Browse latest View live