Archive for the 'SQL Server' Category

Fast, Efficient Message Archiving for BizTalk with the BizTalk Message Archiving Pipeline Component. Download a Free 14-Day Trial!

Diagnosing Performance Problems in SQL Server

SQL Server is the heart of a BizTalk environment, so a performant database is a must for any self-respecting BizTalk setup. But, if you consider that SQL Server is causing you performance issues, where do you start to look?

Thankfully, there is a two part series on this exact topic from Graham Kent, a SQL Server Support Team escalation engineer, where is he discusses PSSDIAG/SQLDIAG and the information that it produces to help diagnose a whole raft of possible SQL Server performance problems. Links are below, enjoy!

Truncating the BizTalk 2006 Tracking Database

In Truncating the BizTalk 2004 Tracking  Database I discussed how to truncate the tracking database in BizTalk 2004. Over on the BizTalk Gurus forums, user Nick Busy wanted to do the same thing for BizTalk Server 2006 – he’s kindly allowed me to repost his instructions for the community on this blog:

0. Before start, ensure you have got the database admin priveleges on the database

1. Stop all BizTalk Server Host Instances

2. Full backup BizTalkDTADb database (just in case)

3. Make scripts to create views (MANDATORY)

dbo.dtav_ServiceFacts
dbo.dtav_MessageFacts
dbo.dtav_FindMessageFacts

4. Run SQL script:

use BizTalkDTADb
GO

– Drop the Views (before you perform this, ensure you take copies of these views!)
– unfortunately, it’s necessary for SQL 2000, but you can skip it for SQL 2005
Drop View dbo.dtav_ServiceFacts
Drop View dbo.dtav_MessageFacts
Drop View dbo.dtav_FindMessageFacts
Go

– Truncate the necessary Tables
Truncate Table dta_CallChain
Truncate Table dta_DebugTrace
Truncate Table dta_MessageInOutEvents

Truncate Table dta_ServiceInstanceExceptions
Truncate Table dta_ServiceInstances

Truncate Table Tracking_Fragments1
Truncate Table Tracking_Parts1
Truncate Table Tracking_Spool1

Truncate Table dta_MessageFieldValues

– end of the script

5. Update statistics on BizTalkDTADb database

– update statistics
exec sp_updatestats

6. Run the saved scripts (see step 3) to recreate the dropped views from your own environment.

7. Shrink BizTalkDTADb database (sometimes it doesn’t work from GUI, so using sql command will help)

– shrink database
dbcc shrinkdatabase (BizTalkDTADb, 10)

8. Start BizTalk Server Host Instances

9. Configure and enable SQL Agent job “DTA Purge and Archive” (to avoid over-growing the database in the future)

P.S. The script above does not truncate Rule Engine related tables.

Thanks Nick, much appreciated.

Can I get some BI with this?

While I’m lying in bed dying of flu for the second time this year (grrr!!), here is a little light-hearted look at which tastes better: SQL Server 2005 or Oracle 11g. Click on the screenshot or go to www.databasetastechallenge.com.

DBA Taste Challenge

“Now…. Who’s still thirsty!”

An Easier Way to do Complex FOR XML EXPLICIT

I’ve got to confess that I’m not all that good with the FOR XML EXPLICIT syntax to generate Xml straight out of SQL Server – although there are a few good resources on the technology, I don’t spend enough time writing it and just get hopelessly muddled when I have to write anything remotely complex.

So, after posting a plea for help to the SQL Server Xml MSDN Forum I was pleasantly surprised to learn about the new PATH Mode for generating Xml that is available in SQL Server 2005. To quote the MSDN website:

“…the PATH mode provides a simpler way to mix elements and attributes. PATH mode is also a simpler way to introduce additional nesting for representing complex properties. You can use FOR XML EXPLICIT mode queries to construct such XML from a rowset, but the PATH mode provides a simpler alternative to the potentially cumbersome EXPLICIT mode queries. PATH mode, together with the ability to write nested FOR XML queries and the TYPE directive to return xml type instances, allows you to write queries with less complexity.”

So, using PATH mode, you can generate Xml along the lines of:

PATH T-SQL Xml Output
With T-SQL as simple as this:

Xml PATH SQL T-SQL
Michael Rys has a couple of good blog posts on the subject here and here – well worth a read.

Further BizTalk & MSDTC Issues

Update 22nd June 2009: I’ve just encountered yet another issue trying to get MSDTC working. The culprit this time was a rogue entry in the hosts file (C:\WINDOWS\system32\drivers\etc\hosts) which had an incorrect IP address specified for the server I was trying to ‘DTC Ping’.

I encountered yet another MSDTC issue when talking to a remote SQL Server database following a BizTalk 2006 development environment upgrade from Windows Server 2003 Ent. Ed. to Service Pack 1.

The usual ‘Mutual authentication required’ / ‘No Authentication Required’ problem reared its head, and although this needed to be resolved, I was still receiving the ‘New transaction cannot enlist in the specified transaction coordinator‘ error when BizTalk attempted to do anything involving a distributed transaction. Even with a fresh installation and reconfiguration of MSDTC, I still couldn’t successfully run the DTCPing tool – the RPC test ran fine, but the Binding test failed every time:

Unsuccessful DTCPing Test

As discussed in this blog entry by Romualdas MSDTC additionally requires ‘NetBIOS over TCP/IP’ functionality enabled on the network adapter/s participating in the DTC transaction – this setting is disabled by default when using static IP addresses:

Enable NetBIOS over TCP/IP

Because MSDTC uses NetBIOS to resolve remote machine names (rather than DNS Fully Qualified Names which is a little odd reading this O’Reilly article), the DTCPing Binding test was unable to resolve the machine initiating the call and hence the failure of the test. Setting the network adapter to enable NetBIOS over TCP/IP resolved the issue (no restart was required).

Successful DTCPing Test



Get Adobe Flash playerPlugin by wpburn.com wordpress themes