SQL Server 2008 - Capturing all SQL Statements Hitting the Server -
Can anyone give any suggestions for capturing all SQL statements to send out our profiles in the SQL Server is? I am aware of two ways of doing this, but I have to ensure that I am ignoring any existing DM visual etc.
Thank you very much.
In SQL Server 2008 These seem to be quite low. Perhaps due to the lack of UI support, but more flexibility than SQL traces (more events and better filtering possibilities) is more flexible than more light weight (due to better filtering and possibility of skipping events rather than blocks)
< P> The example syntax is below. Although there are many more events, actions, predictions and output target possibilities.if existing (select * from form names. 'Test_trace') drop event session [test_trace] ON server; Add event session [test_trace] to server sqlserver.sql_statement_completed (add action (package0.callstack, sqlserver.session_id, sqlserver.sql_text), add event sqlserver.sp_statement_completed (action (package0.callstack, sqlserver.session_id, sqlserver.sql_text) ) Optional Event Session [test_trace] Server Status = Start
< / Ex>and to review the results
SELECT CONVERT (XML, event_data) ASs.fn_xe_file_target_read_file ('C: \ Temp test_trace * .xel', 'C: \ Temp \ Test_trace * .xem ', NULL, NULL)
Comments
Post a Comment