Tracing SQL Server Tables

  • I am trying to trace the activity of a table by objectid and objectname along with the dbid but I am getting all aciticy against the dbid.

     

    Does anyone know how to trace the activity against a specific table?

     

    Thanks

     

    Carl

  • Hi just a guess but, Click on the Filters tab of the trace properties. Scroll down to ObjectId or ObjectName. Can you enter the object id from sysobjects or table name here ? I am not certain if it would work. More exeperienced DBA's out there would know. Rgds Derek

  • Thanks Derek,

    I have already done this but it doesn't work as expected.

     

    Regards

     

    Carl

  • Hi Carl,

    I don't think this is possible in the way you might expect.

    If you try it using SQL2005 Profiler, which is more detailed in its description of settings and filters, there is no option to specify an object_id column for a SQL-Statement event.

    The best thing I can suggest is that you specify the object name in the textdata field (e.g. to monitor usage of a table called PhilTest set the textdata filter to read LIKE '%philtest%'.

    You'll also need to ensure that you monitor the events

    SP:StmtStarted/SP:StmtCompleted as well as SQL:StmtStarted/SQL:StmtCompleted

    otherwise you'll miss references to this object when run from within a stored procedure.

    This is a bit limiting, since it will exclude many other commands that you additionally want to monitor, but it should work for monitoring just that table.

    Phil

  • Cheers Phil,

    I'll give that a try.

    Hope things are going well?

     

    Carl

  • Thanks again Phil.

    That works a treat.

    Carl

Viewing 6 posts - 1 through 5 (of 5 total)

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