Long running transactions

  • Hi Team,

    i am very new to this forum.... we have SCOM R2 which monitors all our SQL servers which is quite ok and satisfied with the default SQL MP's.

    today i got a query from my DBA team to create a monitor for long running transactions. This is the script (Procedure) which is installed by the DBA team on all the SQL servers in my environment to the master databases.

    Need your help in creating a monitor.

    CREATE procedure [dbo].[p_open_tran_check]

    (

    @min-2 int

    )

    -----------------------------------------------------------------------

    -- Functional Area: DB Administration

    -- Purpose:

    --

    -- Parameters:

    --

    --

    -- Deployment Notes:

    -- resolve_db

    --

    -- History:

    -- ?.?.? ?/??/2008 resolve_author Created.

    -----------------------------------------------------------------------

    -- Copyright 2008 Inc. All Rights Reserved.

    -----------------------------------------------------------------------

    -- Unit Test

    /***

    ***/

    --

    as

    set nocount on

    set @min-2 = @min-2 * -1

    -- convert @min-2 to milliseconds

    select count(*) as qty

    from master.dbo.sysprocesses (readpast)

    where open_tran > 0

    and last_batch < dateadd( minute, @min-2, getDate() )

    and cmd <> 'GHOST CLEANUP'

    --and datediff(minute, last_batch, getDate() ) >= @min-2

    return

    -Vrkumar01

  • vrkumar01 (10/25/2010)


    Hi Team,

    i am very new to this forum.... we have SCOM R2 which monitors all our SQL servers which is quite ok and satisfied with the default SQL MP's.

    today i got a query from my DBA team to create a monitor for long running transactions. This is the script (Procedure) which is installed by the DBA team on all the SQL servers in my environment to the master databases.

    Need your help in creating a monitor.

    CREATE procedure [dbo].[p_open_tran_check]

    (

    @min-2 int

    )

    -----------------------------------------------------------------------

    -- Functional Area: DB Administration

    -- Purpose:

    --

    -- Parameters:

    --

    --

    -- Deployment Notes:

    -- resolve_db

    --

    -- History:

    -- ?.?.? ?/??/2008 resolve_author Created.

    -----------------------------------------------------------------------

    -- Copyright 2008 Inc. All Rights Reserved.

    -----------------------------------------------------------------------

    -- Unit Test

    /***

    ***/

    --

    as

    set nocount on

    set @min-2 = @min-2 * -1

    -- convert @min-2 to milliseconds

    select count(*) as qty

    from master.dbo.sysprocesses (readpast)

    where open_tran > 0

    and last_batch < dateadd( minute, @min-2, getDate() )

    and cmd <> 'GHOST CLEANUP'

    --and datediff(minute, last_batch, getDate() ) >= @min-2

    return

    Go to Authoring Console then... >Create Monitor >Script Monitor

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Hey Pablo (Paul) Berzukov,

    Thanks for your response. i am aware that we have to use a script monitor from authoring console.

    Create Monitor - Script monitor- selected SQL Database as Monitor target - Parent Monitor as Availability.

    now when i come to script.... do i have to copy all the script which i mentioned and paste it ??????

    if yes gr8 if no kindly suggest.

    under parameters what should i mention?????

    i previously used script based folder monitor which counts number of files where i gave the folder path and size.

    'd:\log\log.txt' '50'

    please let me know if i am not clear and apperciate your help.

    -Vrkumar01

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply