Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Posts
    5

    Smile Unanswered: Most recent transaction details

    Hello,

    Can someone help in finding out the most recent transaction details of a Sybase database.

    Basically I am looking for the Transaction ID and Transaction TimeStamp of the most recent transaction performed on a Sybase database.

    Thanks,

  2. #2
    Join Date
    Jun 2002
    Location
    Argentina
    Posts
    78

    Lightbulb

    May be this select will help you, but you will have information of the current transactions.

    -------------------------------------------------------------------------------
    -- SYSPROCESSES RUNING INFO
    -------------------------------------------------------------------------------
    SET NOCOUNT ON

    SELECT "SPID:"
    + CONVERT(CHAR(7),t1.spid)
    + DB_NAME(t1.dbid) + ".."
    + OBJECT_NAME(t1.id, t1.dbid)
    + " LN:" + CONVERT(VARCHAR(10), t1.linenum)
    + " ST:" + CONVERT(VARCHAR(10), t1.stmtnum)
    + " CPU:" + CONVERT(VARCHAR(10), t1.cpu)
    + " PIO:" + CONVERT(VARCHAR(10), t1.physical_io)
    + CONVERT(VARCHAR(10), SHOW_PLAN(t1.spid, SHOW_PLAN(t1.spid, -1, -1,
    -1), SHOW_PLAN(t1.spid, SHOW_PLAN(t1.spid, -1, -1, -1),-1,-1),-1) )
    FROM master.dbo.sysprocesses t1
    WHERE t1.cmd != "AWAITING COMMAND"
    AND t1.suid > 0
    go
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------

    -- RUNNING PROCESS
    PRINT "RUNNING PROCESS"
    SET NOCOUNT ON
    SELECT
    "SPID: " + CONVERT(CHAR(7),t1.spid) +
    " USER: " + suser_name(t1.suid) +
    " DB: " + DB_NAME(t1.dbid) +
    " OBJ: " + OBJECT_NAME(t1.id, t1.dbid) +
    " CPU: " + CONVERT(VARCHAR(10), t1.cpu) +
    " PIO: " + CONVERT(VARCHAR(10), t1.physical_io) processes
    FROM master.dbo.sysprocesses t1
    WHERE t1.cmd != "AWAITING COMMAND"
    AND t1.suid > 0
    go

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

    -- SYSTRANSACTIONS
    PRINT "SYSTRANSACTIONS"
    SET NOCOUNT ON
    SELECT t.starttime,
    datediff(second, t.starttime, getdate()) seconds,
    substring(db_name(t.masterdbid),1,15) db_name,
    t.spid,
    suser_name(p.suid) login,
    p.cmd
    FROM master..systransactions t,
    master..sysprocesses p
    WHERE t.spid = p.spid
    ORDER BY 1
    go

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


    Bye bye

    Sebastian

  3. #3
    Join Date
    Sep 2004
    Posts
    5

    Thanq

    Hello,

    Thanq for the information provided. But I am looking for the details of the most recently committed transaction's details, some thing like the one generated by the following command :

    dbcc log (master, 0, 0, 0, -1, 30, 0)
    go

    Regards,

    Gopal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •