<?xml version="1.0" encoding="UTF-8"?><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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sys.traces &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/sys-traces/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Mon, 24 Jun 2019 19:35:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: How to find a time when was SQL Server Restarted</title>
		<link>https://www.dbrnd.com/2019/05/sql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces/</link>
					<comments>https://www.dbrnd.com/2019/05/sql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces/#respond</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 20 May 2019 16:16:01 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Restart]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[sys.databases]]></category>
		<category><![CDATA[sys.dm_exec_sessions]]></category>
		<category><![CDATA[sys.traces]]></category>
		<category><![CDATA[sysdatabases]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4089</guid>

					<description><![CDATA[In this post, I am sharing few different scripts to find when was the SQL Server restarted. The DBAs must know about this because they have to make sure about data consistency. For example: when SQL Server restarted because of power failure, system failure, update failure or any other reason, We must check the last [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2019%2F05%2Fsql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces%2F&amp;linkname=SQL%20Server%3A%20How%20to%20find%20a%20time%20when%20was%20SQL%20Server%20Restarted" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2019%2F05%2Fsql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces%2F&amp;linkname=SQL%20Server%3A%20How%20to%20find%20a%20time%20when%20was%20SQL%20Server%20Restarted" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2019%2F05%2Fsql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces%2F&amp;linkname=SQL%20Server%3A%20How%20to%20find%20a%20time%20when%20was%20SQL%20Server%20Restarted" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2019%2F05%2Fsql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces%2F&amp;linkname=SQL%20Server%3A%20How%20to%20find%20a%20time%20when%20was%20SQL%20Server%20Restarted" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2019%2F05%2Fsql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces%2F&amp;linkname=SQL%20Server%3A%20How%20to%20find%20a%20time%20when%20was%20SQL%20Server%20Restarted" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2019%2F05%2Fsql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces%2F&amp;linkname=SQL%20Server%3A%20How%20to%20find%20a%20time%20when%20was%20SQL%20Server%20Restarted" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2019%2F05%2Fsql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces%2F&#038;title=SQL%20Server%3A%20How%20to%20find%20a%20time%20when%20was%20SQL%20Server%20Restarted" data-a2a-url="https://www.dbrnd.com/2019/05/sql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces/" data-a2a-title="SQL Server: How to find a time when was SQL Server Restarted"></a></p><p>In this post, I am sharing few different scripts to find when was the SQL Server restarted.</p>
<blockquote><p>The DBAs must know about this because they have to make sure about data consistency.
</p></blockquote>
<blockquote><p>For example: when SQL Server restarted because of power failure, system failure, update failure or any other reason, We must check the last restarted time of SQL Server. Because from that time, we have to restore data from our backup disks to the actual disk.</p></blockquote>
<blockquote><p>When SQL Server restarted, few transactions also rollback. We have to also identify these transactions by knowing the correct time when SQL Server actually restarted.
</p></blockquote>
<p><strong>Using sys.dm_exec_sessions:</strong></p>
<pre class="crayon-plain-tag">SELECT login_time FROM sys.dm_exec_sessions WHERE session_id = 1
GO</pre> </p>
<p><strong>Using sys.dm_os_sys_info:</strong></p>
<pre class="crayon-plain-tag">SELECT sqlserver_start_time FROM sys.dm_os_sys_info
GO</pre> </p>
<p><strong>Using sys.databases:</strong></p>
<pre class="crayon-plain-tag">SELECT create_date FROM sys.databases WHERE name = 'tempdb' 
GO</pre> </p>
<p><strong>Using sys.traces:</strong></p>
<pre class="crayon-plain-tag">SELECT start_time FROM sys.traces WHERE is_default = 1  
GO</pre> </p>
<p><strong>Using sysdatabases: </strong></p>
<pre class="crayon-plain-tag">SELECT crdate FROM sysdatabases WHERE name='tempdb'  
GO</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2019/05/sql-server-how-to-find-a-time-when-was-sql-server-restarted-dm_exec_sessions-dm_os_sys_info-traces/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Script to find the status of Trace is running or not</title>
		<link>https://www.dbrnd.com/2016/03/sql-server-script-to-find-the-status-of-trace-is-running-or-not/</link>
					<comments>https://www.dbrnd.com/2016/03/sql-server-script-to-find-the-status-of-trace-is-running-or-not/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 18 Mar 2016 19:13:24 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[default trace]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[sys.traces]]></category>
		<category><![CDATA[Trace]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1945</guid>

					<description><![CDATA[In this post, I am sharing a TSQL script to find the status of SQL Server Trace. The SQL Server Trace is very important for tracing the different SQL Server events like errors, object changes information and others. Using this script you can find different information of the Trace like Trace is running or not, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fsql-server-script-to-find-the-status-of-trace-is-running-or-not%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20the%20status%20of%20Trace%20is%20running%20or%20not" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fsql-server-script-to-find-the-status-of-trace-is-running-or-not%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20the%20status%20of%20Trace%20is%20running%20or%20not" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fsql-server-script-to-find-the-status-of-trace-is-running-or-not%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20the%20status%20of%20Trace%20is%20running%20or%20not" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fsql-server-script-to-find-the-status-of-trace-is-running-or-not%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20the%20status%20of%20Trace%20is%20running%20or%20not" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fsql-server-script-to-find-the-status-of-trace-is-running-or-not%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20the%20status%20of%20Trace%20is%20running%20or%20not" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fsql-server-script-to-find-the-status-of-trace-is-running-or-not%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20the%20status%20of%20Trace%20is%20running%20or%20not" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F03%2Fsql-server-script-to-find-the-status-of-trace-is-running-or-not%2F&#038;title=SQL%20Server%3A%20Script%20to%20find%20the%20status%20of%20Trace%20is%20running%20or%20not" data-a2a-url="https://www.dbrnd.com/2016/03/sql-server-script-to-find-the-status-of-trace-is-running-or-not/" data-a2a-title="SQL Server: Script to find the status of Trace is running or not"></a></p><p>In this post, I am sharing a TSQL script to find the status of SQL Server Trace. </p>
<p>The SQL Server Trace is very important for tracing the different SQL Server events like errors, object changes information and others. </p>
<p>Using this script you can find different information of the Trace like Trace is running or not, Type of the trace, File path of the trace. </p>
<p><a href="https://www.dbrnd.com/2015/05/script-to-enable-and-disable-default-trace-sql-server/" target="_blank"><strong>You can also visit this article to enable and disable SQL Server Default Trace. </strong></a></p>
<p>I am fetching require trace column using an sys.traces. </p>
<p><strong>Below is a script:</strong></p>
<pre class="crayon-plain-tag">SELECT 
	CASE T.is_default
		WHEN 1 THEN 'Default/System Trace'
		WHEN 0 THEN 'User Defined Trace'
	END AS TraceType
	,CASE T.status
		WHEN 1 THEN 'Running'
		WHEN 0 THEN 'Stopped'
	END AS TraceStrace
	,ES.session_id AS SessionID
	,ES.login_name AS LoginName
	,T.Path AS TraceFilePath
FROM sys.traces AS T
LEFT JOIN sys.dm_exec_sessions AS ES
	ON T.reader_spid = ES.session_id</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/03/sql-server-script-to-find-the-status-of-trace-is-running-or-not/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
