Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 How to filter Profiler for a single database?

Author  Topic 

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2009-02-19 : 13:33:57
We just found out today that if you setup a Profiler trace with a filter of DatabaseName Like 'Database1' we can only see activity for Database1 if SQL commands are run from Database1. If we are in master or some other database and run a fully qualified command such as "SELECT * FROM Database1.dbo.sysobjects" this statement does not appear in the trace. Apparently DatabaseName and DatabaseId only show the name and id of the database from which the command was executed (ex: master), not the name or id of the database the command was executed against (ex: Database1). This is not the way Profiler behaved in 2000. How can we create a Profiler trace to show all activity in a specific database?

Thanks, Dave

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-19 : 13:49:01
If you are executing the commands from a different database, then you can't filter the trace.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2009-02-19 : 14:49:33
That's what we thought. Why would Microsoft change this functionality? I ran another test in 2000 confirming that 2000 allows you to filter on a database id and capture all activity against the database, regardless of if the command is being executed from another database. Now we have no idea how to trace a single database. This particular system has far too much activity to allow a trace to run against all databases and then filter after the fact.

Thanks, Dave
Go to Top of Page
   

- Advertisement -