<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>fn_trace_gettable &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/fn_trace_gettable/</link>
	<description>Feed of posts on WordPress.com tagged "fn_trace_gettable"</description>
	<pubDate>Thu, 23 May 2013 19:06:29 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[How to find the log file usage for a transaction in SQL Server 2005?]]></title>
<link>http://sqlcan.wordpress.com/2012/03/30/how-to-find-the-log-file-usage-in-sql-server-2005/</link>
<pubDate>Fri, 30 Mar 2012 20:42:54 +0000</pubDate>
<dc:creator>Mohit</dc:creator>
<guid>http://sqlcan.wordpress.com/2012/03/30/how-to-find-the-log-file-usage-in-sql-server-2005/</guid>
<description><![CDATA[Word of caution before you try/read this: I am using undocumented function to read the trace file. ]]></description>
<content:encoded><![CDATA[Word of caution before you try/read this: I am using undocumented function to read the trace file. ]]></content:encoded>
</item>
<item>
<title><![CDATA[Loading Trace File Into SQL Server]]></title>
<link>http://mrsql.wordpress.com/2011/03/15/loading-trace-file-into-sql-server/</link>
<pubDate>Tue, 15 Mar 2011 13:52:29 +0000</pubDate>
<dc:creator>mrsql</dc:creator>
<guid>http://mrsql.wordpress.com/2011/03/15/loading-trace-file-into-sql-server/</guid>
<description><![CDATA[When running a trace in SQL Server Profiler, it is bad practice to save the trace information direct]]></description>
<content:encoded><![CDATA[<p>When running a trace in SQL Server Profiler, it is bad practice to save the trace information directly into a SQL Server table. Writing trace data directly to a table uses a lot or resources  and this can greatly errode server performance. However, it is possible to load the contents of a file once a trace has been captured. </p>
<p>Find the path of any existing traces by executing the following:-</p>
<pre class="brush: sql; title: ; notranslate" title="">
select path 
from sys.traces
</pre>
<p>Once the path and file name are known, run the following SQL:-</p>
<pre class="brush: sql; title: ; notranslate" title="">
-- Load contents of trace into a SQL temporary table
-- Do not specify log numbers to load all log files for a trace
SELECT * INTO ##temp_trc
FROM fn_trace_gettable('C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log.trc', default);

SELECT * FROM ##temp_trc
</pre>
<p>The above example loads all trace files like log%.trc [<em>log1.trc</em>, <em>log2.trc</em> etc] into a temporary table. You can of course load into a physically stored table by removing the hashes. If you want to load data from just one trace file from a group of rolled over trace files then specify the number on the end [e.g. C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log7.trc].</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Querying SQL Server Default Trace Files]]></title>
<link>http://mrsql.wordpress.com/2011/01/31/querying-sql-server-default-trace-files/</link>
<pubDate>Mon, 31 Jan 2011 11:46:31 +0000</pubDate>
<dc:creator>mrsql</dc:creator>
<guid>http://mrsql.wordpress.com/2011/01/31/querying-sql-server-default-trace-files/</guid>
<description><![CDATA[SQL Server Profiler is a useful tool for troubleshooting and monitoring database and server performa]]></description>
<content:encoded><![CDATA[<p>SQL Server Profiler is a useful tool for troubleshooting and monitoring database and server performance. Usually, a DBA has to manually setup a trace to monitor a specific area of interest (e.g. Deadlocks, Login audit). However, many are unaware that a default Profiler trace is permanently running on the majority of servers. It is possible to query the trace files from within SQL Server. The default trace captures information such as file growth, mirroring status, object creation/deletion/alteration and security auditing, amongst other items. If you decide that this is not valuable information then you can switch off the default trace. </p>
<p>To check to see whether a default trace is indeed currently running, execute the following:-</p>
<pre class="brush: sql; title: ; notranslate" title="">
SELECT * 
FROM sys.configurations 
WHERE configuration_id = 1568
</pre>
<p>If the value is &#8217;1&#8242; then the trace is running. Once you have established that the trace is enabled, you need to run a query to determine the most recent trace file. Trace files automatically rollover, so you need to know which one to query. </p>
<pre class="brush: sql; title: ; notranslate" title="">
SELECT traceid, value 
FROM [fn_trace_getinfo](default) 
WHERE [property] = 2;
</pre>
<p>The full path and file name will be returned. You can then run the following query and include the correct path to the most recent file. You could of course setup a variable to automatically populate the path.</p>
<pre class="brush: sql; title: ; notranslate" title="">
SELECT *  
FROM [fn_trace_gettable]('C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log_49.trc', DEFAULT) 
ORDER BY StartTime;
</pre>
<p>You can disable the trace by issuing the following commands. However, don&#8217;t expect a dramatic increase in server performance as the trace uses only minimal resources.</p>
<pre class="brush: sql; pad-line-numbers: false; title: ; notranslate" title="">
EXEC master.dbo.sp_configure 'allow updates', 1;
GO 
EXEC master.dbo.sp_configure 'show advanced options', 1;
GO 
EXEC master.dbo.sp_configure 'default trace enabled', 0;
GO
RECONFIGURE WITH OVERRIDE;
GO
EXEC master.dbo.sp_configure 'show advanced options', 0;
GO
EXEC master.dbo.sp_configure 'allow updates', 0;
GO
</pre>
]]></content:encoded>
</item>
<item>
<title><![CDATA[SQL Profiler]]></title>
<link>http://sqldbpool.com/2011/01/19/sql-profiler/</link>
<pubDate>Wed, 19 Jan 2011 06:12:28 +0000</pubDate>
<dc:creator>Jugal Shah</dc:creator>
<guid>http://sqldbpool.com/2011/01/19/sql-profiler/</guid>
<description><![CDATA[SQL Server Profiler is a graphical tool that helps in the monitoring of an instance of SQL Server Da]]></description>
<content:encoded><![CDATA[<p><strong>SQL Server Profiler </strong>is a graphical tool that helps in the monitoring of an instance of SQL Server Database Engine or Analysis Services. SQL Profiler is a tool which monitors the events and activity running on a SQL Server instance. The results can be saved to a file or inside a SQL Server table. We can replay this saved trace.  Profiler is mostly used in stress testing a server, analyzing performance, debugging TSQ statements, and auditing SQL Server activity.</p>
<p><em>See below image to see how to open SQL Profiler</em><br />
<a href="http://sqldbpool.files.wordpress.com/2011/01/howtoopen.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/01/howtoopen.jpg?w=614&#038;h=421" alt="" title="HowtoOpen" width="614" height="421" class="aligncenter size-full wp-image-995" /></a></p>
<p>See below list for the Key terms associated with profiler.</p>
<p><strong>Event</strong> is an action that is generated within an instance of a SQL Server Database Engine. These could be login failure, connection failure or any disconnection. It will include events such as T-SQL statements, remote procedure call batch status, the start or end of a stored procedure, the start or end of statements within a stored procedure and so on.. These are displayed in the trace in a single row intersected by data columns with descriptive details. </p>
<p><strong>Event Class</strong> is an event that can be traced and contains all of the data that can be reported by the event. For example SQL: Batch completed for instance is an event class</p>
<p><strong>Event Category</strong> defines the methodology used for grouping events within the SQL Server Profiler. For instance lock events will be categorized under Lock event category. </p>
<p><strong>Data Column</strong> is an attribute of an event class that is captured in the trace. </p>
<p><strong>Template</strong> is the default configuration for a trace. It includes the event classes that are required for monitoring.</p>
<p><strong>Trace</strong> captures data based on selected event classes, data columns and filters. </p>
<p><strong>Filter</strong> Data can be filtered by specifying criteria of selection during the execution of an event. This feature is used to reduce the size of the Trace.</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/01/profiler.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/01/profiler.jpg?w=614&#038;h=388" alt="" title="profiler" width="614" height="388" class="aligncenter size-full wp-image-997" /></a></p>
<p><strong>Event Selection Tab</strong><br />
<a href="http://sqldbpool.files.wordpress.com/2011/01/profiler1.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/01/profiler1.jpg?w=614&#038;h=387" alt="" title="profiler" width="614" height="387" class="aligncenter size-full wp-image-998" /></a></p>
<p>You can use <strong>fn_trace_gettable</strong> function to read the trace file.<br />
<a href="http://sqldbpool.files.wordpress.com/2011/01/howtoopen1.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/01/howtoopen1.jpg?w=587&#038;h=262" alt="" title="HowtoOpen" width="587" height="262" class="aligncenter size-full wp-image-999" /></a></p>
		<div id="geo-post-994" class="geo geo-post" style="display: none">
			<span class="latitude">18.520469</span>
			<span class="longitude">73.856621</span>
		</div>]]></content:encoded>
</item>

</channel>
</rss>
