January 2006 - Posts

Complex systems and SQL Server

"If you manage a complex system you will frequently, if not always, be wrong." This is a quote from Michael Crichton’s speech "Fear, Complexity, & Environmental Management in the 21st Century".

In his speech, he talks about how it is human nature to make linear assumptions about non-linear, complex systems.

Although he discussed this within the context of global, environmental, political, and biological issues – it got me thinking about the feature expansion of SQL Server 2005 and performance tuning/optimization. 

As SQL Server professionals we can make a certain amount of fair assumptions.  We can coin "best" and "worst" practices - and suggest design and architecture choices that, on average, yield optimal results under certain circumstances. 

SQL Server performance tuning, however, is one of the more slippery topics.  A "my query runs too long" issue from an end-user could be the result of several factors such as hardware, network, database design, sizing, query construction, and concurrent query traffic.  Embedded within each of these factors is an array of other considerations - statistics, fragmentation, cursor-usage versus set-processing, query hints, sp_configure settings, locking...

Unlike complex systems like weather or government, you do have much more control over how your SQL Server instance is configured. Also, over time a SQL Server professional develops a repertoire of troubleshooting patterns – problem/responses that build up over time, allowing him or her to fix issues quickly.  There is both danger and benefit from this gained experience.  The benefit is that you fix issues more quickly than someone who hasn’t experienced the problem before.  The danger/drawback is that you may lead yourself down the wrong path without considering other avenues.  Even after eight years of working closely with SQL Server, I still try to collect a sufficient amount of information before coming to a conclusion.  Snap-judgments based on a single email complaint or discussion can often lead to incorrect assumptions.

Michael Crichton says that when you make predictions on complex systems which are incorrect, that "you have to backtrack. You have to acknowledge error. You’ve probably learned that with your children. Or, if you don’t have children, with your bosses." 

Being a SQL Server professional, there is always more to learn (which is why I love this profession) - but if you are incautious in your troubleshooting approach, you'll soon be humbled.  This is the reality of a complex system.

RS T-SQL tip: Identify which reports are being emailed via subscriptions in Reporting Services 2000

If you need to identify which reports are emailed to specific users (either to remove them from the subscription - or just as an FYI), you can execute the following query in the ReportServer, SQL Server 2000 Reporting Services database:

SELECT [Name] ReportName
FROM ReportServer.dbo.Catalog
WHERE ItemID IN (SELECT Report_OID
   FROM ReportServer.dbo.Subscriptions
   WHERE ExtensionSettings LIKE
'%joesack@test.com%')
ORDER BY Name

Wildcards are used as the email is embedded in an XML format in the ExtensionSettings column. The query example then returns any reports with a subscription email to joesack@test.com.

SSIS BUG - Migrate DTS 2000 Package fails when pulling packages with trailing blanks

So today I was testing out the SSIS "Migrate DTS 2000 Package" wizard.  I went through the following steps:

1.  In BIDS, I right-clicked the SSIS Packages folder in the Solution Explorer.

2.  Selected Next at the Wizard intro.

3.  Selected the source location (where I'll be pulling the packages from).

4.  Selected the destination location (the folder where the converted packages will reside).

On the next dialog box I'm supposed to see a list of DTS 2000 packages on the source SQL Server instance, but instead I get the error:

"Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index (mscorlib)"

After digging through the newsgroups, I found a tip that this was caused by trailing blanks in the DTS package names.  I ran the following query to identify the offending packages:

SELECT DISTINCT name
FROM msdb.dbo.sysdtspackages
WHERE name LIKE '% '

After renaming the packages (removing trailing blanks) - the List Packages dialog box worked!  Thanks Koni Kogan!