|
|
|
SSCertifiable
       
Group: Moderators
Last Login: Thursday, May 09, 2013 12:38 PM
Points: 6,462,
Visits: 1,384
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, May 04, 2010 9:59 AM
Points: 137,
Visits: 14
|
|
From my experience; is'nt it optimal to send the results to a file, then save it to a SQL table? Seems profiler writes faster to a file than a table. -JG
-JG
|
|
|
|
|
SSCertifiable
       
Group: Moderators
Last Login: Thursday, May 09, 2013 12:38 PM
Points: 6,462,
Visits: 1,384
|
|
Maybe! Havent timed honestly, though you have to figure if you have indexes on the table that might add to a bit more time than just appending to the end of a text file (basically anyway). Whether the load/time matters depends on the volume, hardware, what you're logging etc. I just think it would be nice to log directly to a table - after all, SQL is ALL about tables. Especially for a quick perf tune type scenario it would be handy.
More importantly, I'd like to have the option. Stick warning labels on it if you must, but why not let us do it?
Of course once you know the deal its not bad, so the intent here was to maybe save someone new to Profiler a few minutes of head scratching...and let me air my complaint too!
Thanks for reading the article and taking time to comment.
Andy
Andy SQLShare - Learn One New Thing Each Day SQLAndy - My Professional Blog Connect with me on LinkedIn Follow me on Twitter
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 12:17 AM
Points: 174,
Visits: 95
|
|
Hi Andy, It is today I read this article. I am having a problem with fn_trace_gettable. I have created my trace through sp_trace_create with option 2. Error is : Server: Msg 567, Level 16, State 2, Line 1 File 'E:\Traces\monitor.trc' either does not exist or is not a recognizable trace file. Or there was an error opening the file.
I surfed on various sites and found in microsoft that says this is known bug in SQL Server. Did you get this error? Or you know how to overcome this. I can read this if I stop the server and restart. Untill restart, file size remain 0.
Please reply soon on this 'cause I have to create the trace through SPs.
Dinesh
MCP MCSE MCSD MCDBA
|
|
|
|
|
SSCertifiable
       
Group: Moderators
Last Login: Thursday, May 09, 2013 12:38 PM
Points: 6,462,
Visits: 1,384
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 12:17 AM
Points: 174,
Visits: 95
|
|
Ok. What I want is : create a trace using sp_trace_create with option 2. That's what I have done. But I cannot read the tracefile untill I stop and restart the server. I am getting an error when I call fn_trace_gettable function. <b> SELECT * FROM :: fn_trace_gettable (N'E:\Traces\monitor.trc', 1)
Output: Server: Msg 567, Level 16, State 2, Line 1 File 'E:\Traces\monitor.trc' either does not exist or is not a recognizable trace file. Or there was an error opening the file.[/b]
As per microsoft site http://support.microsoft.com/support/kb/articles/q273/9/72.asp , This is bug. And they have given a workaround but no luck.
I highly appreciate if you can help me on this.
Dinesh
MCP MCSE MCSD MCDBA
|
|
|
|
|
SSCertifiable
       
Group: Moderators
Last Login: Thursday, May 09, 2013 12:38 PM
Points: 6,462,
Visits: 1,384
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 12:17 AM
Points: 174,
Visits: 95
|
|
This is what I did. creation and starting: ------------------------------------------
declare @rc int declare @TraceID int declare @maxfilesize bigint set @maxfilesize = 5
exec @rc = sp_trace_create @TraceID output, 2, N'E:\Traces\monitor', @maxfilesize, NULL
declare @on bit set @on = 1 exec sp_trace_setevent @TraceID, 54, 1, @on exec sp_trace_setevent @TraceID, 54, 3, @on exec sp_trace_setevent @TraceID, 54, 6, @on exec sp_trace_setevent @TraceID, 54, 9, @on exec sp_trace_setevent @TraceID, 54, 10, @on exec sp_trace_setevent @TraceID, 54, 11, @on exec sp_trace_setevent @TraceID, 54, 12, @on exec sp_trace_setevent @TraceID, 54, 13, @on exec sp_trace_setevent @TraceID, 54, 14, @on exec sp_trace_setevent @TraceID, 54, 16, @on exec sp_trace_setevent @TraceID, 54, 17, @on exec sp_trace_setevent @TraceID, 54, 18, @on
declare @intfilter int declare @bigintfilter bigint
set @intfilter = 8 exec sp_trace_setfilter @TraceID, 3, 1, 0, @intfilter
exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler'
exec sp_trace_setstatus @TraceID, 1 ---------------------------------------
Did some transactions and tried to load data with function:
select * from :: fn_trace_gettable( N'E:\Traces\monitor.trc',default)
output: error, what I mentioned. ---------------------------------------- check the file but size is still o KB.
---------------------------------- stopped the SQL Server: check the file, now the size is 128KB. ----------------------------------- restarted the SQL Server: run the function again: got the result.
What's wrong with code?
MCP MCSE MCSD MCDBA
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 9:51 PM
Points: 4,591,
Visits: 320
|
|
Dinesh,
Is your problem possibly that you're trying to read the trace file while it's still open and Profiler is writing to it? My understanding is that you can only read it if a) the trace is stopped, or b) if the rollover threshold has been reached and the trace has closed the file and started a new one.
Rather than stopping SQL Server, I usually use a time threshold and/or a max file size threshold (with no rollover) or sp_trace_setstatus to stop non-interactive traces.
Edited by - mccork on 07/26/2003 4:34:58 PM
Cheers, - Mark
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 6:25 AM
Points: 6,861,
Visits: 8,045
|
|
|
|
|