<?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>SQLSoldier</title>
	
	<link>http://www.sqlsoldier.com/wp</link>
	<description>News From the Frontlines</description>
	<lastBuildDate>Wed, 08 Feb 2012 20:17:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Sqlsoldier" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="sqlsoldier" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>[Shameless Plug] Can We Have Your Vote?</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/canwehaveyourvote</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/canwehaveyourvote#comments</comments>
		<pubDate>Wed, 08 Feb 2012 20:17:05 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Performance & Optimization]]></category>
		<category><![CDATA[SQL PASS]]></category>
		<category><![CDATA[SQLRally]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1537</guid>
		<description><![CDATA[[Shameless Plug] Can We Have Your Vote? Argenis Fernandez (&#124;@DBArgenis) and yours truly have submitted a Pre-Conference for SQL Rally 2012 in Dallas, TX called “Demystifying Database Administration Best Practices”. We think it’s going to be an epic session with just loads and loads of tips and best practices on multiple aspects of Database Administration, from...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">[Shameless Plug] Can We Have Your Vote?</span></h2>
<div id="attachment_618" class="wp-caption alignright" style="width: 250px"><a href="http://www.sqlsoldier.com/wp/wp-content/uploads/2010/12/SQLRally.gif" target="_blank"><img class="size-full wp-image-618" title="SQLRally" src="http://www.sqlsoldier.com/wp/wp-content/uploads/2010/12/SQLRally.gif" alt="SQLRally" width="240" height="93" /></a><p class="wp-caption-text">SQL PASS SQLRally</p></div>
<p>Argenis Fernandez (<a href="http://sqlblog.com/blogs/argenis_fernandez/archive/2012/02/08/shameless-plug-can-we-have-your-vote.aspx" target="_blank">|</a><a href="http://twitter.com/DBArgenis" target="_blank">@DBArgenis</a><a href="http://sqlblog.com/blogs/argenis_fernandez/archive/2012/02/08/shameless-plug-can-we-have-your-vote.aspx" target="_blank">) </a>and yours truly have submitted a Pre-Conference for <a href="http://www.sqlpass.org/sqlrally/2012/dallas/">SQL Rally 2012 in Dallas, TX</a> called “Demystifying Database Administration Best Practices”. We think it’s going to be an epic session with just loads and loads of tips and best practices on multiple aspects of Database Administration, from Windows/AD setup to Daily Operations to Code Reviews.</p>
<p>While our session wasn’t chosen by the committee in the first round, it made it to the community voting round – so this post is to kindly ask for your vote. We promise we’ll deliver great content! Argenis and I have combined over 25+ years of experience. I am an MCM, and Argenis is halfway there (he actually will take a shot at the MCM lab Thursday, February 9, 2012).</p>
<p>Please vote here:</p>
<p><a href="http://www.sqlpass.org/sqlrally/2012/dallas/UserLogin.aspx?returnurl=/sqlrally/2012/dallas/CommunityChoice.aspx">http://www.sqlpass.org/sqlrally/2012/dallas/UserLogin.aspx?returnurl=/sqlrally/2012/dallas/CommunityChoice.aspx</a></p>
<p>If you haven’t become a member of PASS yet (You haven’t? What are you waiting for?) It’s free, go sign up now here:</p>
<p><a href="http://www.sqlpass.org/RegisterforSQLPASS.aspx">http://www.sqlpass.org/RegisterforSQLPASS.aspx</a></p>
<p>And even if you do not feel that our session would be the best choice, please vote and make your voice heard. Do your part in keeping our community strong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/canwehaveyourvote/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Breaking Down TempDB Contention (part 2)</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/breakingdowntempdbcontentionpart2</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/breakingdowntempdbcontentionpart2#comments</comments>
		<pubDate>Mon, 30 Jan 2012 22:06:33 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Performance & Optimization]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[tempDB]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1526</guid>
		<description><![CDATA[Breaking Down TempDB Contention (part 2) I wrote a somewhat popular script and blog post a while back called Breaking Down TempDB Contention. This post explains how to identify tempdb contention. This past Friday, Jonathan Kehayias (blog&#124;@SQLPoolboy) contacted me about the script. Jonathan said that he thought the math was off just a little bit...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">Breaking Down TempDB Contention (part 2)</span></h2>
<div id="attachment_1528" class="wp-caption alignright" style="width: 310px"><a href="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/tempdbContentionDM.png" target="+blank"><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/tempdbContentionDM-300x239.png" alt="Tempdb Contention via Idera Diagnostic Manager" title="Tempdb Contention via Idera Diagnostic Manager" width="300" height="239" class="size-medium wp-image-1528" /></a><p class="wp-caption-text">Tempdb Contention via Idera Diagnostic Manager</p></div>
<p>I wrote a somewhat popular script and blog post a while back called <a href="http://www.sqlsoldier.com/wp/sqlserver/breakingdowntempdbcontention" target="_blank">Breaking Down TempDB Contention</a>. This post explains how to identify tempdb contention. This past Friday, Jonathan Kehayias (<a href="http://www.sqlskills.com/blogs/jonathan/" target="_blank">blog</a>|<a href="http://twitter.com/SQLPoolboy" target="_blank">@SQLPoolboy</a>) contacted me about the script. Jonathan said that he thought the math was off just a little bit in the script. The original script has the PFS pages repeating every 8088 pages and the GAM and SGAM pages repeating every 511232 pages. That is almost right.</p>
<p>The first PFS page is page 1 (which is actually the second page in the file as the header page is page 0). The 2nd PFS page is 8088 exactly, not 8088 pages later. After the first page, it does repeat every 8088 pages.</p>
<p>Likewise, the first GAM page is page 2, the second GAM page is page 511232 and then repeats every 511232 pages. The first SGAM is page 3, the second SGAM page is 511233 and then repeats every 511232 pages.</p>
<p>The old <strong>incorrect</strong> formula for determing which type of page on which the contention is occurring was:</p>
<p><strong>GAM:</strong> (Page ID – 2) % 511232<br />
<strong>SGAM:</strong> (Page ID – 3) % 511232<br />
<strong>PFS:</strong> (Page ID – 1) % 8088</p>
<p>The new and improved forumala is:</p>
<p><strong>GAM:</strong> Page ID = 2 or Page ID % 511232<br />
<strong>SGAM:</strong> Page ID = 3 or (Page ID &#8211; 1) % 511232<br />
<strong>PFS:</strong> Page ID = 1 or Page ID % 8088</p>
<h3>Proving the New Formula</h3>
<p>I wanted you to be able to prove for yourself that the new forula was correct. I threw together a script to check the page types of the suspected allocation pages. The first thing i want to do is grow the tempdb data file to a size large enough that I can check multiple instances of the allocation files. The GAM and SGAM pages reoccur every 4 GB, so this script will work just fine with a smaller amount than I&#8217;ve chosen. I grow the tempdb data file to 20 GB.</p>
<pre class="code"><span style="color:green">-- Resize tempdb main data file to 20 GB
</span><span style="color:blue">Declare </span>@FileSize <span style="color:blue">int</span><span style="color:gray">;

</span><span style="color:blue">Select </span>@FileSize <span style="color:gray">= </span>size <span style="color:gray">* </span>8 <span style="color:gray">/ </span>1024
<span style="color:blue">From </span>tempdb<span style="color:gray">.</span><span style="color:green">sys</span><span style="color:gray">.</span><span style="color:green">database_files
</span><span style="color:blue">Where </span>name <span style="color:gray">= </span><span style="color:red">N'tempdev'</span><span style="color:gray">;

</span><span style="color:blue">If </span>@FileSize <span style="color:gray">&lt; </span>2048
  <span style="color:blue">Begin
    Alter Database </span>tempdb
        <span style="color:blue">Modify File </span><span style="color:gray">(
            </span>Name <span style="color:gray">= </span><span style="color:red">N'tempdev'</span><span style="color:gray">,
            </span>Size <span style="color:gray">= </span>20480MB<span style="color:gray">)
  </span><span style="color:blue">End
Go</span></pre>
<p>Now that the tempdb is large enough, I can select some choice pages. We know for a fact that page 1 is PFS , page 2 is GAM, and page 3 is SGAM. If we look at the page with DBCC PAGE, we will see a page type of 11, 8, and 9 respectively. We also check several other pages to see if they return the page types we expect.</p>
<pre class="code"><span style="color:green">-- Check page type of Page type of
-- page IDs of 1, 8088, 16176
</span><span style="color:blue">Declare </span>@DBCCPage <span style="color:blue">Table </span><span style="color:gray">(
    </span>ParentObject <span style="color:blue">nvarchar</span><span style="color:gray">(</span>255<span style="color:gray">),
    </span><span style="color:blue">Object nvarchar</span><span style="color:gray">(</span>255<span style="color:gray">),
    </span>Field <span style="color:blue">nvarchar</span><span style="color:gray">(</span>255<span style="color:gray">),
    </span>Value <span style="color:blue">nvarchar</span><span style="color:gray">(</span>255<span style="color:gray">))

</span><span style="color:green">-- Read pages 1, 8088, 16176
</span><span style="color:blue">Insert Into </span>@DBCCPage
<span style="color:blue">Exec </span><span style="color:maroon">sp_executesql </span><span style="color:red">N'DBCC traceon (3604);
        DBCC Page(tempdb, 1, 1, 1) With TableResults;
        DBCC Page(tempdb, 1, 2, 1) With TableResults;
        DBCC Page(tempdb, 1, 3, 1) With TableResults;
        DBCC Page(tempdb, 1, 8088, 1) With TableResults;
        DBCC Page(tempdb, 1, 16176, 1) With TableResults;
        DBCC Page(tempdb, 1, 511232, 1) With TableResults;
        DBCC Page(tempdb, 1, 511233, 1) With TableResults;
        DBCC Page(tempdb, 1, 1022464, 1) With TableResults;
        DBCC Page(tempdb, 1, 1022465, 1) With TableResults;'</span><span style="color:gray">;

</span><span style="color:green">-- Parse page numbers and types (11 = PFS page
</span><span style="color:blue">Select </span>m_pageId<span style="color:gray">, </span>m_type
<span style="color:blue">From </span><span style="color:gray">(</span><span style="color:blue">Select Object</span><span style="color:gray">, </span>Field<span style="color:gray">, </span>Value
    <span style="color:blue">From </span>@DBCCPage
    <span style="color:blue">Where </span>Field <span style="color:gray">In (</span><span style="color:red">'m_type'</span><span style="color:gray">, </span><span style="color:red">'m_pageId'</span><span style="color:gray">)) </span><span style="color:blue">As </span>Pvt
<span style="color:gray">Pivot (</span><span style="color:magenta">Min</span><span style="color:gray">(</span>Value<span style="color:gray">)
    </span><span style="color:blue">For </span>Field <span style="color:gray">In (</span>[m_type]<span style="color:gray">, </span>[m_pageId]<span style="color:gray">)) </span><span style="color:blue">As </span>Pvt2<span style="color:gray">;</span></pre>
<p><b>the Results</b></p>
<table cellpadding="4" cellspacing="0" border="0">
<tr>
<td align="center" style="border:solid thin black;">&nbsp;<b>m_pageId</b>&nbsp;</td>
<td align="center" style="border:solid thin black;">&nbsp;<b>m_type</b>&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:1)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;11&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:2)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;8&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:3)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;9&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:8088)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;11&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:16176)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;11&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:1022464)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;8&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:1022465)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;9&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:511232)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;8&nbsp;</td>
</tr>
<tr>
<td style="border:solid thin black;">&nbsp;(1:511233)&nbsp;</td>
<td style="border:solid thin black;">&nbsp;9&nbsp;</td>
</tr>
</table>
<h3> New Script</h3>
<p>Jonathan also sent a version of the previous script that he thought would fit the bill. I changed it up a little bit to use a CTE simply because I think it is easier to read and understand with a CTE than with a derived table.</p>
<pre class="code"><span style="color:blue">With </span>Tasks
<span style="color:blue">As </span><span style="color:gray">(</span><span style="color:blue">Select </span>session_id<span style="color:gray">,
        </span>wait_type<span style="color:gray">,
        </span>wait_duration_ms<span style="color:gray">,
        </span>blocking_session_id<span style="color:gray">,
        </span>resource_description<span style="color:gray">,
        </span>PageID <span style="color:gray">= </span><span style="color:magenta">Cast</span><span style="color:gray">(Right(</span>resource_description<span style="color:gray">, </span><span style="color:magenta">Len</span><span style="color:gray">(</span>resource_description<span style="color:gray">)
                - </span><span style="color:magenta">Charindex</span><span style="color:gray">(</span><span style="color:red">':'</span><span style="color:gray">, </span>resource_description<span style="color:gray">, </span>3<span style="color:gray">)) </span><span style="color:blue">As Int</span><span style="color:gray">)
    </span><span style="color:blue">From </span><span style="color:green">sys</span><span style="color:gray">.</span><span style="color:green">dm_os_waiting_tasks
    </span><span style="color:blue">Where </span>wait_type <span style="color:gray">Like </span><span style="color:red">'PAGE%LATCH_%'
    </span><span style="color:gray">And </span>resource_description <span style="color:gray">Like </span><span style="color:red">'2:%'</span><span style="color:gray">)
</span><span style="color:blue">Select </span>session_id<span style="color:gray">,
        </span>wait_type<span style="color:gray">,
        </span>wait_duration_ms<span style="color:gray">,
        </span>blocking_session_id<span style="color:gray">,
        </span>resource_description<span style="color:gray">,
    </span>ResourceType <span style="color:gray">= </span><span style="color:blue">Case
        When </span>PageID <span style="color:gray">= </span>1 <span style="color:gray">Or </span>PageID <span style="color:gray">% </span>8088 <span style="color:gray">= </span>0 <span style="color:blue">Then </span><span style="color:red">'Is PFS Page'
        </span><span style="color:blue">When </span>PageID <span style="color:gray">= </span>2 <span style="color:gray">Or </span>PageID <span style="color:gray">% </span>511232 <span style="color:gray">= </span>0 <span style="color:blue">Then </span><span style="color:red">'Is GAM Page'
        </span><span style="color:blue">When </span>PageID <span style="color:gray">= </span>3 <span style="color:gray">Or (</span>PageID <span style="color:gray">- </span>1<span style="color:gray">) % </span>511232 <span style="color:gray">= </span>0 <span style="color:blue">Then </span><span style="color:red">'Is SGAM Page'
        </span><span style="color:blue">Else </span><span style="color:red">'Is Not PFS, GAM, or SGAM page'
    </span><span style="color:blue">End
From </span>Tasks<span style="color:gray">;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/breakingdowntempdbcontentionpart2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Kind of DBA I Want to Be</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/kindofdbaiwanttobe</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/kindofdbaiwanttobe#comments</comments>
		<pubDate>Sun, 22 Jan 2012 16:30:18 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[Professional Development]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1515</guid>
		<description><![CDATA[The Kind of DBA I Want to Be I was a big fan of the original Iron Chef tv show, as in the original show from Japan. And my favorite Iron Chef was Iron Chef Japanese Rokusaburo Michiba. If you don&#8217;t know the show, it probably seems redundant to refer to a Japanese chef on...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">The Kind of DBA I Want to Be</span></h2>
<p><div id="attachment_1516" class="wp-caption alignright" style="width: 310px"><a href="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/michiba.jpg" target="_blank"><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/michiba-300x232.jpg" alt="Rokusaburo Michiba" title="Rokusaburo Michiba" width="300" height="232" class="size-medium wp-image-1516" /></a><p class="wp-caption-text">Rokusaburo Michiba (Iron Chef Japanese)</p></div><br />
I was a big fan of the original Iron Chef tv show, as in the original show from Japan. And my favorite Iron Chef was Iron Chef Japanese <a href="http://www.imdb.com/name/nm0585171/" target="_blank">Rokusaburo Michiba</a>. If you don&#8217;t know the show, it probably seems redundant to refer to a Japanese chef on a Japanese tv show as Iron Chef Japanese, but it isn&#8217;t. There were 3 1/2 Iron Chefs originally (Iron Chef Italian rarely appeared unless he had an actual challenger to face). Each chef was known by their specialties. Chinese, French, Italian, and Japanese; all Japanese chefs with varying specialties.</p>
<p>When the show was on the Food Network, I always enjoyed the Japanese battles the best. I was a fan of Rokusaburo Michiba because of the skills that he demonstrated. Not just his cooking proficiency, but the very way he approached every battle. I like to imagine myself approaching battle in the same way. The difference is that my opponent isn&#8217;t another chef or DBA. My opponent is a production outage.</p>
<h3>Eye of the Storm</h3>
<p><div id="attachment_1519" class="wp-caption alignright" style="width: 310px"><a href="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/michibamenu.jpg" target="_blank"><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/michibamenu-300x213.jpg" alt="Michiba Prepares the Menu" title="Michiba Prepares the Menu" width="300" height="213" class="size-medium wp-image-1519" /></a><p class="wp-caption-text">Michiba Prepares the Menu</p></div><br />
The beginning of a battle involved a lot of hectic running around trying to get lots of dishes started. It was difficult to figure out what any one person was doing and you definitely couldn&#8217;t see any semblance of a team plan for the battle. Just everybody doing something and somehow making it work.</p>
<p>On Michiba&#8217;s side of the kitchen, something different was occurring. He would get his assistants started on different preparations while he took a piece of paper and a pen and wrote out the menu in beautiful Japanese characters. At first, I thought this was crazy. He&#8217;s wasting precious time. That&#8217;s 4 or 5 minutes he can&#8217;t get back at the end of the battle when he&#8217;ll need it. Yet somehow, he never needed it. In fact, his dishes always seemed to finish with perfect timing right at the very end. At the same time, I saw his opponents many times talking about dishes they had planned to make but ran out of time. How could this time waster end up so perfectly so often?</p>
<p>The answer of course is planning. When others were panicking and rushing around, he was writing out his menu. After that, he and all of his assistants knew exactly what needed to be done and when. They had a plan, and they knew how to follow a plan. The trouble with this is that nobody wants to plan when there is a production outage. Business wants action. They want you to cowboy up and get it back online by any means. Nobody wants to look like they&#8217;re not giving it their all, so planning hardly ever comes into play.</p>
<h3>Real-life Example</h3>
<p>Here&#8217;s a real-life example where failure to plan was costly. Someone called me at home one morning because their replication publisher (mirrored asynchronously) was down and they needed to failover to the mirror. I was in the shower when they called. Because I didn&#8217;t answer, they asked a &#8220;friend&#8221; who is a &#8220;DBA&#8221; what to do. He gave his suggestions and they followed through with it, but what he had advised wasn&#8217;t working. I called them when I got out of the shower and had listened to their message.</p>
<p>I asked them what was going on, and their reply was, &#8220;We need to failover the publisher to the mirror. I&#8217;ve dropped mirroring, now what do I do?&#8221;  I listed what they would need to do and then walked them through each step. The publisher wasn&#8217;t online, so there was no option to re-establih mirroring. Their friend had told them that the only way to bring the mirror online if mirroring asynchronously was to drop mirroring.</p>
<p>Here&#8217;s what they had to do to rectify the problem (actual time: 5 hours):</p>
<ol>
<li>Recover the mirror database</li>
<li>Change the application connection strings to point to the original mirror as the primary (for write operations)</li>
<li>Change the application connection strings to point to the original mirror for read operations</li>
<li>Drop replication</li>
<li>Recreate replication</li>
<li>Reinitialize and reconfigure the 5 subscribers to the publisher</li>
<li>Change the application connection strings to repoint to the subscribers for read operations</li>
</ol>
<p>Here&#8217;s what they should have done (estimated time: 5 seconds):</p>
<ol>
<li>Force service on the mirror with allow data loss</li>
</ol>
<h3>Summary</h3>
<p>To be a good DBA, you don&#8217;t need to write out a full menu every time a problem occurs, but you should be doing at least some minimal planning. Make sure everyone knows what needs to be done and what their part of the plan is. Be like Rokusaburo Michiba. Let others run around wildly while you take a couple of minutes to understand the situation and devise the best plan. Then take action. You&#8217;ll be surprised how planning can help you reach your end goal right on time instead of struggling to get there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/kindofdbaiwanttobe/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Including Missing Values in Data Ranges Without a Lookup Table</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/includingmissingvaluesindatarangeswithoutalookuptable</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/includingmissingvaluesindatarangeswithoutalookuptable#comments</comments>
		<pubDate>Sat, 14 Jan 2012 19:47:17 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[How do I ... ?]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1482</guid>
		<description><![CDATA[Including Missing Values in Data Ranges Without a Lookup Table One of the ways that I learn new things is by helping others with their issues or questions. In my career, this has served me well by exposing me to a vast array of experiences that I may not have otherwise seen. I try to...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">Including Missing Values in Data Ranges Without a Lookup Table</span></h2>
<p><div id="attachment_1483" class="wp-caption alignright" style="width: 210px"><a href="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/PerfData.jpg" target="_blank"><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/PerfData-300x180.jpg" alt="Including Missing Data" title="PerfData" width="200" height="120" class="size-medium wp-image-1483" /></a><p class="wp-caption-text">Including Missing Data</p></div><br />
One of the ways that I learn new things is by helping others with their issues or questions. In my career, this has served me well by exposing me to a vast array of experiences that I may not have otherwise seen. I try to be active on various internal SQL discussion lists at work, and an interesting question came in today. My gut reaction was to go with the &#8220;stock answer&#8221; for this kind of question, but somehow it seemed like there should be a better way.</p>
<p>The question was about how to include missing sets of data from a range of results (i.e., include missing data with a value of null). The stock answer is to create a lookup table and do a LEFT JOIN to the data so that that values not represented in the data set gets returned with null values. In this particular scenario, the possible data values would not all be known ahead of time and could be different values each time you check it. That makes it difficult to pre-populate a lookup table. Fortunately, the increment of the values in the range is known (5 seconds), so it turns out that it is very simple to generate the lookup values dynamically using a recursive CTE.</p>
<h3>The Email Exchange</h3>
<fieldset style="border:solid 1px black;padding-left:7px;padding-top:7px;padding-bottom:7px;padding-right:7px;margin-left:30px;margin-right:130px;color:black;">
<legend>Initial Email</legend>
<p><strong>Subject:</strong> Adding extra rows of data to a query result</p>
<hr />
Hello all. First I want to send a huge thank you to all on this alias. I have asked many questions recently while trying to get a reporting project completed for Visual Studio Load Testing. The feedback has been invaluable and I have made great strides on this effort.</p>
<p>So here’s my current predicament. I am querying a table that contains perfmon counters, collected throughout the run. However, for various different reasons it is not uncommon for there to be short intervals throughout the run where values are not collected for various counters. The DB does not add an entry for these, so when I get the results, I will have an incomplete result set (based on graphing the results). Example below.</p>
<p>Is there a way to add something to the query (or a view or whatever) that will add extra rows of data with the missing timestamps and null data for the counter values?</p>
<p>I get this from the DB:</p>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td width=100>2:13:08 AM</td>
<td width=100>0.150998</td>
</tr>
<tr>
<td>2:13:13 AM</td>
<td>1.476516</td>
</tr>
<tr>
<td>2:13:18 AM</td>
<td>0.094423</td>
</tr>
<tr>
<td> </td>
<td><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2012/01/arrow.png"></td>
</tr>
<tr>
<td>2:13:28 AM</td>
<td>0.724203</td>
</tr>
<tr>
<td>2:13:33 AM</td>
<td>0.175526</td>
</tr>
</table>
<p>I want this in the final set:</p>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td width=100>2:13:08 AM</td>
<td width=100>0.150998</td>
</tr>
<tr>
<td>2:13:13 AM</td>
<td>1.476516</td>
</tr>
<tr>
<td>2:13:18 AM</td>
<td>0.094423</td>
</tr>
<tr>
<td><span style="background-color:yellow;">2:13:23 AM</spam></td>
<td> </td>
</tr>
<tr>
<td>2:13:28 AM</td>
<td>0.724203</td>
</tr>
<tr>
<td>2:13:33 AM</td>
<td>0.175526</td>
</tr>
</table>
</fieldset>
<fieldset style="border:solid 1px black;padding-left:7px;padding-top:7px;padding-bottom:7px;padding-right:7px;margin-left:30px;margin-right:130px;color:black;">
<legend>My Initial Reply</legend>
<p>The easiest way is to create a lookup table with all of the possible time values and then perform a Left Join to include entries from the lookup table that do not have a corresponding value in the data table. In the example you gave, how do you know that the missing time is 2:13:23 AM and not, for example, 2:13:22 AM?</p>
<p>I ask because if that time is in the table for some counters and not others, then you wouldn’t need a lookup table, you could simply use a CTE or derived table to query the distinct list of times and then left join that to the data table.<br />
</fieldset>
<fieldset style="border:solid 1px black;padding-left:7px;padding-top:7px;padding-bottom:7px;padding-right:7px;margin-left:30px;margin-right:130px;color:black;">
<legend>Next Reply</legend>
<p>I “know” the time is 2:13:23 because the intervals are based on a sampling rate entered into the test run (in this case 5 seconds). I thought about doing the distinct time list option, but the only hiccup with that is there may be one or more intervals where NO counters got collected, which leaves me right back where I was before.</p>
<p>I will play with the lookup table idea. Thx.<br />
</fieldset>
<h3> My Final Solution</h3>
<p>I played with the recursive CTE idea for a bit and quickly had a solution. I start by grabbing the MIN and MAX values from the data table into variables to define the overall range. Then I simply recurse the range in 5 second intervals until I reach the end of the range. Creating the range of values turned out to be simpler than I expected.</p>
<pre class="code"><span style="color:green">-- Create dummy table for testing and populate with smaple data
</span><span style="color:blue">If </span><span style="color:magenta">OBJECT_ID</span><span style="color:gray">(</span><span style="color:red">'dbo.PerfMonData'</span><span style="color:gray">) Is Not Null
  </span><span style="color:blue">Begin
    Drop Table </span>dbo<span style="color:gray">.</span>PerfMonData<span style="color:gray">;
  </span><span style="color:blue">End
Go

Create Table </span>dbo<span style="color:gray">.</span>PerfMonData <span style="color:gray">(
    </span>DataID <span style="color:blue">int identity</span><span style="color:gray">(</span>1<span style="color:gray">, </span>1<span style="color:gray">) not null </span><span style="color:blue">primary key</span><span style="color:gray">,
    </span>TrackTime <span style="color:blue">time</span><span style="color:gray">(</span>0<span style="color:gray">) not null,
    </span>TrackValue <span style="color:blue">decimal</span><span style="color:gray">(</span>9<span style="color:gray">, </span>6<span style="color:gray">))
</span><span style="color:blue">Go

Insert Into </span>dbo<span style="color:gray">.</span>PerfMonData <span style="color:gray">(</span>TrackTime<span style="color:gray">, </span>TrackValue<span style="color:gray">)
</span><span style="color:blue">Values </span><span style="color:gray">(</span><span style="color:red">'2:13:08 AM'</span><span style="color:gray">, </span>0.150998<span style="color:gray">),
    (</span><span style="color:red">'2:13:13 AM'</span><span style="color:gray">, </span>1.476516<span style="color:gray">),
    (</span><span style="color:red">'2:13:18 AM'</span><span style="color:gray">, </span>0.094423<span style="color:gray">),
    (</span><span style="color:red">'2:13:28 AM'</span><span style="color:gray">, </span>0.724203<span style="color:gray">),
    (</span><span style="color:red">'2:13:33 AM'</span><span style="color:gray">, </span>0.175526<span style="color:gray">)
</span><span style="color:blue">Go

</span><span style="color:green">-- Query the data
</span><span style="color:blue">Declare </span>@MaxTT <span style="color:blue">time</span><span style="color:gray">(</span>0<span style="color:gray">),
    </span>@MinTT <span style="color:blue">time</span><span style="color:gray">(</span>0<span style="color:gray">);

</span><span style="color:green">-- Get the MIN and MAX values for track time
</span><span style="color:blue">Select </span>@MaxTT <span style="color:gray">= </span><span style="color:magenta">MAX</span><span style="color:gray">(</span>TrackTime<span style="color:gray">),
    </span>@MinTT <span style="color:gray">= </span><span style="color:magenta">MIN</span><span style="color:gray">(</span>TrackTime<span style="color:gray">)
</span><span style="color:blue">From </span>dbo<span style="color:gray">.</span>PerfMonData<span style="color:gray">;

</span><span style="color:green">-- Build list of all times between MIN and MAX
-- values in 5 second intervals
</span><span style="color:blue">With </span>TrackTime <span style="color:gray">(</span>TrackTime<span style="color:gray">)
</span><span style="color:blue">As </span><span style="color:gray">(</span><span style="color:blue">Select </span>@MinTT <span style="color:blue">As </span>TrackTime
    <span style="color:blue">Union </span><span style="color:gray">All
    </span><span style="color:blue">Select </span><span style="color:magenta">DateAdd</span><span style="color:gray">(</span>ss<span style="color:gray">, </span>5<span style="color:gray">, </span>TrackTime<span style="color:gray">) </span><span style="color:blue">As </span>TrackTime
    <span style="color:blue">From </span>TrackTime
    <span style="color:blue">Where </span>TrackTime <span style="color:gray">&lt; </span>@MaxTT
    <span style="color:gray">)
</span><span style="color:blue">Select </span>TT<span style="color:gray">.</span>TrackTime<span style="color:gray">, </span>PMD<span style="color:gray">.</span>TrackValue
<span style="color:blue">From </span>TrackTime TT
<span style="color:gray">Left Join </span>dbo<span style="color:gray">.</span>PerfMonData PMD <span style="color:blue">On </span>TT<span style="color:gray">.</span>TrackTime <span style="color:gray">= </span>PMD<span style="color:gray">.</span>TrackTime<span style="color:gray">;</span></pre>
<p><b>Final Results</b></p>
<table cellpadding=0 cellspacing=0 border=1>
<tr>
<td width=100 align=center><strong>TrackTime</strong></td>
<td width=100 align=center><strong>TrackValue</strong></td>
</tr>
<tr>
<td> 02:13:08</td>
<td> 0.150998</td>
</tr>
<tr>
<td> 02:13:13</td>
<td> 1.476516</td>
</tr>
<tr>
<td> 02:13:18</td>
<td> 0.094423</td>
</tr>
<tr>
<td> 02:13:23</td>
<td> NULL</td>
</tr>
<tr>
<td> 02:13:28</td>
<td> 0.724203</td>
</tr>
<tr>
<td> 02:13:33</td>
<td> 0.175526</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/includingmissingvaluesindatarangeswithoutalookuptable/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webcast: Putting a Better SQL Server in Production</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/puttingabettersqlserverinproduction</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/puttingabettersqlserverinproduction#comments</comments>
		<pubDate>Mon, 26 Dec 2011 19:01:57 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Idera ACE Program]]></category>
		<category><![CDATA[Performance & Optimization]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1475</guid>
		<description><![CDATA[Webcast: Putting a Better SQL Server in Production Webcast: Putting a Better SQL Server in Production Date: Wednesday, January 18, 2012 3:00 PM to 4:00 PM Eastern Time / 2:00 PM CT / 12:00 PM PT Problems come up everyday that could have been avoided by simply configuring SQL Server appropriately before using it. The...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">Webcast: Putting a Better SQL Server in Production</span></h2>
<p><div id="attachment_1476" class="wp-caption alignright" style="width: 210px"><a href="http://www.sqlsoldier.com/wp/wp-content/uploads/2011/12/robots.jpg" target="_blank"><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2011/12/robots-300x300.jpg" alt="Production Line" title="Production Line" width="200" height="200" class="size-medium wp-image-1476" /></a><p class="wp-caption-text">Production Line</p></div><br />
<strong>Webcast:</strong> <a href="https://www.vconferenceonline.com/event/regeventweb.aspx?id=479" target="_blank">Putting a Better SQL Server in Production</a><br />
<strong>Date:</strong> Wednesday, January 18, 2012 3:00 PM to 4:00 PM Eastern Time / 2:00 PM CT / 12:00 PM PT</p>
<p>Problems come up everyday that could have been avoided by simply configuring SQL Server appropriately before using it. The tricky part is knowing what to change and how to determine the correct setting. Some settings require knowledge of how SQL Server works internally and how the setting affects performance. We&#8217;ll take a look at the default settings in SQL Server that should be changed before a SQL Server is put into production and provide guidelines on how to determine the best settings with which to go into production.</p>
<p>If your process for putting a new SQL server into production looks like the below, then <a href="https://www.vconferenceonline.com/event/regeventweb.aspx?id=479" target="_blank">this webcast</a> is for you.</p>
<ol>
<li>Install SQL Server</li>
<li>Deploy</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/puttingabettersqlserverinproduction/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Dynamic Values in XMLA</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/usingdynamicvaluesinxmla</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/usingdynamicvaluesinxmla#comments</comments>
		<pubDate>Sun, 18 Dec 2011 23:23:25 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSAS & BI]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[XML in SQL]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1468</guid>
		<description><![CDATA[Using Dynamic Values in XMLA A question was raised on Twitter today via the #sqlhelp hash tag about passing parameter values to XMLA for a backup script. The popular answer at the time I saw it was to dynamiclly create and drop a SQL job to run the script every time you need it to...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">Using Dynamic Values in XMLA</span></h2>
<p><div id="attachment_1469" class="wp-caption alignright" style="width: 210px"><a href="http://www.sqlsoldier.com/wp/wp-content/uploads/2011/12/xmla.jpg" target="_blank"><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2011/12/xmla-300x225.jpg" alt="XMLA" title="XMLA" width="200" height="150" class="size-medium wp-image-1469" /></a><p class="wp-caption-text">XMLA</p></div><br />
A question was raised on Twitter today via the <a href="http://twitter.com/#!/search/%23sqlhelp" target="_blank">#sqlhelp</a> hash tag about passing parameter values to XMLA for a backup script. The popular answer at the time I saw it was to dynamiclly create and drop a SQL job to run the script every time you need it to run. I proposed a different solution,</p>
<h3>The Question</h3>
<p>The following request was sent in a series of tweets:</p>
<blockquote><p>Is there a way to pass variables between tsql and mdx queries within a sql job to automate #SSAS db backups. #sqlhelp</p>
<p>Correction: Is there a way to pass variables between tsql and XMLA queries within a sql job to automate #SSAS db backups. #sqlhelp</p>
<p>I have the tsql part working which creates the backup syntax, now I need it to execute the XMLA to perform the backups. #sqlhelp</p></blockquote>
<h3>My Proposed Solution</h3>
<p>As I stated above, the popular solution was to use dynamic SQL to have it create a job that runs the backup and then delete the job. In my session A DBAs Guide to Administering BI Systems at the PASS Summit 2011, I talked about executing MDX queries via T-SQL across a linked server. This approach works with XMLA as well. I simply need to use dynamic SQL to build the XMLA command and then execute it across the linked server. I set up a test to demonstrate how to do it before recommending it.</p>
<p>I started by using the SSMS GUI to script out the backup command for the <em>Adventure Works DW 2008R2</em> database in my local SSAS instance. I suspect that adding a date serial to the backup name is likely to be the reason for using this, that is the scenario I used. I then use the EXEC() AT command to execute the string across a linked server (named SSAS in my sample code).</p>
<pre class="code"><span style="color:blue">Declare </span>@XMLA <span style="color:blue">nvarchar</span><span style="color:gray">(</span>1000<span style="color:gray">),
    </span>@DateSerial <span style="color:blue">nvarchar</span><span style="color:gray">(</span>35<span style="color:gray">);

</span><span style="color:green">-- Change date to format YYYYMMDDHHMMSS
</span><span style="color:blue">Set </span>@DateSerial <span style="color:gray">= </span><span style="color:magenta">Convert</span><span style="color:gray">(</span><span style="color:blue">nvarchar</span><span style="color:gray">, </span><span style="color:magenta">getdate</span><span style="color:gray">(), </span>112<span style="color:gray">) +
        </span><span style="color:magenta">Replace</span><span style="color:gray">(</span><span style="color:magenta">Convert</span><span style="color:gray">(</span><span style="color:blue">nvarchar</span><span style="color:gray">, </span><span style="color:magenta">getdate</span><span style="color:gray">(), </span>108<span style="color:gray">), </span><span style="color:red">':'</span><span style="color:gray">, </span><span style="color:red">''</span><span style="color:gray">);

</span><span style="color:green">-- Create the XMLA string
</span><span style="color:blue">Set </span>@XMLA <span style="color:gray">= </span><span style="color:red">N'&lt;Backup xmlns="http://schemas.microsoft.com/analysisservices/2003/engine"&gt;
  &lt;Object&gt;
    &lt;DatabaseID&gt;Adventure Works DW 2008R2&lt;/DatabaseID&gt;
  &lt;/Object&gt;
  &lt;File&gt;c:\bak\Adventure Works DW 2008R2_' </span><span style="color:gray">+ </span>@DateSerial <span style="color:gray">+ </span><span style="color:red">'.abf&lt;/File&gt;
&lt;/Backup&gt;'</span><span style="color:gray">;

</span><span style="color:green">-- Execute the string across the linked server (SSAS)
</span><span style="color:blue">Exec </span><span style="color:gray">(</span>@XMLA<span style="color:gray">) </span>At SSAS<span style="color:gray">;
</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/usingdynamicvaluesinxmla/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Undocumented Gotchas of Transactional Replication</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/undocumentedgotchasoftransactionalreplication</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/undocumentedgotchasoftransactionalreplication#comments</comments>
		<pubDate>Sat, 17 Dec 2011 22:06:29 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[General Discussion]]></category>
		<category><![CDATA[Replication]]></category>
		<category><![CDATA[Undocumented Stuff]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1453</guid>
		<description><![CDATA[Undocumented Gotchas of Transactional Replication This discussion started on Twitter via the #sqlhelp hash tag. The question that was asked is, &#8220;What are the undocumented gotchas of Transactional Replication? #SQLHelp&#8221;. I responded with several things that came to mind. I thought these would be good to capture in a blog post and hopefully others would...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">Undocumented Gotchas of Transactional Replication</span></h2>
<div id="attachment_1454" class="wp-caption alignright" style="width: 210px"><a href="http://www.sqlsoldier.com/wp/wp-content/uploads/2011/12/gotcha.jpg"><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2011/12/gotcha-300x195.jpg" alt="Gotcha - Norelco commercial (1977)" title="Gotcha" width="200" height="130" class="size-full wp-image-1454" target="_blank" /></a><p class="wp-caption-text">Gotcha - Norelco commercial (1977)</p></div>
<p>This discussion started on Twitter via the <a href="http://twitter.com/#!/search/%23sqlhelp" target="_blank">#sqlhelp</a> hash tag. The <a href="http://twitter.com/#!/DBA_J/statuses/148110951156166656" target="_blank">question that was asked</a> is, &#8220;What are the undocumented gotchas of Transactional Replication? #SQLHelp&#8221;. I responded with several things that came to mind. I thought these would be good to capture in a blog post and hopefully others would contribute some more gotchas to the list.</p>
<p>If you can think of any other gotchas about any type of replication, not just transactional, please add it to a comment. Also, if you have a blog post on it, please include the link to the post. I&#8217;m getting the ball rolling with the ones I mentioned on Twitter.<br />
<br clear="all"></p>
<h3>Gotchas of Replication</h3>
<ul><strong>Transactional replication</strong></p>
<li>If you run the agent continuously, and it stops (fails), it won&#8217;t restart or raise an alert until the subscription expires.</li>
<li>If the agent is failing, it will retry forever and you may never notice it is failing unless you are monitoring closely.</li>
<li>If you add/remove an article using the GUI, it will regenerate the entire snapshot. Use TSQL to avoid this.</li>
<li>Where you place the distribution db is very important for performance and manageability. Plan this point very well.</li>
<li>Check the VLFs in your db log before configuring repl. as it can have a very high impact on performance of the log reader</li>
<li>Be wary of non-replicated trans that create lots of log records (eg, index maint.) as it affects log reader performance</li>
<li>DML ops. to LOB columns in repl. tables will fail if the length of value exceeds the &#8220;max text repl size (B)&#8221; setting.</li>
<li>Make sure you are testing deployments in repl. preprod. environ. so you aren&#8217;t surprised by related failures in Prod.</li>
<li>When the publication is mirrored. Transactions will not replicate until hardened on mirror, unless a trace flags used
<ul>
<li>Reported by John Sansom (<a href="http://www.johnsansom.com" target="_blank">blog</a>|<a href="http://twitter.com/#!/JohnSansom" target="_blank">@JohnSansom</a>)</li>
<li>John and Martin Cairns (<a href="http://sqlbyparts.com" target="_blank">blog</a>|<a href="http://twitter.com/#!/MartinCairnsSQL" target="_blank">@MartinCairnsSQL</a>) report that the whitepaper can be downloaded <a href="http://download.microsoft.com/download/d/9/4/d948f981-926e-40fa-a026-5bfcf076d9b9/ReplicationAndDBM.docx" target="_blank">here</a>.</li>
</ul>
</li>
<li>Log reader fails if it encounters blank (empty) XML in an XML column.
<ul>
<li>Reported and blogged by Kendall Van Dyke (<a href="http://www.kendalvandyke.com" target="_blank">blog</a>|<a href="http://twitter.com/#!/SQLDBA" target="_blank">@SQLDBA</a>) <a href="http://www.kendalvandyke.com/2010/08/replication-gotcha-blank-xml.html" target="_blank">here</a>.</li>
</ul>
</li>
<li>Including an article in multiple publications can lead to performance problems.
<ul>
<li>Reported and blogged by Kendall Van Dyke (<a href="http://www.kendalvandyke.com" target="_blank">blog</a>|<a href="http://twitter.com/#!/SQLDBA" target="_blank">@SQLDBA</a>) <a href="http://www.kendalvandyke.com/2010/08/replication-gotcha-including-article-in.html" target="_blank">here</a>.</li>
</ul>
</li>
<li>Altering articles to not replicate deletes may not be set on all articles as expected.
<ul>
<li>Reported and blogged by Kendall Van Dyke (<a href="http://www.kendalvandyke.com" target="_blank">blog</a>|<a href="http://twitter.com/#!/SQLDBA" target="_blank">@SQLDBA</a>) <a href="http://www.kendalvandyke.com/2008/12/hey-i-said-not-to-replicate-delete.html" target="_blank">here</a>.</li>
</ul>
</li>
</ul>
<ul><strong>Merge replication</strong></p>
<li>Changing conflict tracking level from row to column generates conflicts when different columns are updated
<ul>
<li>Reported and blogged by David Williams (<a href="http://www.sqlrepl.com/" target="_blank">blog</a>|<a href="http://twitter.com/#!/is_brandon" target="_blank">@is_brandon</a>) <a href="http://www.sqlrepl.com/sql-server/undocumented-gotcha-in-merge-replication-tracking/" target="_blank">here</a>.</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/undocumentedgotchasoftransactionalreplication/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PASS Data Arch. Virtual Chapter: Row Versioned Data Warehouses</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/rowversioneddatawarehouses</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/rowversioneddatawarehouses#comments</comments>
		<pubDate>Wed, 14 Dec 2011 17:03:19 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Data Architecture VC]]></category>
		<category><![CDATA[SQL PASS]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1448</guid>
		<description><![CDATA[PASS Data Arch. Virtual Chapter: Row Versioned Data Warehouses Subject: Row Versioned Data Warehouses Start Time: Thursday, December 15, 2011 6:00 PM US Pacific Time (December 16, 2011 2:00 AM GMT) End Time: Thursday, December 15, 2011 7:00 PM US Pacific Time (December 16, 2011 3:00 AM GMT) Presenter: Jeremy Huppatz&#160;(Blog&#124;@OzzieMedes) Live Meeting Link: https://www.livemeeting.com/cc/UserGroups/join?id=B77TSH&#38;role=attend&#38;pw=dGC-%3B88%275...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">PASS Data Arch. Virtual Chapter: Row Versioned Data Warehouses</span></h2>
<table border="0" cellspacing="0" cellpadding="4" align="left">
<tbody>
<tr>
<td><strong>Subject:</strong></td>
<td><strong>Row Versioned Data Warehouses</strong></td>
</tr>
<tr>
<td><strong>Start Time:</strong></td>
<td>Thursday, December 15, 2011 6:00 PM US Pacific Time (December 16, 2011 2:00 AM GMT)</td>
</tr>
<tr>
<td><strong>End Time:</strong></td>
<td>Thursday, December 15, 2011 7:00 PM US Pacific Time (December 16, 2011 3:00 AM GMT)</td>
</tr>
<tr>
<td><strong>Presenter:</strong></td>
<td>Jeremy Huppatz&#160;(<a href="http://ozziemedessql.blogspot.com/">Blog</a>|<a href="http://twitter.com/#!/ozziemedes">@OzzieMedes</a>)</td>
</tr>
<tr>
<td><strong>Live Meeting Link:</strong></td>
<td>
<p><a target="_blank" href="https://www.livemeeting.com/cc/UserGroups/join?id=B77TSH&amp;role=attend&amp;pw=dGC-%3B88%275">https://www.livemeeting.com/cc/UserGroups/join?id=B77TSH&amp;role=attend&amp;pw=dGC-%3B88%275</a></p>
</td>
</tr>
<tr>
<td colspan="2"><strong>Row Versioned Data Warehouses</strong><br />
            Jeremy will discuss the strengths and disadvantages of a row-versioned data warehouse design in the context of a real world case study, sharing lessons learnt and demonstrating some of the technologies and techniques used to build a row-versioned data warehouse. He will discuss row-versioning in the context of Kimball slowly-changing dimensions, and will also provide some details on the relative strengths of row-versioning as applied to measure information in situations where such data cannot be considered finalized at the time it is loaded into the warehouse.</td>
</tr>
<tr>
<td colspan="2">
<p><strong>Jeremy Huppatz</strong><br />
            Jeremy has been a SQL Server data guy going back as far as 1997. During his 14 years working with Microsoft’s flagship database, he has filled the roles of DBA, data modeller, database designer, data analyst, BI developer and data architect in a multitude of projects, which have included departmental database apps, enterprise data warehouses and a bit of just about everything in between. Jeremy now runs his own IT consulting firm called Solitaire Systems and lives in the scenic Adelaide Hills with his partner Alison and her cat. He also plays, writes and records music and writes in his spare time, and has been described optimistically as an avid (as opposed to obsessive) computer gamer.</p>
</td>
</tr>
<tr>
<td valign="top" colspan="2">&#160;<a href="/LinkClick.aspx?fileticket=GLc6oDpMtkE%3d&amp;tabid=2429"><img border="0" hspace="4" alt="Add to calendar" width="35" height="15" src="http://dataarch.sqlpass.org/Portals/71/ical.jpg" />Add to calendar&#160;</a></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/rowversioneddatawarehouses/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PASS Data Arch. Virtual Chapter: On beyond Zebra AdventureWorks OR where did I go wrong?</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/pass-data-arch-virtual-chapter-on-beyond-zebra-adventureworks-or-where-did-i-go-wrong</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/pass-data-arch-virtual-chapter-on-beyond-zebra-adventureworks-or-where-did-i-go-wrong#comments</comments>
		<pubDate>Tue, 15 Nov 2011 18:56:00 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Data Architecture VC]]></category>
		<category><![CDATA[SQL PASS]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1444</guid>
		<description><![CDATA[PASS Data Arch. Virtual Chapter: On beyond Zebra AdventureWorks OR where did I go wrong? Subject: On beyond Zebra AdventureWorks or where did I go wrong? Level: 200 (Intermediate) Start Time: Thursday, November 17, 2011 8:00 PM US Eastern Time (November 18, 2011 1:00 AM GMT) End Time: Thursday, November 17, 2011 9:00 PM US...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">PASS Data Arch. Virtual Chapter: On beyond Zebra AdventureWorks OR where did I go wrong?</span></h2>
<table border="0" cellspacing="0" cellpadding="4" align="left">
<tbody>
<tr>
<td><strong>Subject:</strong></td>
<td><strong>On beyond Zebra AdventureWorks or where did I go wrong?</strong></td>
</tr>
<tr>
<td><strong>Level:</strong></td>
<td>200 (Intermediate)</td>
</tr>
<tr>
<td><strong>Start Time:</strong></td>
<td>Thursday, November 17, 2011 8:00 PM US Eastern Time (November 18, 2011 1:00 AM GMT)</td>
</tr>
<tr>
<td><strong>End Time:</strong></td>
<td>Thursday, November 17, 2011 9:00 PM US Eastern Time (November 18, 2011 2:00 AM GMT)</td>
</tr>
<tr>
<td><strong>Presenter:</strong></td>
<td>Steve Simon (<a href="http://www.linkedin.com/in/stephenrsimon">LinkedIn</a>)</td>
</tr>
<tr>
<td><strong>Live Meeting Link:</strong></td>
<td>
<p><a target="_blank" href="https://www.livemeeting.com/cc/UserGroups/join?id=K32S7T&amp;role=attend&amp;pw=q%3Fp4cW%24Mg">https://www.livemeeting.com/cc/UserGroups/join?id=K32S7T&amp;role=attend&amp;pw=q%3Fp4cW%24Mg</a></p>
</td>
</tr>
<tr>
<td colspan="2"><strong>On beyond Zebra AdventureWorks OR where did I go wrong?</strong><br />
            No matter how well planned and executed, the data structures of any data warehouse oft times eventually land up resembling something out of a Dr. Seuss book. In this presentation we shall be looking at and discussing a few of the “perfect” data structures (that I have inherited) and discussing the flaws that have only recently surfaced. We shall be looking at the ‘before’, discussing a few alternatives to make these structure more efficient and effective, then we shall then look at final “production structure” and the resulting improvement metrics; all of which help us to help our clients’ make better decisions in a timely manner.</td>
</tr>
<tr>
<td colspan="2">
<p><strong>Steve Simon</strong><br />
            Steve Simon is a Senior Business Intelligence Engineer with MyWebGrocer in Burlington Vermont. He has been involved with database design and analysis for over 26 years. Steve has presented papers at eight North American PASS Summits (in Orlando, Seattle WA (4), Denver CO (2) and San Francisco CA), two at PASS Europe 2009 and one at PASS Europe 2010. He has just recently presented at the Johannesburg and Cape Town SQL Server Saturdays.</p>
<p>Steve is actively involved with the SQL Server community within the Boston area and is a regular presenter at the New England Code Camps and SQL Saturday events and participates actively on many of the Microsoft User Forums. He is also the Virtual Chapter leader of the Professional Association for SQL Server (PASS) Oracle – SQL Server Virtual Chapter and is a PASS regional mentor.</p>
<p>Steve has also presented papers at the Information Builders&#8217; International Technology Summits ( in New Orleans (1998), in Orlando (1999), Las Vegas (2007), two in Nashville (2008), one in Nashville (2009), one in Orlando 2010 and will be presenting a paper at the 2011 Summit in Dallas TX).</p>
<p>Steve has also had two papers published in Information Builders&#8217; Systems Journal, is the chairman of the Boston User Forum and is a regular User Forum and Webinar presenter for Information Builders.</p>
</td>
</tr>
<tr>
<td valign="top" colspan="2"><a href="http://dataarch.sqlpass.org/LinkClick.aspx?fileticket=o_bNX_f_Xgc%3d&#038;tabid=2429"><img border="0" hspace="4" alt="Add to calendar" width="35" height="15" src="http://dataarch.sqlpass.org/Portals/71/ical.jpg" />Add to calendar</a></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/pass-data-arch-virtual-chapter-on-beyond-zebra-adventureworks-or-where-did-i-go-wrong/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T-SQL Tuesday #024 – Using SYSTEMRESTRICTSCHEMA Function in MDX to Query DMVs</title>
		<link>http://www.sqlsoldier.com/wp/sqlserver/usingsystemrestrictschemafunctioninmdxtoquerydmvs</link>
		<comments>http://www.sqlsoldier.com/wp/sqlserver/usingsystemrestrictschemafunctioninmdxtoquerydmvs#comments</comments>
		<pubDate>Tue, 08 Nov 2011 23:40:31 +0000</pubDate>
		<dc:creator>SQLSoldier</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Dynamic Management Views]]></category>
		<category><![CDATA[SSAS & BI]]></category>
		<category><![CDATA[T-SQL Tuesday]]></category>

		<guid isPermaLink="false">http://www.sqlsoldier.com/wp/?p=1439</guid>
		<description><![CDATA[T-SQL Tuesday #024 &#8211; Using SYSTEMRESTRICTSCHEMA Function in MDX to Query DMVs This blog entry is participating in T-SQL Tuesday #024, hosted this month by Brad Schulz (Blog). You are invited to visit his blog to join the blog party. You are welcome to write your own participating blog post for the party or just...]]></description>
			<content:encoded><![CDATA[<h2><span style="color: #4f81bd;">T-SQL Tuesday #024 &#8211; Using SYSTEMRESTRICTSCHEMA Function in MDX to Query DMVs</span></h2>
<p><a href="http://bradsruminations.blogspot.com/2011/10/invitation-for-t-sql-tuesday-024-prox-n.html" target="_blank"><img class="alignright" style="border: 0px;" src="http://4.bp.blogspot.com/_vPa0QtSASSk/TA7I6cjiCrI/AAAAAAAAAYg/Rj8BKsFDao0/s400/tsqltuesday.jpg" border="0" alt="TSQLTuesday" width="150" height="150" align="left" /></a></p>
<p>This blog entry is participating in <a href="http://bradsruminations.blogspot.com/2011/10/invitation-for-t-sql-tuesday-024-prox-n.html" target="_new">T-SQL Tuesday #024</a>, hosted this month by Brad Schulz (<a href="http://bradsruminations.blogspot.com/" target="_blank">Blog</a>). You are invited to visit <a href="http://bradsruminations.blogspot.com/2011/10/invitation-for-t-sql-tuesday-024-prox-n.html" target="_blank">his blog</a> to join the blog party. You are welcome to write your own participating blog post for the party or just to read more blogs participating in this month’s theme: Prox ‘n’ Funx.</p>
<p>For my part in this month&#8217;s blog party, I&#8217;m going to write about the performance counters DMV in SSAS. Yes, that&#8217;s right. I said SSAS. There are DMVs in Analysis Services too!</p>
<h3>$system.discover_performance_counters</h3>
<p>DMVs in Analysis Services can be queried directly using MDX or XMLA. it can also be queried via T-SQL by using a linked server to the SSAS engine. Personally, I prefer to use MDX. One of the most useful DMVs for a DBA is $system.discover_performance_counters. This DMV is the is not documented in Books Online like the other discover DMVs. This DMV cannot be queried directly like most DMVs. You must use the SYSTEMRESTRICTSCHEMA function.</p>
<p>Attempting to query this DMV directly will give teh following error:</p>
<pre class="code"><span style="color:green">-- Will not work
</span><span style="color:blue">Select </span>*
<span style="color:blue">From </span>$system.discover_performance_counters
<span style="color:blue">Where </span>PERF_COUNTER_NAME = '\MSAS 2008:Connection\Current connections';</pre>
<pre class="code">Executing the query ...
Obtained object of type: Microsoft.AnalysisServices.AdomdClient.AdomdDataReader
Errors from the SQL query module: The 'PERF_COUNTER_NAME' restriction is required but is missing from the request.  Consider using SYSTEMRISTRICTSCHEMA to provide restrictions.

Execution complete</pre>
<p>As the error states, you have to use the SYSTEMRISTRICTSCHEMA function. The following query works:</p>
<pre class="code"><span style="color:green">-- Query cCurrent connections
</span><span style="color:blue">Select </span>*
<span style="color:blue">From </span>SYSTEMRESTRICTSCHEMA(
    $SYSTEM.DISCOVER_PERFORMANCE_COUNTERS,
    PERF_COUNTER_NAME = '\MSAS 2008:Connection\Current connections'
);</pre>
<p>Unfortunately, there is no way to have the DMV return all performance counters. you have to tell it explicitly whihc counters to return. You can request multiple performance counters in a single query by supplying multiple counter names one at a time. </p>
<pre class="code"><span style="color:green">-- Query multiple perf counters
</span><span style="color:blue">Select </span>*
<span style="color:blue">From </span>SYSTEMRESTRICTSCHEMA(
    $SYSTEM.DISCOVER_PERFORMANCE_COUNTERS,
    PERF_COUNTER_NAME = '\MSAS 2008:Threads\Processing Pool Idle Threads',
    PERF_COUNTER_NAME = '\MSAS 2008:Threads\Processing Pool Busy Threads',
    PERF_COUNTER_NAME = '\MSAS 2008:Cache\Current KB',
    PERF_COUNTER_NAME = '\MSAS 2008:Connection\Current connections'
);</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<div id="attachment_1441" class="wp-caption alignnone" style="width: 454px"><img src="http://www.sqlsoldier.com/wp/wp-content/uploads/2011/11/SSASPerfCounters.jpg" alt="SSAS Perf Counters" title="SSAS Perf Counters" width="444" height="128" class="size-full wp-image-1441" /><p class="wp-caption-text">SSAS Perf Counters</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sqlsoldier.com/wp/sqlserver/usingsystemrestrictschemafunctioninmdxtoquerydmvs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

