I want to leave SQL Server profiler running all the time logging any query that runs for longer than 5 seconds. It's simple enough to start this using the profiler tool on my PC but how do I create it so it runs in the background on the server?
I would recommend that you use a server side trace for this task rather than running a SQL Server Profiler trace via the GUI.
The performance overhead of running a server side trace, verses a trace via SQL Server Profiler is significantly reduced.
Take a look at the following blog post for an example of creating a server side trace:
For detailed documentation consult SQL Server Books Online topic: