How to kill oldest open transaction automatically?

  • Is there any way to make script, which find oldest open transaction and kill those oldest Process.

    I have tried dbcc opentran, but from that i can not got opuput into another table, otherwise i can kill those process...Please give me a script or TSQL to kill oldest open transaction.

    Please needfull to me..

    Thanks

    _____________________________________________________________________________________________________________
    Paresh Prajapati
    ➡ +919924626601
    http://paresh-sqldba.blogspot.com/[/url]
    LinkedIn | Tweet Me | FaceBook | Brijj

  • Not sure what exactly you want to kill. If your looking for old processes which are no longer active, you can use the sys.processes table or in SQL 2005 the DMV sys.dm_exec_sessions.

    If it's open transactions your looking for you could use DBCC OPENTRAN WITH TABLERESULTS to insert the results into a tablevariable.

    But again the recommended way in SQL 2005 would be using the DMV sys.dm_tran_active_transactions or sys.dm_tran_database_transactions.

    [font="Verdana"]Markus Bohse[/font]

  • Paresh Prajapati (11/10/2008)


    Is there any way to make script, which find oldest open transaction and kill those oldest Process.

    I have tried dbcc opentran, but from that i can not got opuput into another table, otherwise i can kill those process...Please give me a script or TSQL to kill oldest open transaction.

    Please needfull to me..

    Thanks

    killing transactions means what

    is it

    cancelling

    closing

    committing

    rollbacking

    kshitij kumar
    kshitij@krayknot.com
    www.krayknot.com

  • Thanks guys

    I got oldest active transactions which are remain to close from DMV which u have given.

    Now I am able to kill or rollback those transactions.

    _____________________________________________________________________________________________________________
    Paresh Prajapati
    ➡ +919924626601
    http://paresh-sqldba.blogspot.com/[/url]
    LinkedIn | Tweet Me | FaceBook | Brijj

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

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