ReadMe.txt
==========
This file describes the presentation materials for my "Deadlocks: Detection, Troubleshooting, and Prevention" presentation (version 3.0006).

I'd love to receive feedback from you.   Please send comments, questions, and suggestions to tbarkhouse@terremark.com


Slide Deck
==========
"Deadlocks- Detection, Troubleshooting, and Prevention.pdf"


Handouts
========
"References and Resources.pdf"


Useful Scripts for a DBA/Developer's Tool Kit
=============================================

NOTE: The following scripts have a suffix showing the versions of SQL Server to which they apply.

    Scripts to make 1205 errors be recorded in the error log
    --------------------------------------------------------
    "Configure error 1205 for logging,2000.sql"
    "Demo 04_Configure error 1205 for logging,2005+.sql"

    Scripts to turn on and off trace flags that record deadlock information in the error log
    ----------------------------------------------------------------------------------------
    "Enable the trace flags for recording deadlock information in the error log,2000.sql"
    "Demo 05_Enable the trace flags for recording deadlock information in the error log,2005+.sql"

    Scripts to create server-side traces with the deadlock related event classes
    ----------------------------------------------------------------------------
    "Create a server-side trace to provide information on the next deadlock(s),2000.sql"
    "Demo 06_Create a server-side trace to provide information on the next deadlock(s),2005+.sql"
    "Stop and remove the server-side trace,2000.sql"
    "Demo 06_Stop and remove the server-side trace,2005+.sql"

    Script for retrieving deadlock information from the "system_health" Extended Events session
    -------------------------------------------------------------------------------------------
    "Demo 10_Display deadlock information from the XE ring buffer,2008+.sql"


Scripts for purposely causing deadlocks
=======================================

NOTE: These examples use the [AdventureWorks] sample database ("Microsoft SQL Server Product Samples: Database - Release: SQL Server 2005 SP2a" <http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=MSFTDBProdSamples&ReleaseId=4004>), not the [AdventureWorks2008] database ("Microsoft SQL Server Product Samples: Database - Release: SQL Server 2008 SR1" <http://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=18407>), even when demonstrating something on SQL Server 2008

    T-SQL:

        [AdventureWorks] Database (SQL Server 2005+)
        --------------------------------------------
        "Demo 01_ProcessA.sql"
        "Demo 01_ProcessB.sql"

        "Demo 02_ProcessA.sql"
        "Demo 02_ProcessB.sql"

        [Northwind] Database (SQL Server 2000+)
        ---------------------------------------
        "Demo 03_ProcessA.sql"
        "Demo 03_ProcessB.sql"

    PowerShell:

        [AdventureWorks] Database (SQL Server 2005+)
        --------------------------------------------
        "New-Deadlock.ps1"
            Command line (from the directory in which the PowerShell script resides):
                & '.\New-Deadlock.ps1' -InstanceName 'YourWorkstation\SS2005';

Example deadlock graphs
=======================

NOTE: I removed sensitive data (some T-SQL code, login names, host names, etc.) from the deadlock graphs

    Deadlock in a customer stored procedure
    ---------------------------------------
    "ComplexDeadlock.xdl"

    Deadlocks with a customer's log shipping SQL Server Agent jobs
    --------------------------------------------------------------
    "Logshipping deadlock graphs,20090612T1151.xdl"

    Automatically analyzing the deadlocks with the customer's log shipping SQL Server Agent jobs
    --------------------------------------------------------------------------------------------
    "Demo 07_Analyze log shipping deadlock graphs with XQuery,2005+.sql"
