<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>SQL RNNRSQL RNNR</title>
	
	<link>http://jasonbrimhall.info</link>
	<description>1 DBA's Professional Blog</description>
	<lastBuildDate>Tue, 14 May 2013 18:08:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SqlRnnr" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="sqlrnnr" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>T-SQLTuesday #42! The Long and Winding Road</title>
		<link>http://jasonbrimhall.info/2013/05/14/t-sqltuesday-42-the-long-and-winding-road/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=t-sqltuesday-42-the-long-and-winding-road</link>
		<comments>http://jasonbrimhall.info/2013/05/14/t-sqltuesday-42-the-long-and-winding-road/#comments</comments>
		<pubDate>Tue, 14 May 2013 18:05:28 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[TSQL Tuesday]]></category>
		<category><![CDATA[SQLFamily]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=2044</guid>
		<description><![CDATA[&#160; &#160; &#160; The Long and Winding Road It is time for another installment in the monthly blog party for SQL Server professionals known as TSQL Tuesday. This month we have the pleasure of being hosted by Wendy Pastrick (blog &#124; twitter).  The topic for the month requires a bit of introspection (almost like the[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/"     class="crp_title">Las Vegas February 2013 UG</a></li><li><a href="http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/"     class="crp_title">March 2013 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/01/02/t-sql-tuesday-38-standing-firm/"     class="crp_title">T-SQL Tuesday #38 &#8211; Standing Firm</a></li><li><a href="http://jasonbrimhall.info/2012/03/13/t-sql-tuesday-028-%e2%80%93-jack-of-all-trades-master-of-none/"     class="crp_title">T-SQL Tuesday #028 – Jack of All Trades, Master of None?</a></li><li><a href="http://jasonbrimhall.info/2013/04/16/mcm-road-less-traveled/"     class="crp_title">MCM Road Less Traveled</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3><a href="http://wendyverse.blogspot.com/2013/05/its-time-for-t-sqltuesday-42-long-and.html"><img class="size-full wp-image-1954 alignright" alt="TSQL2sDay150x150" src="http://jasonbrimhall.info/wp-content/uploads/2013/01/TSQL2sDay150x1501.jpg" width="150" height="150" /></a>The Long and Winding Road</h3>
<p>It is time for another installment in the monthly blog party for SQL Server professionals known as TSQL Tuesday.</p>
<p>This month we have the pleasure of being hosted by Wendy Pastrick (<a href="http://wendyverse.blogspot.com/">blog </a>| <a href="https://twitter.com/wendy_dance">twitter</a>).  The topic for the month requires a bit of introspection (almost like the self-evaluation piece of an annual review).  Quoting direct from her <a href="http://wendyverse.blogspot.com/2013/05/its-time-for-t-sqltuesday-42-long-and.html">blog</a>, here is the gist of the topic:</p>
<blockquote><p>Here&#8217;s what I thought it would be fun to share with the community this time around &#8211; we all experience change in our work lives. Maybe you have a new job, or a new role at your company. Maybe you&#8217;re just getting started and you have a road map to success in mind. Whatever it is, please share it next week, Tuesday May 14th. Make sure you note what technologies you find are key to your interests or successes, and maybe you will inspire someone to look down a road less traveled.</p></blockquote>
<p style="text-align: left;"><a href="http://jasonbrimhall.info/wp-content/uploads/2013/05/longuphillbw2.png"><img class="aligncenter  wp-image-2045" alt="longuphillbw2" src="http://jasonbrimhall.info/wp-content/uploads/2013/05/longuphillbw2.png" width="541" height="546" /></a>For me, this is an interesting topic.  It was my theme of choice last month with a major announcement (see <a href="http://jasonbrimhall.info/2013/04/16/mcm-road-less-traveled/">here</a>).  And because of that, I am even using the same image &#8211; slightly changed.  Only this time, I will go back a bit further into my career and the road I traveled to get to today.</p>
<p>I am going to go back to a decision point in my career that had a huge impact on where I am now.  That decision point was shortly after having moved to Las Vegas about four years ago.  After having moved to Las Vegas, I made the decision to become more active in the SQL Community.  The first step was to regularly attend the user group meetings.</p>
<p>Prior to moving to Las Vegas, I was a member of PASS.  I had been to SUMMIT.  I knew of the local user group meetings in the Salt Lake City area.  I just never forced the issue due to timing etc.  This was something that I felt needed to change.</p>
<p>By making that conscientious decision, I became more involved in the online community. I soon started presenting.  And before long, I was involved in the scheduling of speakers for the Las Vegas UG.</p>
<p>By becoming more active in the community, my skillset started to rapidly grow.  I found myself blogging more and researching more about SQL Server.  I really started to learn about SQL thanks to that decision.  Prior, I feel I was good.  Now, I feel I am much better because I invested more time and effort and I am trying to share the skills that I have learned.</p>
<p>I have said it before and it is worth saying again.  If you really want to learn a technology, try teaching it to somebody.  By taking on that extra step, you will find yourself researching a bit more and you will find that you may have to answer questions about it that you had never considered until you tried to teach it.  Being active in the community has helped me to become better at my trade.  I am sure it will help others as well.</p>
<p>&nbsp;</p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=2044" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/"     class="crp_title">Las Vegas February 2013 UG</a></li><li><a href="http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/"     class="crp_title">March 2013 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/01/02/t-sql-tuesday-38-standing-firm/"     class="crp_title">T-SQL Tuesday #38 &#8211; Standing Firm</a></li><li><a href="http://jasonbrimhall.info/2012/03/13/t-sql-tuesday-028-%e2%80%93-jack-of-all-trades-master-of-none/"     class="crp_title">T-SQL Tuesday #028 – Jack of All Trades, Master of None?</a></li><li><a href="http://jasonbrimhall.info/2013/04/16/mcm-road-less-traveled/"     class="crp_title">MCM Road Less Traveled</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=A7Xyovu3yKs:DKWBLJ2NVqQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=A7Xyovu3yKs:DKWBLJ2NVqQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=A7Xyovu3yKs:DKWBLJ2NVqQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=A7Xyovu3yKs:DKWBLJ2NVqQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=A7Xyovu3yKs:DKWBLJ2NVqQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=A7Xyovu3yKs:DKWBLJ2NVqQ:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=A7Xyovu3yKs:DKWBLJ2NVqQ:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=A7Xyovu3yKs:DKWBLJ2NVqQ:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=A7Xyovu3yKs:DKWBLJ2NVqQ:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/A7Xyovu3yKs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/05/14/t-sqltuesday-42-the-long-and-winding-road/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>May 2013 Las Vegas UG</title>
		<link>http://jasonbrimhall.info/2013/05/14/may-2013-las-vegas-ug/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=may-2013-las-vegas-ug</link>
		<comments>http://jasonbrimhall.info/2013/05/14/may-2013-las-vegas-ug/#comments</comments>
		<pubDate>Tue, 14 May 2013 16:30:59 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[SSSOLV]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[SQLFamily]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=2039</guid>
		<description><![CDATA[Spring is in the air, I think. With that scent in the air, we have a nice juicy topic coming up this month for any and all that are interested. Chad Crawford will be presenting to the group on the tastiness that is Service Broker. Service Broker in Action SQL Server Service Broker is a[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/"     class="crp_title">March 2013 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/"     class="crp_title">Las Vegas April 2013 UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/01/09/january-s3olv-2013/"     class="crp_title">January S3OLV 2013</a></li><li><a href="http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/"     class="crp_title">Las Vegas February 2013 UG</a></li><li><a href="http://jasonbrimhall.info/2012/07/30/august-2012-s3olv-meeting/"     class="crp_title">August 2012 S3OLV Meeting</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p>Spring is in the air, I think.</p>
<p><a href="http://jasonbrimhall.info/wp-content/uploads/2013/05/bbq.png"><img class="aligncenter size-full wp-image-2040" alt="bbq" src="http://jasonbrimhall.info/wp-content/uploads/2013/05/bbq.png" width="435" height="267" /></a>With that scent in the air, we have a nice juicy topic coming up this month for any and all that are interested.</p>
<p>Chad Crawford will be presenting to the group on the tastiness that is Service Broker.</p>
<h3>Service Broker in Action</h3>
<p>SQL Server Service Broker is a messaging framework built into the SQL Server engine. It enables SQL Server to handle messaging between servers and applications with light setup and overhead. The flexibility of the framework enables Service Broker to queue event notifications, task execution requests or other messages while leveraging the strength of SQL Server transaction management, reliability and recoverability. In this session we will see how to set up Service Broker, discuss case studies where it has been implemented in industry, and step through a practical example implementing an audit log.</p>
<p><strong>Session Level:</strong> Intermediate</p>
<h3>Chad Crawford&#8217;s BIO</h3>
<p>Chad has been working with database engines for 14 years, the last 12 focused specifically on SQL Server. He has filled a variety of roles spanning architecture, development and administration. Chad is currently the Database Architect at Henry Schein Practice Solutions in American Fork. When he isn’t optimizing a query, you will find him running, dreaming about airplanes, or looking for a new strategy board game.</p>
<h3>Meeting Details</h3>
<p><strong>Attendee URL</strong>: <a href="https://www.livemeeting.com/cc/UserGroups/join?id=KWRMQ3&amp;role=attend" target="_blank" rel="nofollow">https://www.livemeeting.com/cc/UserGroups/join?id=KWRMQ3&amp;role=attend</a></p>
<p><strong>Meeting ID</strong>: KWRMQ3</p>
<p>&nbsp;</p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=2039" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/"     class="crp_title">March 2013 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/"     class="crp_title">Las Vegas April 2013 UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/01/09/january-s3olv-2013/"     class="crp_title">January S3OLV 2013</a></li><li><a href="http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/"     class="crp_title">Las Vegas February 2013 UG</a></li><li><a href="http://jasonbrimhall.info/2012/07/30/august-2012-s3olv-meeting/"     class="crp_title">August 2012 S3OLV Meeting</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=7dqOtoWhoTM:8420fGxXWuU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=7dqOtoWhoTM:8420fGxXWuU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=7dqOtoWhoTM:8420fGxXWuU:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=7dqOtoWhoTM:8420fGxXWuU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=7dqOtoWhoTM:8420fGxXWuU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=7dqOtoWhoTM:8420fGxXWuU:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=7dqOtoWhoTM:8420fGxXWuU:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=7dqOtoWhoTM:8420fGxXWuU:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=7dqOtoWhoTM:8420fGxXWuU:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/7dqOtoWhoTM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/05/14/may-2013-las-vegas-ug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lost that Single-User Connection?</title>
		<link>http://jasonbrimhall.info/2013/05/06/lost-that-single-user-connection/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=lost-that-single-user-connection</link>
		<comments>http://jasonbrimhall.info/2013/05/06/lost-that-single-user-connection/#comments</comments>
		<pubDate>Mon, 06 May 2013 12:00:44 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[Corner]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[SQL Script]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=2032</guid>
		<description><![CDATA[You have changed your database to single_user mode to do a task.  As you go about your business, you lose track of which connection was the single_user connection.  You start closing connections and mistakenly close the session that was your single_user connection.  Now you are unable to start a new single_user session.  It would seem[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2011/09/20/stored-procedures-common-security-practice/"     class="crp_title">Stored Procedures &#8211; Common Security Practice</a></li><li><a href="http://jasonbrimhall.info/2012/06/04/database-in-recovery/"     class="crp_title">Database In Recovery</a></li><li><a href="http://jasonbrimhall.info/2011/05/23/cte-recursion-and-math/"     class="crp_title">CTE, Recursion and Math</a></li><li><a href="http://jasonbrimhall.info/2012/01/30/system-base-tables/"     class="crp_title">System Base Tables</a></li><li><a href="http://jasonbrimhall.info/2011/03/23/sql-server-startup/"     class="crp_title">SQL Server Startup</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p>You have changed your database to single_user mode to do a task.  As you go about your business, you lose track of which connection was the single_user connection.  You start closing connections and mistakenly close the session that was your single_user connection.  Now you are unable to start a new single_user session.  It would seem that somebody or something has taken your connection.</p>
<p>Today, I am going to discuss some things you may do to get around this problem.</p>
<p>The first thing that may come to mind when you encounter this is &#8220;Oh crap!&#8221;  Well, no need to get too terribly worried (not unless you really hosed something up and you are trying to fix it real quick before the boss notices).</p>
<p>The next thing you may think of trying is how to circumvent the single_user mode.  And during that thought process you may be thinking that single_user does not really mean single_user so you might try something like start a DAC session.  Well, let&#8217;s go through that and see what would happen in a DAC session if your single_user session is stolen.</p>
<p>I am going to skip the part of setting a database into single_user mode because we are presuming that the condition already exists.  To start a DAC session, I am going to point you to a previous article I did on the topic &#8211; <a href="http://jasonbrimhall.info/2012/01/19/dedicated-administrator-connection/">here</a>.</p>
<p>To ensure I am using a DAC session, I am going to issue the following query.  This will ensure I am in the right session and that DAC is in use.</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> s.<span class="me1">group_id</span>,e.<span class="me1">name</span>, <span class="kw1">CAST</span><span class="br0">&#40;</span>g.<span class="me1">name</span> <span class="kw1">AS</span> <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>20<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">AS</span> ResourceGroup, s.<span class="me1">session_id</span> 
		, s.<span class="me1">login_time</span>, <span class="kw1">CAST</span><span class="br0">&#40;</span>s.<span class="kw2">HOST_NAME</span> <span class="kw1">AS</span> <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>20<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">AS</span> HostName 
		, <span class="kw1">CAST</span><span class="br0">&#40;</span>s.<span class="me1">program_name</span> <span class="kw1">AS</span> <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>20<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">AS</span> ProgramName 
		,s.<span class="me1">original_login_name</span> 
		,s.<span class="me1">is_user_process</span> 
		,s.<span class="me1">STATUS</span> 
	<span class="kw1">FROM</span> sys.<span class="me1">dm_exec_sessions</span> s 
		<span class="kw1">INNER</span> <span class="sy0">JOIN</span> sys.<span class="me1">dm_resource_governor_workload_groups</span> g 
			<span class="kw1">ON</span> g.<span class="me1">group_id</span> <span class="sy0">=</span> s.<span class="me1">group_id</span> 
		<span class="kw1">INNER</span> <span class="sy0">JOIN</span> sys.<span class="me1">dm_exec_connections</span> ec 
			<span class="kw1">ON</span> s.<span class="me1">session_id</span> <span class="sy0">=</span> ec.<span class="me1">session_id</span> 
		<span class="kw1">LEFT</span> <span class="sy0">OUTER</span> <span class="sy0">JOIN</span> sys.<span class="me1">endpoints</span> e  
			<span class="kw1">ON</span> ec.<span class="br0">&#91;</span>endpoint_id<span class="br0">&#93;</span><span class="sy0">=</span>e.<span class="br0">&#91;</span>endpoint_id<span class="br0">&#93;</span> 
<span class="kw1">WHERE</span> s.<span class="me1">session_id</span> <span class="sy0">=</span> <span class="kw2">@@SPID</span> 
<span class="kw1">ORDER</span> <span class="kw1">BY</span> g.<span class="me1">NAME</span>; 
GO</pre></div></div>
<p>In my case, this results in an endpoint with the name &#8220;Dedicated Admin Connection&#8221; and a spid of 84.  Good, I am in the correct session for the rest of this test.  Next, I will issue a Use database statement.  I have created a test database called ClinicDB.  So I will issue the following.</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">USE</span> ClinicDB;
GO</pre></div></div>
<p>I get the following result.</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;">Msg 924, <span class="kw1">LEVEL</span> 14, <span class="kw1">STATE</span> 1, Line 1
<span class="kw1">DATABASE</span> <span class="st0">'ClinicDB'</span> <span class="kw1">IS</span> already <span class="kw1">OPEN</span> and can <span class="kw1">ONLY</span> have one <span class="kw1">USER</span> <span class="kw1">AT</span> a <span class="kw1">TIME</span>.</pre></div></div>
<p>So, that blows that idea right out of the water.  It shouldn&#8217;t really have been a consideration in the first place because single_user really means just that &#8211; single_user.</p>
<h3>Now What?</h3>
<p>Well, what do you think we could do now to circumvent this little problem and get that single_user session back?</p>
<p>That requires a little investigative work.  It is time to find out who has taken the single_user session and politely ask them to give it up.  To make that task a little easier, we could modify the previous query to find out who has that single_user session (thus limiting how many people we have to ask).  I have modified the following query to use sys.sysprocesses so I could limit the results to the ClinicDB.  This is a limitation of SQL 2008 R2 and older versions.  Getting the database reliably means using sysprocesses.  Despite the database_id being available in other related DMVs, it&#8217;s just not that easy.  One would think you could use sys.dm_exec_requests.  But if a request is not active, an entry won&#8217;t exist for that session.  This problem is fixed in SQL 2012 since the sys.dm_exec_connections DMV now has the database_id field.  Enough of that birdwalk and on to the query.</p>
<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> s.<span class="me1">group_id</span>,e.<span class="me1">name</span>, <span class="kw1">CAST</span><span class="br0">&#40;</span>g.<span class="me1">name</span> <span class="kw1">AS</span> <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>20<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">AS</span> ResourceGroup, s.<span class="me1">session_id</span> ,<span class="kw2">DB_NAME</span><span class="br0">&#40;</span>r.<span class="me1">dbid</span><span class="br0">&#41;</span> <span class="kw1">AS</span> DBName
		, s.<span class="me1">login_time</span>, <span class="kw1">CAST</span><span class="br0">&#40;</span>s.<span class="kw2">HOST_NAME</span> <span class="kw1">AS</span> <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>20<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">AS</span> HostName
		, <span class="kw1">CAST</span><span class="br0">&#40;</span>s.<span class="me1">program_name</span> <span class="kw1">AS</span> <span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>20<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">AS</span> ProgramName 
		,s.<span class="me1">original_login_name</span> 
		,s.<span class="me1">is_user_process</span> 
		,s.<span class="me1">STATUS</span> 
	<span class="kw1">FROM</span> sys.<span class="me1">dm_exec_sessions</span> s 
		<span class="kw1">INNER</span> <span class="sy0">JOIN</span> sys.<span class="me1">dm_resource_governor_workload_groups</span> g 
			<span class="kw1">ON</span> g.<span class="me1">group_id</span> <span class="sy0">=</span> s.<span class="me1">group_id</span> 
		<span class="kw1">INNER</span> <span class="sy0">JOIN</span> sys.<span class="me1">dm_exec_connections</span> ec 
			<span class="kw1">ON</span> s.<span class="me1">session_id</span> <span class="sy0">=</span> ec.<span class="me1">session_id</span> 
		<span class="kw1">INNER</span> <span class="sy0">JOIN</span> sys.<span class="me1">sysprocesses</span> r
			<span class="kw1">ON</span> r.<span class="me1">spid</span> <span class="sy0">=</span> s.<span class="me1">session_id</span>
		<span class="kw1">LEFT</span> <span class="sy0">OUTER</span> <span class="sy0">JOIN</span> sys.<span class="me1">endpoints</span> e  
			<span class="kw1">ON</span> ec.<span class="br0">&#91;</span>endpoint_id<span class="br0">&#93;</span><span class="sy0">=</span>e.<span class="br0">&#91;</span>endpoint_id<span class="br0">&#93;</span>
	<span class="kw1">WHERE</span> <span class="kw2">DB_NAME</span><span class="br0">&#40;</span>r.<span class="me1">dbid</span><span class="br0">&#41;</span> <span class="sy0">=</span> <span class="st0">'ClinicDB'</span>
<span class="kw1">ORDER</span> <span class="kw1">BY</span> g.<span class="me1">NAME</span>; 
GO</pre></div></div>
<p>I chose not to do an entirely new query to simply demonstrate that it was possible with a very small tweak to what has been already used.</p>
<p>Now that you know (in my case I can see that I have a session open with ID = 80 that is connected to that single_user database), I can walk over to the person (knowing his/her login id and computer name) and politely ask them to disconnect.</p>
<p>In the end, this is really an easy thing to resolve.  Sure it may take some people skills &#8211; but that doesn&#8217;t make the task too terribly difficult.  Next time this happens to you, just remember you can run a quick query to find who has sniped that single_user session.</p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=2032" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2011/09/20/stored-procedures-common-security-practice/"     class="crp_title">Stored Procedures &#8211; Common Security Practice</a></li><li><a href="http://jasonbrimhall.info/2012/06/04/database-in-recovery/"     class="crp_title">Database In Recovery</a></li><li><a href="http://jasonbrimhall.info/2011/05/23/cte-recursion-and-math/"     class="crp_title">CTE, Recursion and Math</a></li><li><a href="http://jasonbrimhall.info/2012/01/30/system-base-tables/"     class="crp_title">System Base Tables</a></li><li><a href="http://jasonbrimhall.info/2011/03/23/sql-server-startup/"     class="crp_title">SQL Server Startup</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6tVz6_lA3OI:01uaTaiWlHg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6tVz6_lA3OI:01uaTaiWlHg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=6tVz6_lA3OI:01uaTaiWlHg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6tVz6_lA3OI:01uaTaiWlHg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=6tVz6_lA3OI:01uaTaiWlHg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6tVz6_lA3OI:01uaTaiWlHg:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6tVz6_lA3OI:01uaTaiWlHg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6tVz6_lA3OI:01uaTaiWlHg:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=6tVz6_lA3OI:01uaTaiWlHg:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/6tVz6_lA3OI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/05/06/lost-that-single-user-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MCM Road Less Traveled</title>
		<link>http://jasonbrimhall.info/2013/04/16/mcm-road-less-traveled/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=mcm-road-less-traveled</link>
		<comments>http://jasonbrimhall.info/2013/04/16/mcm-road-less-traveled/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 12:00:26 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[Corner]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[Certification]]></category>
		<category><![CDATA[SQL MCM]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=1748</guid>
		<description><![CDATA[I began this post back in October of 2012 after learning that I had passed the SQL Server 2008 MCM Knowledge exam.  I had set it aside in hopes of polishing it off after my first lab attempt at Summit 2012.  Notice I said first attempt?  I failed that first attempt.  This is a bit[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2011/12/07/mcitp-4-down-0-to-go/"     class="crp_title">MCITP: 4 Down 0 To Go</a></li><li><a href="http://jasonbrimhall.info/2011/06/27/mcitp-3-down-1-to-go/"     class="crp_title">MCITP: 3 Down 1 To Go</a></li><li><a href="http://jasonbrimhall.info/2011/05/20/mcitp-1-down-3-to-go/"     class="crp_title">MCITP 1 Down 3 To Go</a></li><li><a href="http://jasonbrimhall.info/2011/05/26/mcitp-2-down-2-to-go/"     class="crp_title">MCITP: 2 Down 2 to go</a></li><li><a href="http://jasonbrimhall.info/2012/03/13/t-sql-tuesday-028-%e2%80%93-jack-of-all-trades-master-of-none/"     class="crp_title">T-SQL Tuesday #028 – Jack of All Trades, Master of None?</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p>I began this post back in October of 2012 after learning that I had passed the SQL Server 2008 MCM Knowledge exam.  I had set it aside in hopes of polishing it off after my first lab attempt at Summit 2012.  Notice I said first attempt?  I failed that first attempt.  This is a bit of a story about the journey through the exams and the results.</p>
<p style="text-align: center;"><a href="http://jasonbrimhall.info/wp-content/uploads/2013/04/longuphillbw.png"><img class="aligncenter  wp-image-2026" alt="longuphillbw" src="http://jasonbrimhall.info/wp-content/uploads/2013/04/longuphillbw.png" width="540" height="545" /></a></p>
<p>The first attempt was a little crushing.  A mix of emotions concerning the lab came over me because I felt I knew the technology.  While the results were not desirable &#8211; the end effect was desirable and I am glad I did not succeed on that first attempt.</p>
<p>When I took the knowledge exam, I took my time going through the questions and examined the questions.  I think that was a good method for that exam &#8211; I was trying to ensure I understood the question and didn&#8217;t miss anything that was stated.  Though I took it slowly, that is not an indictment to difficulty for the exam.  I was well prepared and did not want to make any invalid assumptions.</p>
<p>Fast forward a little bit to the first attempt at the lab exam.  I had a plan going into the exam.  I felt confident in my skills.  I felt relaxed with the technology.  Then the exam started and my plan went out the window.  I started making assumptions about the exam that I really should not have done.  I rushed a few scenarios that I should not have rushed because I could have done them better.  In the end, I was my own worst enemy during the exam.  This is not a characteristic of an MCM.  Even when the pressure is on, doing what you know and being methodical is a wonderful asset.</p>
<p>Having failed the first time, I wondered if I was ready to be an MCM.  In retrospect, I was not.  Leading up to the exam, I did feel that I was ready for the exam.  I had read several articles such as the following to try and figure out if I was ready.  In the end, it&#8217;s more of a gut check and a leap of faith for some.</p>
<p>Gavin Payne <a href="http://gavinpayneuk.com/2012/05/01/knowing-when-youre-ready-to-attempt-to-become-an-mcm-of-sql-server/">http://gavinpayneuk.com/2012/05/01/knowing-when-youre-ready-to-attempt-to-become-an-mcm-of-sql-server/</a></p>
<p>Joe Sack <a href="http://blogs.msdn.com/b/joesack/archive/2010/11/21/how-do-you-know-if-you-re-ready-for-sql-mcm.aspx">http://blogs.msdn.com/b/joesack/archive/2010/11/21/how-do-you-know-if-you-re-ready-for-sql-mcm.aspx</a></p>
<p>I even perused some of the resource type of articles such as the following.</p>
<p>Nick Haslam <a href="http://nhaslam.com/blog/2011/11/19/mcmprep-88-970-sql-mcm-knowledge-exam-sqlmcm/">http://nhaslam.com/blog/2011/11/19/mcmprep-88-970-sql-mcm-knowledge-exam-sqlmcm/</a></p>
<p>MCM Blog <a href="http://blogs.technet.com/b/themasterblog/archive/tags/sql+server+mcm/">http://blogs.technet.com/b/themasterblog/archive/tags/sql+server+mcm/</a></p>
<p>Robert Davis Amazon MCM Reading List <a href="http://www.amazon.com/Official-Server-Certified-Master-Readiness/lm/R3RB13PQ7D8TKB">http://www.amazon.com/Official-Server-Certified-Master-Readiness/lm/R3RB13PQ7D8TKB</a></p>
<p>Brent Ozar MCM Articles <a href="http://www.brentozar.com/sql-mcm/">http://www.brentozar.com/sql-mcm/</a></p>
<p>In the end, this post by Rob Farley sums it up nicely for me (<a href="http://sqlblog.com/blogs/rob_farley/archive/2012/12/23/the-mcm-lab-exam-two-days-later.aspx">http://sqlblog.com/blogs/rob_farley/archive/2012/12/23/the-mcm-lab-exam-two-days-later.aspx</a>).  Rob references an article by Tom LaRock and some of what Tom did and didn&#8217;t do.  As well as some theory on how to approach the exam at certain stages.  Of all those things, I think the best advice I read as well as I could recommend is to get a study buddy.</p>
<p>It&#8217;s not sooo much to have somebody to bounce ideas off of, as it is to have somebody to try and teach.  I worked with Wayne Sheffield as we prepped for our retakes.  The biggest benefit was, as I said, in that I could pick a topic and try to teach Wayne.  He did the same to me.  And then, we could question each other on what-if type questions about our selected topics.  Another benefit is to have a heat-check so to speak.  Having a study buddy can help you from straying too far off into tangents or maybe keeping you from wasting too much time on a topic they might feel you understand exceptionally well.</p>
<p>If you are reading this far, you probably have figured that I have taken the Lab a second time.  I was debating whether to do it this soon due to life and family.  My wife continued to push me to do it (much as Nic Cain experienced here - <a href="http://sirsql.net/blog/2012/3/26/achievement-unlockedmcm-sql-server-2008.html">http://sirsql.net/blog/2012/3/26/achievement-unlockedmcm-sql-server-2008.html</a>).  Without Krista pushing me, I might have delayed even longer.  It was also helpful to have a co-worker and friend pushing me along too (I&#8217;m a little competitive).  Thanks again Wayne!  You can read his experiences <a href="http://blog.waynesheffield.com/wayne/archive/2013/04/the-bucket-list-item-1-is-finally-finished">here</a>.</p>
<p>I received my notification email while driving home from Vegas last week.  Seeing that email pop up from boB Taylor gets your heart racing a little bit &#8211; especially after you have failed the lab previously.  I glanced at the email and only need to go to the first word &#8211; &#8220;CONGRATULATIONS!&#8221;</p>
<p><a style="color: #ff4500; line-height: 15.59375px;" href="http://jasonbrimhall.info/wp-content/uploads/2013/04/MCMrgb_1262.png"><img class="size-full wp-image-2025 alignleft" alt="MCM_SQL" src="http://jasonbrimhall.info/wp-content/uploads/2013/04/MCMrgb_1262.png" width="246" height="60" /></a></p>
<p>Oh yeah!  Vindication, satisfaction, elation, joy and general happiness set in quickly.  Memories of that old &#8220;<a href="http://www.youtube.com/watch?v=P2AZH4FeGsc">Wide World of Sports</a>&#8221; show from a long time ago spilled in with the words &#8220;Agony of Defeat, Thrill of Victory.&#8221;</p>
<p>I am glad I took the time to pursue this certification.  This adventure has helped me to learn and grow as a DBA.  I am also grateful to those that helped or pushed in some way or another &#8211; whether they knew it or not at the time.  Last but not least, I am thankful for my employer Ntirety.  They understood the importance of this for me and were very supportive in this endeavor.</p>
<p>As one final take away, I was recently shown this <a href="http://blogs.prodata.ie/post/So-you-think-youre-a-SQL-MCM-Part-IVe28093-waits-and-Extended-Events.aspx">link</a> with some interesting questions to help you decide if you feel you are ready to take the exams.</p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=1748" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2011/12/07/mcitp-4-down-0-to-go/"     class="crp_title">MCITP: 4 Down 0 To Go</a></li><li><a href="http://jasonbrimhall.info/2011/06/27/mcitp-3-down-1-to-go/"     class="crp_title">MCITP: 3 Down 1 To Go</a></li><li><a href="http://jasonbrimhall.info/2011/05/20/mcitp-1-down-3-to-go/"     class="crp_title">MCITP 1 Down 3 To Go</a></li><li><a href="http://jasonbrimhall.info/2011/05/26/mcitp-2-down-2-to-go/"     class="crp_title">MCITP: 2 Down 2 to go</a></li><li><a href="http://jasonbrimhall.info/2012/03/13/t-sql-tuesday-028-%e2%80%93-jack-of-all-trades-master-of-none/"     class="crp_title">T-SQL Tuesday #028 – Jack of All Trades, Master of None?</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=fcz2hkta_x0:9wlGZ5VJpBc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=fcz2hkta_x0:9wlGZ5VJpBc:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=fcz2hkta_x0:9wlGZ5VJpBc:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=fcz2hkta_x0:9wlGZ5VJpBc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=fcz2hkta_x0:9wlGZ5VJpBc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=fcz2hkta_x0:9wlGZ5VJpBc:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=fcz2hkta_x0:9wlGZ5VJpBc:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=fcz2hkta_x0:9wlGZ5VJpBc:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=fcz2hkta_x0:9wlGZ5VJpBc:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/fcz2hkta_x0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/04/16/mcm-road-less-traveled/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Las Vegas April 2013 UG Meeting</title>
		<link>http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=las-vegas-april-2013-ug-meeting</link>
		<comments>http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/#comments</comments>
		<pubDate>Wed, 10 Apr 2013 02:27:20 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[Corner]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[PASS]]></category>
		<category><![CDATA[SQLFamily]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=2020</guid>
		<description><![CDATA[AlwaysOn &#8211; Finally, A usable &#8216;mirror&#8217;! In the past, High Availability and Disaster Recovery (HADR) had many limitations. Clustering and Mirroring are great, but the mirror/secondary database is not very usable since it is not online. Finally, AlwaysOn solves this limitation by merging both multi-node Clustering and mirroring. AlwaysOn also allows the secondary database to[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2011/08/05/come-one-come-all-s3olv-august-2011/"     class="crp_title">Come One Come All S3OLV August 2011</a></li><li><a href="http://jasonbrimhall.info/2010/11/30/december-2010-s3olv-meeting/"     class="crp_title">December 2010 S3OLV Meeting</a></li><li><a href="http://jasonbrimhall.info/2010/12/08/december-2010-sssolv-reminder/"     class="crp_title">December 2010 SSSOLV Reminder</a></li><li><a href="http://jasonbrimhall.info/2011/06/09/june-s3olv-update/"     class="crp_title">June S3OLV Update</a></li><li><a href="http://jasonbrimhall.info/2011/07/06/july-2011-s3olv-meeting/"     class="crp_title">July 2011 S3OLV Meeting</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<h2><a href="http://jasonbrimhall.info/wp-content/uploads/2013/04/Invite.png"><img class="aligncenter size-full wp-image-2021" title="Invite" src="http://jasonbrimhall.info/wp-content/uploads/2013/04/Invite.png" alt="" width="514" height="328" /></a></h2>
<h2>AlwaysOn &#8211; Finally, A usable &#8216;mirror&#8217;!</h2>
<p>In the past, High Availability and Disaster Recovery (HADR) had many limitations. Clustering and Mirroring are great, but the mirror/secondary database is not very usable since it is not online. Finally, AlwaysOn solves this limitation by merging both multi-node Clustering and mirroring. AlwaysOn also allows the secondary database to remain ONLINE, so we can use it for reporting purposes without resorting to a Snapshot! Come see this lively session with extensive demos of setting up, configuring and testing AlwaysOn. We&#8217;ll also test automatic fail-over using a real web app to see how well this feature works.</p>
<p>&nbsp;</p>
<h2><strong>Jim Murphy</strong></h2>
<p><img src="https://api.twitter.com/1/users/profile_image?screen_name=@SQLMurph" alt="Speaker photo" height="90" /></p>
<p>Jim Murphy has been using Microsoft SQL Server since version 6.0 back in the 90&#8242;s. He is the President/CEO of SQLWatchmen, LLC., a managed DBA service provider for smaller companies who do not need a full-time DBA. He runs the Austin SQL Server User Group: CACTUSS Central and sits on the board of SQLPOSSE.com. He has been a professional DBA and developer for over 20 years and has run a consulting company full-time for over a decade.</p>
<p><strong style="line-height: 1.3em;">LiveMeeting Information</strong><span style="line-height: 1.3em;">:</span></p>
<p><span style="line-height: 1.3em;"><strong><em>Attendee URL</em></strong>:</span><img style="line-height: 1.3em;" src="https://www323.livemeeting.com/etc/static/WINrapid3/2012-01-27-20-26-12/images/shim.gif" alt="" width="5" height="1" /><a style="line-height: 1.3em;" href="https://www.livemeeting.com/cc/UserGroups/join?id=834ZNP&amp;role=attend">https://www.livemeeting.com/cc/UserGroups/join?id=834ZNP&amp;role=attend</a><span style="line-height: 1.3em;"> </span></p>
<p><img src="https://www323.livemeeting.com/etc/static/WINrapid3/2012-01-27-20-26-12/images/shim.gif" alt="" width="1" height="5" /><em><strong>Meeting ID</strong></em>:<img src="https://www323.livemeeting.com/etc/static/WINrapid3/2012-01-27-20-26-12/images/shim.gif" alt="" width="5" height="1" />834ZNP</p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=2020" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2011/08/05/come-one-come-all-s3olv-august-2011/"     class="crp_title">Come One Come All S3OLV August 2011</a></li><li><a href="http://jasonbrimhall.info/2010/11/30/december-2010-s3olv-meeting/"     class="crp_title">December 2010 S3OLV Meeting</a></li><li><a href="http://jasonbrimhall.info/2010/12/08/december-2010-sssolv-reminder/"     class="crp_title">December 2010 SSSOLV Reminder</a></li><li><a href="http://jasonbrimhall.info/2011/06/09/june-s3olv-update/"     class="crp_title">June S3OLV Update</a></li><li><a href="http://jasonbrimhall.info/2011/07/06/july-2011-s3olv-meeting/"     class="crp_title">July 2011 S3OLV Meeting</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=ou508WEJedQ:upVllwknjvI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=ou508WEJedQ:upVllwknjvI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=ou508WEJedQ:upVllwknjvI:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=ou508WEJedQ:upVllwknjvI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=ou508WEJedQ:upVllwknjvI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=ou508WEJedQ:upVllwknjvI:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=ou508WEJedQ:upVllwknjvI:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=ou508WEJedQ:upVllwknjvI:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=ou508WEJedQ:upVllwknjvI:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/ou508WEJedQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T-SQL Tuesday #040: File and Filegroup Wisdom</title>
		<link>http://jasonbrimhall.info/2013/03/11/t-sql-tuesday-040-file-and-filegroup-wisdom/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=t-sql-tuesday-040-file-and-filegroup-wisdom</link>
		<comments>http://jasonbrimhall.info/2013/03/11/t-sql-tuesday-040-file-and-filegroup-wisdom/#comments</comments>
		<pubDate>Tue, 12 Mar 2013 04:39:19 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[Corner]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[TSQL Tuesday]]></category>
		<category><![CDATA[FullText]]></category>
		<category><![CDATA[SQL Administration]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=2015</guid>
		<description><![CDATA[Backstory Each month the SQL community comes together for an important party.  This is the blog party that was the brain child of Adam Machanic (Twitter) known as T-SQL Tuesday. The party is a very good collaboration among data professionals on a pre-determined topic.  This month, for TSQL Tuesday #40, the topic is on Files and[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/01/08/fast-starts/"     class="crp_title">Fast Starts</a></li><li><a href="http://jasonbrimhall.info/2013/01/07/a-firm-foundation/"     class="crp_title">A Firm Foundation</a></li><li><a href="http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/"     class="crp_title">Las Vegas February 2013 UG</a></li><li><a href="http://jasonbrimhall.info/2012/12/14/on-the-second-day/"     class="crp_title">On the Second Day&#8230;</a></li><li><a href="http://jasonbrimhall.info/2013/02/11/is-your-log-backed-up/"     class="crp_title">Is your LOG backed up?</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p><a style="line-height: 1.3em;" href="http://www.midnightdba.com/Jen/2013/03/invitation-to-t-sql-tuesday-040-file-and-filegroup-wisdom/"><img class="alignright size-full wp-image-1969" title="TSQL2sDay150x150" src="http://jasonbrimhall.info/wp-content/uploads/2013/01/TSQL2sDay150x1502.jpg" alt="" width="150" height="150" /></a></p>
<h2>Backstory</h2>
<p>Each month the SQL community comes together for an important party.  This is the blog party that was the brain child of Adam Machanic (<a href="http://www.twitter.com/Adam_Machanic">Twitter</a>) known as T-SQL Tuesday.</p>
<p>The party is a very good collaboration among data professionals on a pre-determined topic.  This month, for TSQL Tuesday #40, the topic is on <a href="http://www.midnightdba.com/Jen/2013/03/invitation-to-t-sql-tuesday-040-file-and-filegroup-wisdom/">Files and Filegroups</a>.  The host du mois is Jen McCown (<a href="http://twitter.com/MidnightDBA">Twitter</a>).</p>
<p>This month, I had the luck of encountering something this past week that is right up the alley of this topic.  I love it when sysadmins help create learning opportunities for me (e.g. blog material).</p>
<h2>
Production Down</h2>
<h2><a style="color: #ff4500;" href="http://jasonbrimhall.info/wp-content/uploads/2013/03/computeranchor.png"><img class="alignleft size-full wp-image-2016" title="computeranchor" src="http://jasonbrimhall.info/wp-content/uploads/2013/03/computeranchor.png" alt="" width="256" height="294" /></a></h2>
<p>I was recently given the following concerning a client server issue:</p>
<blockquote><p>The log file for database &#8216;xxx&#8217; is full. Back up the transaction log for the database to free up some log space.</p></blockquote>
<p>That was followed by a short description stating that the sysadmin had tried to expand the log file and that they also tried to run a full backup.  The output of the full backup was as follows.</p>
<blockquote><p>BACKUP DATABASE [xxx] To Disk=&#8217;blah&#8217; WITH NOFORMAT, NOINIT, NAME = N&#8217;blah&#8217;, SKIP, REWIND, NOUNLOAD, STATS = 10<br />
&#8221; failed with the following error: &#8220;The backup of the <strong>file or filegroup &#8220;sysft_FTS&#8221; is not permitted because it is not online</strong>.<br />
BACKUP can be performed by using the FILEGROUP or FILE clauses to restrict the selection to include only online data.</p></blockquote>
<p>Now this makes things more interesting.  The sysadmin at least tried to do a full backup and then handed off when it got too deep.</p>
<p>The client server is a SQL 2005 box.  Fulltext was enabled for the database on that box. And we have seen plenty of issues related to Fulltext in SQL 2005.  Somehow, I feel that none of them really pertained to this opportunity.  From all appearances, there was either a disk issue (no history in the logs but client said there was) or somebody deleted the directory (there was a login at the time the issue started and there was a service restart at that time).  In either case, the folder for the fulltext filegroup was no longer present.  But I am getting a little ahead of myself.</p>
<p>When querying the sys.database_files catalog view, I was able to confirm the directory path that should have been in place for the filegroup and that the filegroup was indeed OFFLINE.  Results and query to follow, with filepaths redacted intentionally.</p>
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> <span class="kw2">FILE_ID</span>,type_desc,name
		,physical_name <span class="co1">--intentionally omitted in result set</span>
		,state_desc
	<span class="kw1">FROM</span> sys.<span class="me1">database_files</span>;</pre></div></div>
<table width="313" border="0" cellspacing="0" cellpadding="0">
<colgroup>
<col width="64" />
<col width="70" />
<col width="106" />
<col width="73" /> </colgroup>
<tbody>
<tr bgcolor="green">
<td width="64" height="20">file_id</td>
<td width="70">type_desc</td>
<td width="106">name</td>
<td width="73">state_desc</td>
</tr>
<tr>
<td align="right" height="20">1</td>
<td>ROWS</td>
<td>Somefile</td>
<td>ONLINE</td>
</tr>
<tr>
<td align="right" height="20">2</td>
<td>LOG</td>
<td>Somefile_log</td>
<td>ONLINE</td>
</tr>
<tr>
<td align="right" height="20">3</td>
<td>ROWS</td>
<td>Somefile_data</td>
<td>ONLINE</td>
</tr>
<tr>
<td align="right" height="20">4</td>
<td>ROWS</td>
<td>Somefile_index</td>
<td>ONLINE</td>
</tr>
<tr>
<td align="right" height="20">65537</td>
<td>FULLTEXT</td>
<td>sysft_FTS</td>
<td>OFFLINE</td>
</tr>
</tbody>
</table>
<p>So, indeed I do have a problem with the filegroup and I need to get it back online in order to resume backups and get this database back online and able to perform backups.</p>
<p>Some suggestions out there would be to rebuild the fulltext catalog in order to bring it back online.  Well, the files are no longer present on the filesystem, so this didn&#8217;t work too well.</p>
<div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">ALTER</span> FULLTEXT <span class="kw1">CATALOG</span> <span class="br0">&#91;</span>FTS<span class="br0">&#93;</span> REBUILD
<span class="coMULTI">/*
Full-text catalog 'FTS' is in an unusable state. Drop and re-create this full-text catalog.
*/</span></pre></div></div>
<p>The notes in the code block represent the outcome.  And the output makes sense if you ask me.  But when trying to drop and recreate, I ran into some more fun.</p>
<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">DROP</span> FULLTEXT <span class="kw1">CATALOG</span> <span class="br0">&#91;</span>FTS<span class="br0">&#93;</span>
<span class="co1">--or</span>
<span class="kw3">SP_FULLTEXT_DATABASE</span> @<span class="kw1">ACTION</span><span class="sy0">=</span> <span class="st0">'disable'</span>
&nbsp;
<span class="coMULTI">/*
Cannot drop full-text catalog 'FTS' because it contains a full-text index.
*/</span></pre></div></div>
<p>Once again, that makes sense.  I had hoped that it would drop everything for me.  So, time to try dropping the indexes and recreating them.  For this, I took screenshots of each index in question.  Then tried to drop them.  Once again &#8211; another error.</p>
<blockquote><p>property fulltextindexsize is not available</p></blockquote>
<p>Despite that error, the indexes were gone and the catalog dropped.  Since I had disabled FT on the database, I needed to re-enable it in order to recreate the catalog and indexes (I had scripts for the catalog and screenshots for the indexes).</p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw3">SP_FULLTEXT_DATABASE</span> @<span class="kw1">ACTION</span><span class="sy0">=</span> <span class="st0">'enable'</span></pre></div></div>
<p>Now issuing a rebuild against that catalog works as expected.  Additionally, backups work as expected.  And to confirm that all is well, query sys.database_files once again to see that the filegroup is online.</p>
<table width="313" border="0" cellspacing="0" cellpadding="0">
<colgroup>
<col width="64" />
<col width="70" />
<col width="106" />
<col width="73" /> </colgroup>
<tbody>
<tr bgcolor="green">
<td width="64" height="20">file_id</td>
<td width="70">type_desc</td>
<td width="106">name</td>
<td width="73">state_desc</td>
</tr>
<tr>
<td align="right" height="20">1</td>
<td>ROWS</td>
<td>Somefile</td>
<td>ONLINE</td>
</tr>
<tr>
<td align="right" height="20">2</td>
<td>LOG</td>
<td>Somefile_log</td>
<td>ONLINE</td>
</tr>
<tr>
<td align="right" height="20">3</td>
<td>ROWS</td>
<td>Somefile_data</td>
<td>ONLINE</td>
</tr>
<tr>
<td align="right" height="20">4</td>
<td>ROWS</td>
<td>Somefile_index</td>
<td>ONLINE</td>
</tr>
<tr>
<td align="right" height="20">65537</td>
<td>FULLTEXT</td>
<td>sysft_FTS</td>
<td>ONLINE</td>
</tr>
</tbody>
</table>
<h2>Between the Lines</h2>
<p>I breezed through what got this filegroup back online so database activity could resume.  One thing that I skipped over was a step I took trying to recover without dropping and recreating.  Since the directory was not present, and there was a full backup from the same day that had the filegroup in a working state, I tried to recover the filegroup manually.  Restore the database, copy the folder structure into the appropriate filepath and run an alter database statement.  Since it didn&#8217;t work, I am not going into deep details on it.  The short of it is that since the structure disappeared off disk, there was some corruption related to it internally in the database.  That needed fixed and in this case it meant to drop the indexes and catalog in order to recreate it.</p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=2015" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/01/08/fast-starts/"     class="crp_title">Fast Starts</a></li><li><a href="http://jasonbrimhall.info/2013/01/07/a-firm-foundation/"     class="crp_title">A Firm Foundation</a></li><li><a href="http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/"     class="crp_title">Las Vegas February 2013 UG</a></li><li><a href="http://jasonbrimhall.info/2012/12/14/on-the-second-day/"     class="crp_title">On the Second Day&#8230;</a></li><li><a href="http://jasonbrimhall.info/2013/02/11/is-your-log-backed-up/"     class="crp_title">Is your LOG backed up?</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=qe3CpUmDHqM:ZtIpk4tCcyA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=qe3CpUmDHqM:ZtIpk4tCcyA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=qe3CpUmDHqM:ZtIpk4tCcyA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=qe3CpUmDHqM:ZtIpk4tCcyA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=qe3CpUmDHqM:ZtIpk4tCcyA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=qe3CpUmDHqM:ZtIpk4tCcyA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=qe3CpUmDHqM:ZtIpk4tCcyA:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=qe3CpUmDHqM:ZtIpk4tCcyA:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=qe3CpUmDHqM:ZtIpk4tCcyA:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/qe3CpUmDHqM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/03/11/t-sql-tuesday-040-file-and-filegroup-wisdom/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>March 2013 LV UG Meeting</title>
		<link>http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=march-2013-lv-ug-meeting</link>
		<comments>http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/#comments</comments>
		<pubDate>Mon, 11 Mar 2013 21:17:07 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[SSSOLV]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[PASS]]></category>
		<category><![CDATA[SQLFamily]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=2011</guid>
		<description><![CDATA[Another month and we have another installment (meeting) for the Data Professionals of the Las Vegas area. This month we will be getting back on schedule with the usual meeting time and place.  We had a slight divergence last month due to that heartsy holiday. We are excited about some of the upcoming speakers and[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/"     class="crp_title">Las Vegas February 2013 UG</a></li><li><a href="http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/"     class="crp_title">Las Vegas April 2013 UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2011/11/30/december-2011-lv-ug-meeting/"     class="crp_title">December 2011 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/01/09/january-s3olv-2013/"     class="crp_title">January S3OLV 2013</a></li><li><a href="http://jasonbrimhall.info/2013/05/14/may-2013-las-vegas-ug/"     class="crp_title">May 2013 Las Vegas UG</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p style="text-align: left;"><a href="http://jasonbrimhall.info/wp-content/uploads/2013/02/invited1.png"><img class="size-full wp-image-2006 aligncenter" title="invited" src="http://jasonbrimhall.info/wp-content/uploads/2013/02/invited1.png" alt="" width="470" height="274" /></a>Another month and we have another installment (meeting) for the Data Professionals of the Las Vegas area.</p>
<p>This month we will be getting back on schedule with the usual meeting time and place.  We had a slight divergence last month due to that heartsy holiday.</p>
<p>We are excited about some of the upcoming speakers and feedback we have been getting of late.  We are feverishly working to get some presenters on Big Data and Hadoop.  If you are in the market to present on these topics, ping me.</p>
<p>Here are some of the details for the meeting.</p>
<p><strong><br />
<a href="http://jasonbrimhall.info/wp-content/uploads/2013/03/meet_details.png"><img class="alignright size-full wp-image-2012" title="meet_details" src="http://jasonbrimhall.info/wp-content/uploads/2013/03/meet_details.png" alt="" width="350" height="211" /></a>Presenting is Jason Kassay</strong></p>
<p><strong>Jason</strong> Will be presenting to us on the topic of &#8220;The Accidental Programmer.</p>
<p>Most people in the database world have heard of the term, &#8220;The Accidental DBA&#8221;, those programmers who have to work with databases. How about the other side of the coin? What about DBA&#8217;s an Dev&#8217;s who have to write code or have to work closely with programmers? This presentation is a best practices guide for working with SQL Server in a .Net environment. You will learn how to recognize when bad code is written that interacts with the database, how to track it down, and most importantly how to fix it. On top of that you will also receive an introduction to object oriented programming concepts such as data abstraction, encapsulation, tier architecture, and class objects so that you can better communicate with your programmers.</p>
<p><strong>BIO</strong></p>
<p>Jason has been a software developer for over 10 years and currently works at EZFacility, providing scheduling, management, full-service billing, and membership solutions for the sports, health, and fitness industries. He has worked primarily with .Net (C# and VB) and SQL Server as well as HTML, CSS, and Javascript. When he is not coding or spending time with his awesome family, you will find him either running (to train for the zombie apocalypse) or stopping hockey pucks as a goaltender.</p>
<p>&nbsp;</p>
<p><strong style="line-height: 1.3em;">LiveMeeting Information</strong><span style="line-height: 1.3em;">:</span></p>
<table width="375" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top">Attendee URL:</td>
<td></td>
<td valign="top"><a href="https://www.livemeeting.com/cc/UserGroups/join?id=DC769N&amp;role=attend">https://www.livemeeting.com/cc/UserGroups/join?id=DC769N&amp;role=attend</a></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td valign="top">Meeting ID:</td>
<td></td>
<td valign="top">DC769N</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong style="line-height: 1.3em;">VERY IMPORTANT</strong></p>
<p>The meeting location has changed.  We will no longer be meeting at The Learning Center.  New meeting location is M Staff Solutions &amp; Training / 2620 Regatta Drive Suite 102 Las Vegas, NV 89128.<br />
We are also moving to meetup for meeting management. Please join us for free at <a href="http://www.meetup.com/SQL-Server-Society-of-Las-Vegas/">http://www.meetup.com/SQL-Server-Society-of-Las-Vegas/</a></p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=2011" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/"     class="crp_title">Las Vegas February 2013 UG</a></li><li><a href="http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/"     class="crp_title">Las Vegas April 2013 UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2011/11/30/december-2011-lv-ug-meeting/"     class="crp_title">December 2011 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/01/09/january-s3olv-2013/"     class="crp_title">January S3OLV 2013</a></li><li><a href="http://jasonbrimhall.info/2013/05/14/may-2013-las-vegas-ug/"     class="crp_title">May 2013 Las Vegas UG</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6g4rJlOxA_0:JzI8mqJXtDg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6g4rJlOxA_0:JzI8mqJXtDg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=6g4rJlOxA_0:JzI8mqJXtDg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6g4rJlOxA_0:JzI8mqJXtDg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=6g4rJlOxA_0:JzI8mqJXtDg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6g4rJlOxA_0:JzI8mqJXtDg:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6g4rJlOxA_0:JzI8mqJXtDg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=6g4rJlOxA_0:JzI8mqJXtDg:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=6g4rJlOxA_0:JzI8mqJXtDg:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/6g4rJlOxA_0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Las Vegas February 2013 UG</title>
		<link>http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=las-vegas-february-2013-ug</link>
		<comments>http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/#comments</comments>
		<pubDate>Tue, 12 Feb 2013 13:10:54 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[Corner]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[SQLFamily]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=1997</guid>
		<description><![CDATA[I know it is right in the middle of TSQL2SDAY when this post is to go live.  If you don&#8217;t know what that is, you should go check out this months edition here.  The topic this month is good and should drive up a lot of participation. It also happens that this week we have[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/"     class="crp_title">March 2013 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2011/11/30/december-2011-lv-ug-meeting/"     class="crp_title">December 2011 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/"     class="crp_title">Las Vegas April 2013 UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2012/01/23/s3olv-february-2012/"     class="crp_title">S3OLV February 2012</a></li><li><a href="http://jasonbrimhall.info/2011/08/05/come-one-come-all-s3olv-august-2011/"     class="crp_title">Come One Come All S3OLV August 2011</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p style="text-align: left;"><a href="http://jasonbrimhall.info/wp-content/uploads/2013/02/invited1.png"><img class="size-full wp-image-2006 aligncenter" title="invited" src="http://jasonbrimhall.info/wp-content/uploads/2013/02/invited1.png" alt="" width="470" height="274" /></a>I know it is right in the middle of TSQL2SDAY when this post is to go live.  If you don&#8217;t know what that is, you should go check out this months edition <a href="http://blog.waynesheffield.com/wayne/archive/2013/02/invitation-for-t-sql-tuesday-39-can-you-shell-what-the-posh-is-cooking/">here</a>.  The topic this month is good and should drive up a lot of participation.</p>
<p>It also happens that this week we have a group meeting for the Las Vegas User Group. We normally meet on the second Thursday of each month.  It just so happens that this month that lands on the 14th of February.  If you can&#8217;t fathom why we changed our meeting date, maybe you should Google the date or something (just joking).</p>
<p>This month we have a first time presenter.  I have been bugging her for months to try to get her to come out of her shell to present.  And now she is doing it so be gentle and check out the meeting.</p>
<p>Presenting this month is Terrie White.  She will be presenting on Replication Technologies and High Availability solutions.</p>
<p>Here are some of the details for the meeting.</p>
<p><strong><a href="http://jasonbrimhall.info/wp-content/uploads/2013/02/details1.png"><img class="alignright size-full wp-image-2007" title="details" src="http://jasonbrimhall.info/wp-content/uploads/2013/02/details1.png" alt="" width="332" height="218" /></a>Presenting is Terrie White</strong></p>
<p><strong>Terrie White</strong> Will be presenting to us on replication technologies and high availability.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong style="line-height: 1.3em;">LiveMeeting Information</strong><span style="line-height: 1.3em;">:</span></p>
<table width="375" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top">Attendee URL:</td>
<td></td>
<td valign="top">https://www.livemeeting.com/cc/UserGroups/join?id=WD4TSW&amp;role=attend</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td valign="top">Meeting ID:</td>
<td></td>
<td valign="top">WD4TSW</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong style="line-height: 1.3em;">VERY IMPORTANT</strong></p>
<p>The meeting location has changed.  We will no longer be meeting at The Learning Center.  New meeting location is M Staff Solutions &amp; Training / 2620 Regatta Drive Suite 102 Las Vegas, NV 89128.<br />
We are also moving to meetup for meeting management. Please join us for free at <a href="http://www.meetup.com/SQL-Server-Society-of-Las-Vegas/">http://www.meetup.com/SQL-Server-Society-of-Las-Vegas/</a></p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=1997" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2013/03/11/march-2013-lv-ug-meeting/"     class="crp_title">March 2013 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2011/11/30/december-2011-lv-ug-meeting/"     class="crp_title">December 2011 LV UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2013/04/09/las-vegas-april-2013-ug-meeting/"     class="crp_title">Las Vegas April 2013 UG Meeting</a></li><li><a href="http://jasonbrimhall.info/2012/01/23/s3olv-february-2012/"     class="crp_title">S3OLV February 2012</a></li><li><a href="http://jasonbrimhall.info/2011/08/05/come-one-come-all-s3olv-august-2011/"     class="crp_title">Come One Come All S3OLV August 2011</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=JvrR04guSHc:R36xHYh_iX0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=JvrR04guSHc:R36xHYh_iX0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=JvrR04guSHc:R36xHYh_iX0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=JvrR04guSHc:R36xHYh_iX0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=JvrR04guSHc:R36xHYh_iX0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=JvrR04guSHc:R36xHYh_iX0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=JvrR04guSHc:R36xHYh_iX0:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=JvrR04guSHc:R36xHYh_iX0:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=JvrR04guSHc:R36xHYh_iX0:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/JvrR04guSHc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/02/12/las-vegas-february-2013-ug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is your LOG backed up?</title>
		<link>http://jasonbrimhall.info/2013/02/11/is-your-log-backed-up/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=is-your-log-backed-up</link>
		<comments>http://jasonbrimhall.info/2013/02/11/is-your-log-backed-up/#comments</comments>
		<pubDate>Mon, 11 Feb 2013 08:58:20 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[Corner]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[Database Maintenance]]></category>
		<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[SQL Backup]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=1992</guid>
		<description><![CDATA[You have been doing a fantastic job of late.  You have all of your databases being backed up on a regular schedule.  Now you get an alert that your transaction log just keeps growing.  Why is that? You decide to do a little investigation and find that you have your recovery model set to full[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2012/11/28/differential-restore-fail/"     class="crp_title">Differential Restore Fail</a></li><li><a href="http://jasonbrimhall.info/2012/11/30/backup-history/"     class="crp_title">Backup History</a></li><li><a href="http://jasonbrimhall.info/2012/06/04/database-in-recovery/"     class="crp_title">Database In Recovery</a></li><li><a href="http://jasonbrimhall.info/2011/12/05/database-data-and-log-size-info/"     class="crp_title">Database Data and Log Size Info</a></li><li><a href="http://jasonbrimhall.info/2011/01/25/sql-confessions-02-ssrs-encryption/"     class="crp_title">SQL Confessions 02 SSRS Encryption</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p>You have been doing a fantastic job of late.  You have all of your databases being backed up on a regular schedule.  Now you get an alert that your transaction log just keeps growing.  Why is that?</p>
<p style="text-align: center;"><a href="http://jasonbrimhall.info/wp-content/uploads/2013/02/MissingDB_Link.png"><img class="aligncenter  wp-image-1994" title="MissingDB_Link" src="http://jasonbrimhall.info/wp-content/uploads/2013/02/MissingDB_Link.png" alt="" width="553" height="280" /></a>You decide to do a little investigation and find that you have your recovery model set to full and you are performing full backups.  That should cover it right?  No, that is not right!</p>
<p>What is this?  Now you have to do something more?  Yes, that is correct.  Performing full backups is not always enough to recover your critical data.  You need to know the recovery requirements for the database / server in question.  But since you have the recovery model set to full, let&#8217;s just talk about what else you should be doing.</p>
<p>The first step should be to run a quick script to determine what databases you have in full recovery and which of those databases do not have a LOG backup.  You see, when a database is in full recovery, you should also backup your transaction log on a regular schedule too.  That schedule is to be determined as a part of the second step (and I will only talk about the first two and only briefly about the second step).</p>
<p>In that first step, you can query your msdb database to help generate a report of which databases have had a transaction log backup.  That should be easy enough to do.  Despite the ease, it should not lessen the importance by any degree.  Here is the script that I wrote recently to help determine which databases were in need of a log backup.</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> T1.<span class="me1">Name</span> <span class="kw1">AS</span> DatabaseName
		,IS<span class="sy0">NULL</span><span class="br0">&#40;</span>t2.<span class="me1">database_name</span>, <span class="st0">'No Backup Taken'</span><span class="br0">&#41;</span> <span class="kw1">AS</span> LogBackupAvail
		,T1.<span class="me1">recovery_model_desc</span>
		,<span class="st0">'Log'</span> <span class="kw1">AS</span> BackupType 
		,IS<span class="sy0">NULL</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">VARCHAR</span><span class="br0">&#40;</span>23<span class="br0">&#41;</span>, <span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">DATETIME</span>, <span class="kw2">MAX</span><span class="br0">&#40;</span>T2.<span class="me1">backup_finish_date</span><span class="br0">&#41;</span>, 131<span class="br0">&#41;</span><span class="br0">&#41;</span>
				, <span class="kw1">CASE</span> <span class="kw1">WHEN</span> T1.<span class="me1">recovery_model_desc</span> <span class="sy0">=</span> <span class="st0">'Simple'</span>
						<span class="kw1">THEN</span> <span class="st0">'N/A'</span>
						<span class="kw1">ELSE</span> <span class="st0">'Backup Not Taken'</span>
						<span class="kw1">END</span>
		<span class="br0">&#41;</span> <span class="kw1">AS</span> LastBackUpTaken
	<span class="kw1">FROM</span> sys.<span class="me1">databases</span> T1
		<span class="kw1">LEFT</span> <span class="sy0">OUTER</span> <span class="sy0">JOIN</span> msdb.<span class="me1">dbo</span>.<span class="me1">backupset</span> T2
			<span class="kw1">ON</span> t1.<span class="me1">name</span> <span class="sy0">=</span> t2.<span class="me1">database_name</span>
			<span class="sy0">AND</span> t2.<span class="me1">type</span> <span class="sy0">=</span> <span class="st0">'L'</span>
	<span class="kw1">GROUP</span> <span class="kw1">BY</span> T1.<span class="me1">Name</span>,T2.<span class="me1">database_name</span>,T1.<span class="me1">recovery_model_desc</span></pre></div></div>
<p>You will likely notice that I am querying both sys.databases out of the master database as well as dbo.backupset out of msdb.  Look more closely and you will see the employ of a Left Outer Join with two conditions on the Join.  In this case, both conditions are required to produce the Outer Join effect that I was seeking.  Had I used a script like the following:</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">SELECT</span> T1.<span class="me1">Name</span> <span class="kw1">AS</span> DatabaseName
		,IS<span class="sy0">NULL</span><span class="br0">&#40;</span>t2.<span class="me1">database_name</span>, <span class="st0">'No Backup Taken'</span><span class="br0">&#41;</span> <span class="kw1">AS</span> LogBackupAvail
		,T1.<span class="me1">recovery_model_desc</span>
		,<span class="st0">'Log'</span> <span class="kw1">AS</span> BackupType 
		,IS<span class="sy0">NULL</span><span class="br0">&#40;</span><span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">VARCHAR</span><span class="br0">&#40;</span>23<span class="br0">&#41;</span>, <span class="kw1">CONVERT</span><span class="br0">&#40;</span><span class="kw1">DATETIME</span>, <span class="kw2">MAX</span><span class="br0">&#40;</span>T2.<span class="me1">backup_finish_date</span><span class="br0">&#41;</span>, 131<span class="br0">&#41;</span><span class="br0">&#41;</span>
				, <span class="kw1">CASE</span> <span class="kw1">WHEN</span> T1.<span class="me1">recovery_model_desc</span> <span class="sy0">=</span> <span class="st0">'Simple'</span>
						<span class="kw1">THEN</span> <span class="st0">'N/A'</span>
						<span class="kw1">ELSE</span> <span class="st0">'Backup Not Taken'</span>
						<span class="kw1">END</span>
		<span class="br0">&#41;</span> <span class="kw1">AS</span> LastBackUpTaken
	<span class="kw1">FROM</span> sys.<span class="me1">databases</span> T1
		<span class="kw1">LEFT</span> <span class="sy0">OUTER</span> <span class="sy0">JOIN</span> msdb.<span class="me1">dbo</span>.<span class="me1">backupset</span> T2
			<span class="kw1">ON</span> t1.<span class="me1">name</span> <span class="sy0">=</span> t2.<span class="me1">database_name</span>
		<span class="kw1">WHERE</span> t2.<span class="me1">type</span> <span class="sy0">=</span> <span class="st0">'L'</span>
	<span class="kw1">GROUP</span> <span class="kw1">BY</span> T1.<span class="me1">Name</span>,T2.<span class="me1">database_name</span>,T1.<span class="me1">recovery_model_desc</span></pre></div></div>
<p>You would see a considerably different result set.  The reason for this different result set is tied to the predicate used and the Join conditions.  And when one examines the execution plan, the difference becomes a little more evident.</p>
<p><a href="http://jasonbrimhall.info/wp-content/uploads/2013/02/ExecPlan.png"><img class="aligncenter size-full wp-image-1993" title="ExecPlan" src="http://jasonbrimhall.info/wp-content/uploads/2013/02/ExecPlan.png" alt="" width="535" height="171" /></a></p>
<p>That <em>WHERE</em> predicate converted our Left Outer Join to an Inner Join.  Now, if I had only wanted to return results for databases that had log backups, that might be fine.  I want to report on all databases and find not only the last log backup for a database, but I also want to find if a log backup is missing.  Therefore, I need to ensure that both conditions are declared as part of my Left Outer Join.</p>
<p>Running a query such as this will now provide us with some knowledge as to the database recovery models as well as which databases have had a log backup, have not had a log backup, and which do not need a log backup (based on recovery model).</p>
<p>Armed with this information, it is imperative to do a bit more digging now.  Knowing what the business deems as an acceptable data loss is important.  Find that out and then create transaction log backups accordingly so the business can recover appropriately in the event of a disaster.</p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=1992" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2012/11/28/differential-restore-fail/"     class="crp_title">Differential Restore Fail</a></li><li><a href="http://jasonbrimhall.info/2012/11/30/backup-history/"     class="crp_title">Backup History</a></li><li><a href="http://jasonbrimhall.info/2012/06/04/database-in-recovery/"     class="crp_title">Database In Recovery</a></li><li><a href="http://jasonbrimhall.info/2011/12/05/database-data-and-log-size-info/"     class="crp_title">Database Data and Log Size Info</a></li><li><a href="http://jasonbrimhall.info/2011/01/25/sql-confessions-02-ssrs-encryption/"     class="crp_title">SQL Confessions 02 SSRS Encryption</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=RTzknWhepIw:avlCGpeW9hA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=RTzknWhepIw:avlCGpeW9hA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=RTzknWhepIw:avlCGpeW9hA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=RTzknWhepIw:avlCGpeW9hA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=RTzknWhepIw:avlCGpeW9hA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=RTzknWhepIw:avlCGpeW9hA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=RTzknWhepIw:avlCGpeW9hA:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=RTzknWhepIw:avlCGpeW9hA:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=RTzknWhepIw:avlCGpeW9hA:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/RTzknWhepIw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/02/11/is-your-log-backed-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Audit Configuration Changes</title>
		<link>http://jasonbrimhall.info/2013/01/24/audit-configuration-changes/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=audit-configuration-changes</link>
		<comments>http://jasonbrimhall.info/2013/01/24/audit-configuration-changes/#comments</comments>
		<pubDate>Thu, 24 Jan 2013 20:49:01 +0000</pubDate>
		<dc:creator>Jason Brimhall</dc:creator>
				<category><![CDATA[Corner]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SSC]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[Database Maintenance]]></category>
		<category><![CDATA[SQL Administration]]></category>
		<category><![CDATA[SQL Script]]></category>

		<guid isPermaLink="false">http://jasonbrimhall.info/?p=1981</guid>
		<description><![CDATA[Do you know the last time a Server Property was changed on your instances of SQL Server? Are you wondering when the setting for max degree of parallelism was changed? Do you know who changed the setting? In some environments there are a lot of hands trying to help mix the pot.  Sometimes more hands[...]<div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2011/11/14/tsql-challenge-63-update/"     class="crp_title">TSQL Challenge 63 &#8211; Update</a></li><li><a href="http://jasonbrimhall.info/2013/01/17/last-time-checkdb-was-run/"     class="crp_title">Last Time CheckDB was Run</a></li><li><a href="http://jasonbrimhall.info/2012/11/20/last-known-good-checkdb/"     class="crp_title">Last Known Good CheckDB</a></li><li><a href="http://jasonbrimhall.info/2011/04/29/physical-row-location/"     class="crp_title">Physical Row Location</a></li><li><a href="http://jasonbrimhall.info/2013/01/07/ssrs-subscriptions-report/"     class="crp_title">SSRS Subscriptions Report</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p><a href="http://jasonbrimhall.info/wp-content/uploads/2013/01/configaudit.png"><img class="alignright size-full wp-image-1984" title="configaudit" src="http://jasonbrimhall.info/wp-content/uploads/2013/01/configaudit.png" alt="" width="160" height="200" /></a>Do you know the last time a Server Property was changed on your instances of SQL Server?</p>
<p>Are you wondering when the setting for max degree of parallelism was changed?</p>
<p>Do you know who changed the setting?</p>
<p>In some environments there are a lot of hands trying to help mix the pot.  Sometimes more hands can make light work.  This is not always the case though.  More hands in the mix can be a troublesome thing.  Especially when things start changing and the finger pointing starts but nobody really knows for sure who made the change or when the change was made.</p>
<p>I know, that is why there is this concept called change management.  If you make a change to a setting, it should be documented, approved and communicated.  Unfortunately the process does not always dictate the work flow and it may be circumvented.  This is why auditing is a tool that is in place and should be in place &#8211; like it or not.</p>
<p>Auditing can be a very good tool.  Like many things &#8211; too much of a good thing is not a good thing.  Too much auditing can be more of a hindrance than help.  You don&#8217;t want to cause interference by auditing too many things.  You also don&#8217;t want too much data that the facts get blurred.  I hope that this script strikes more of a balance with just the right amount of data being captured to be of use.</p>
<p>The basic principle to auditing server configs is to find what values changes, when they were changed and by whom.  There are ancillary details that can be helpful in tracking the source of the change such as the hostname of the source computer making the change.  These are all things that we should capture.  But if a setting hasn&#8217;t changed &#8211; then we need not necessarily report that the setting was unchanged (it should go without saying).</p>
<p>So for this, I created a couple of tables and then a script that I can add to a job to run on a regular basis.  I can put the script in a stored procedure should I desire.  I&#8217;ll leave that to you as an exercise to perform.</p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://jasonbrimhall.info/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="tsql" style="font-family:monospace;"><span class="kw1">USE</span> AdminDB;
GO
<span class="kw1">SET</span> <span class="kw1">NOCOUNT</span> <span class="kw1">ON</span>;
&nbsp;
<span class="kw1">DECLARE</span> @ConfigLastUpdateDate	<span class="kw1">DATETIME</span>
		,@PreviousPollDate		<span class="kw1">DATETIME</span>
		,@MaxPollDate			<span class="kw1">DATETIME</span>
		,@<span class="kw1">PATH</span>					<span class="kw1">NVARCHAR</span><span class="br0">&#40;</span>260<span class="br0">&#41;</span>;
&nbsp;
<span class="kw1">SELECT</span> @<span class="kw1">PATH</span> <span class="sy0">=</span> <span class="kw2">REVERSE</span><span class="br0">&#40;</span><span class="kw2">SUBSTRING</span><span class="br0">&#40;</span><span class="kw2">REVERSE</span><span class="br0">&#40;</span><span class="br0">&#91;</span><span class="kw1">PATH</span><span class="br0">&#93;</span><span class="br0">&#41;</span>, 
						<span class="kw2">CHARINDEX</span><span class="br0">&#40;</span><span class="st0">'<span class="es0">\'</span>, REVERSE([path])), 260)) + N'</span><span class="kw2">LOG</span>.<span class="me1">trc</span><span class="st0">'
	FROM sys.traces 
	WHERE is_default = 1;
&nbsp;
IF OBJECT_ID('</span>tempdb..#DBCCConfig<span class="st0">') IS NOT NULL DROP TABLE #DBCCConfig;
	CREATE TABLE #DBCCConfig(
		[ParentObject] VARCHAR (100),
		[Object]       VARCHAR (100),
		[Field]        VARCHAR (100),
		[Value]        VARCHAR (100)); 
&nbsp;
INSERT INTO #DBCCConfig (ParentObject, Object, Field, Value)
	EXECUTE ('</span><span class="kw1">DBCC</span> CONFIG <span class="kw1">WITH</span> TABLERESULTS<span class="st0">');
&nbsp;
WITH cte AS
(
SELECT cfgupddate = MAX(CASE WHEN t1.Field = '</span>cfgupddate<span class="st0">' THEN t1.Value ELSE NULL END),
        cfgupdtime = MAX(CASE WHEN t1.Field = '</span>cfgupdtime<span class="st0">' THEN t1.Value ELSE NULL END)
FROM #DBCCConfig t1
WHERE   Field IN ('</span>cfgupddate<span class="st0">', '</span>cfgupdtime<span class="st0">')
)
SELECT  @ConfigLastUpdateDate = CONVERT(DATETIME,t3.configure_upd_dt)
FROM    cte t1
        CROSS APPLY (SELECT cfgupddate = DATEADD(DAY, CONVERT(INT, t1.cfgupddate), '</span><span class="nu0">1900</span><span class="sy0">-</span>01<span class="sy0">-</span>01<span class="st0">')) t2
        CROSS APPLY (SELECT configure_upd_dt = DATEADD(ms, CONVERT(INT, t1.cfgupdtime)*3.3, t2.cfgupddate)) t3;
&nbsp;
IF NOT EXISTS (SELECT Name 
					FROM sys.objects 
					WHERE name = '</span>SysConfigAudit<span class="st0">')
	CREATE TABLE SysConfigAudit (
		configuration_id	int
		,name	NVARCHAR(256)
		,value	sql_variant
		,minimum	sql_variant
		,maximum	sql_variant
		,value_in_use	sql_variant
		,description	NVARCHAR(MAX)
		,is_dynamic	bit
		,is_advanced	BIT
		,PollDate		DATE
		,LastConfigUpdtDate	DATETIME)
&nbsp;
IF NOT EXISTS (SELECT Name 
					FROM sys.objects 
					WHERE name = '</span>SysConfigChangeLog<span class="st0">')
	CREATE TABLE SysConfigChangeLog (
		configuration_id	int
		,name	NVARCHAR(256)
		,CurrValue	SQL_VARIANT
		,PrevValue	SQL_VARIANT
		,description	NVARCHAR(MAX)
		,PollDate		DATE
		,LastConfigUpdtDate	DATETIME
		,PrevConfigUpdtDate	DATETIME
		,ChangeDate	DATETIME
		,ChangeBy	NVARCHAR(256)
		,HostName	NVARCHAR(256)
		,ChangeSPID	SQL_VARIANT
		,Changedata	NVARCHAR(2000)
		,ApplicationName NVARCHAR(256)
		,Severity INT
		,ERROR SQL_VARIANT
		,ChangeBySessionLogin	NVARCHAR(256))
IF NOT EXISTS (SELECT Name 
					FROM sys.key_constraints 
					WHERE name ='</span>PK_SysConfigChangeLog<span class="st0">' 
						AND OBJECT_NAME(parent_object_id) = '</span>SysConfigChangeLog<span class="st0">')
BEGIN
ALTER TABLE dbo.SysConfigChangeLog ADD CONSTRAINT
	PK_SysConfigChangeLog PRIMARY KEY CLUSTERED 
	(
	configuration_id,
	ChangeDate DESC
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) 
		ON Admin_Data
&nbsp;
END
&nbsp;
SET @MaxPollDate = ISNULL((SELECT TOP 1 PollDate
								FROM dbo.SysConfigAudit 
								ORDER BY PollDate DESC),'</span><span class="nu0">1</span><span class="sy0">/</span><span class="nu0">1</span><span class="sy0">/</span><span class="nu0">1900</span><span class="st0">')
&nbsp;
/* Write the configurations out to audit table 
*/
IF CONVERT(DATE,GETDATE()) &lt;&gt; @MaxPollDate
BEGIN
	INSERT INTO SysConfigAudit
			( configuration_id ,
			  name ,
			  value ,
			  minimum ,
			  maximum ,
			  value_in_use ,
			  description ,
			  is_dynamic ,
			  is_advanced,
			  PollDate,
			  LastConfigUpdtDate
			)
	SELECT configuration_id,name
			,value
			,minimum,maximum
			,value_in_use
			,description
			,is_dynamic,is_advanced
			,GETDATE(),@ConfigLastUpdateDate
		FROM master.sys.configurations;
END
&nbsp;
/* Recast MaxPollDate */
SET @MaxPollDate = ISNULL((SELECT TOP 1 PollDate
								FROM dbo.SysConfigAudit 
								ORDER BY PollDate DESC),'</span><span class="nu0">1</span><span class="sy0">/</span><span class="nu0">1</span><span class="sy0">/</span><span class="nu0">1900</span><span class="st0">')
&nbsp;
SET @PreviousPollDate = ISNULL((SELECT TOP 1 PollDate 
									FROM dbo.SysConfigAudit 
									WHERE Polldate &lt;&gt; @MaxPollDate 
									ORDER BY PollDate DESC),'</span><span class="nu0">1</span><span class="sy0">/</span><span class="nu0">1</span><span class="sy0">/</span><span class="nu0">1900</span><span class="st0">');
&nbsp;
/*	A configuration has changed and a reboot has occurred 
	causing the updtdate to be written to the config block of the page 10
	The configuration may not be written to the page, but we will write it to
	the table anyway and then compare to the default trace file in all cases.
	If there are any values changed, then write those to the change log with
	the login of the person who changed the value
*/
&nbsp;
BEGIN
&nbsp;
WITH presel AS (
SELECT df.LoginName,df.TextData,df.StartTime,df.HostName,df.Severity,df.DatabaseName,df.SPID,df.ERROR
		,df.SessionLoginName,df.ApplicationName
		,SUBSTRING(df.TextData
					,CHARINDEX('</span><span class="st0">''</span><span class="st0">',df.TextData)+1
					,CHARINDEX('</span><span class="st0">''</span><span class="st0">',df.TextData
								,CHARINDEX('</span><span class="st0">''</span><span class="st0">',df.TextData)+1)-CHARINDEX('</span><span class="st0">''</span><span class="st0">',df.TextData)-1)
				AS ConfigName
		,ROW_NUMBER() OVER (PARTITION BY SUBSTRING(df.TextData
													,CHARINDEX('</span><span class="st0">''</span><span class="st0">',df.TextData)+1
													,CHARINDEX('</span><span class="st0">''</span><span class="st0">',df.TextData
															,CHARINDEX('</span><span class="st0">''</span><span class="st0">',df.TextData)+1)-CHARINDEX('</span><span class="st0">''</span><span class="st0">',df.TextData)-1) 
								ORDER BY df.StartTime DESC) AS RowNum
	FROM ::fn_trace_gettable( @path, DEFAULT )  df
	WHERE 1=1
		AND df.TextData LIKE '</span><span class="sy0">%</span>Configuration option<span class="sy0">%</span><span class="st0">'
		AND df.ApplicationName NOT IN ('</span>SQLAgent <span class="sy0">-</span> Initial Boot Probe<span class="st0">','</span>SQLAgent <span class="sy0">-</span> Enabling<span class="sy0">/</span>disabling Agent XPs<span class="st0">')
		AND df.Severity IS NOT NULL
)
&nbsp;
INSERT INTO SysConfigChangeLog (configuration_id,name,CurrValue,PrevValue,description,PollDate	
							,LastConfigUpdtDate	,PrevConfigUpdtDate	,ChangeDate,ChangeBy
							,HostName,ChangeSPID,Changedata,ApplicationName,Severity
							,ERROR,ChangeBySessionLogin)
SELECT CUR.configuration_id,cur.NAME,cur.VALUE AS CurrValue,Prev.VALUE AS PrevValue,cur.description
		,cur.polldate, cur.LastConfigUpdtDate,prev.LastConfigUpdtDate AS PrevConfigUpdtDate
		,df.StartTime AS ChangeDate,df.LoginName AS ChangeBy,df.HostName,df.SPID AS ChangeSPID
		,df.TextData AS ChangeData,df.ApplicationName,df.Severity,df.ERROR
		,df.SessionLoginName AS ChangeBySessionLogin
	FROM AdminDB.dbo.SysConfigAudit CUR
		INNER JOIN AdminDB.dbo.SysConfigAudit Prev
			ON CUR.configuration_id = Prev.configuration_id
			AND CUR.PollDate = @MaxPollDate
			AND Prev.PollDate = @PreviousPollDate
		CROSS APPLY presel  df
	WHERE df.RowNum = 1
		AND df.ConfigName = CUR.NAME
		AND CUR.VALUE &lt;&gt; Prev.VALUE	
		AND NOT EXISTS (SELECT configuration_id
							FROM SysConfigChangeLog
							WHERE Name = Cur.NAME
								AND CurrValue = CUR.VALUE
								AND PrevValue = Prev.VALUE
								AND ChangeDate = df.StartTime
								AND ChangeBy = df.LoginName)
		;
END
&nbsp;
SELECT *
	FROM dbo.SysConfigChangeLog
	ORDER BY ChangeDate DESC;</span></pre></div></div>
<p>Here I am trapping the config settings on a daily basis (as the script is written for now). I then cross reference the current settings against the previous settings.  Then I check the default trace to see if any of those settings exist in the trace file.</p>
<p>The default trace captures the data related to configuration changes.  On busy systems, it is still possible for these settings to roll out of the trace files.  For those systems, we may need to make some alterations to the script (such as running more frequently and changing the comparisons to account for smaller time intervals than a day break).</p>
<p>To ensure proper comparison between the audit tables and the trace file, note the substring function employed.  I can capture the configuration name and then join to the audit tables on configuration name.</p>
<p>This has proven useful to me so far in tracking who did what to which setting and when they did it.</p>
<p>I hope you will find good use for it as well.</p>
 <img src="http://jasonbrimhall.info/?feed-stats-post-id=1981" width="1" height="1" style="display: none;" /><div class="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://jasonbrimhall.info/2011/11/14/tsql-challenge-63-update/"     class="crp_title">TSQL Challenge 63 &#8211; Update</a></li><li><a href="http://jasonbrimhall.info/2013/01/17/last-time-checkdb-was-run/"     class="crp_title">Last Time CheckDB was Run</a></li><li><a href="http://jasonbrimhall.info/2012/11/20/last-known-good-checkdb/"     class="crp_title">Last Known Good CheckDB</a></li><li><a href="http://jasonbrimhall.info/2011/04/29/physical-row-location/"     class="crp_title">Physical Row Location</a></li><li><a href="http://jasonbrimhall.info/2013/01/07/ssrs-subscriptions-report/"     class="crp_title">SSRS Subscriptions Report</a></li></ul></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=MMx5NWpFJOk:V9vMgslWElY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=MMx5NWpFJOk:V9vMgslWElY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=MMx5NWpFJOk:V9vMgslWElY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=MMx5NWpFJOk:V9vMgslWElY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=MMx5NWpFJOk:V9vMgslWElY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=MMx5NWpFJOk:V9vMgslWElY:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=MMx5NWpFJOk:V9vMgslWElY:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/SqlRnnr?a=MMx5NWpFJOk:V9vMgslWElY:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/SqlRnnr?i=MMx5NWpFJOk:V9vMgslWElY:3QFJfmc7Om4" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/SqlRnnr/~4/MMx5NWpFJOk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jasonbrimhall.info/2013/01/24/audit-configuration-changes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
