I want to be able to see all the queries that has been executed on the server last 2 days etc.
see the script, date of execution, sender etc. is there any way?
I am using SQL X 2005.
I want to be able to see all the queries that has been executed on the server last 2 days etc.
see the script, date of execution, sender etc. is there any way?
I am using SQL X 2005.
I don't believe it's possible without SQL Server Profiler running.
Yes you can use SQL-Trace to log each command submitted to the server. It's the same mechanism used by the profiler, but you do not have to have the profiler or any other tool to use it.
There are two modes in which SQL Trace can run - in-memory buffer and disk file. The former is only used by profiler, is not documented and should not be used. Use the disk-file mode. The file can later on be opened on the same or different machine and even loaded into a table for analysis.
To learn more go to this page: http://msdn.microsoft.com/en-us/library/ms191511.aspx and search for section titled "To perform monitoring tasks with SQL Trace by using Transact-SQL stored procedures"