<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblogcasts.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Steve Hindmarsh&amp;#39;s SQL Blog</title><link>http://sqlblogcasts.com/blogs/steveh/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>SSAS - What is running ? </title><link>http://sqlblogcasts.com/blogs/steveh/archive/2011/12/15/ssas-what-is-running.aspx</link><pubDate>Thu, 15 Dec 2011 13:04:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:16026</guid><dc:creator>steveh99999</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=16026</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2011/12/15/ssas-what-is-running.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I saw a tweet today from respected blogger&lt;a title="John Sampson" href="http://www.johnsansom.com/"&gt; john sansom&lt;/a&gt;&amp;nbsp;asking how a SQL DBA should attempt to performance tune SSAS.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve been through a similar scenario - and one of the tools I developed as&amp;nbsp;part of my troubleshooting&amp;nbsp;was my own &amp;#39;SSAS version&amp;#39; of sp_who.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve written a stored procedure which I&amp;nbsp;run on a SQL Server instance, that connects to an SSAS instance via a linked server, I then&amp;nbsp;wrote an SSRS report to use this stored proc to allow developers and support staff access to SSAS cube activity.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;It&amp;#39;s quite a basic/simple solution but it does help expose what is running - I must say on a fairly&amp;nbsp;low-use SSAS server. I don&amp;#39;t know how well this scales on a heavily used SSAS implementation.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To add an SSAS &amp;nbsp;linked server first of all to your SQL Server..&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;EXEC&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;master&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;dbo&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;sp_addlinkedserver&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;@server &lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;N&amp;#39;SSAS_LINKED_SERVER&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; @provider&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;N&amp;#39;MSOLAP&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; @datasrc&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;N&amp;#39;ISSAS ServerName&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;EXEC&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;master&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;dbo&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;sp_addlinkedsrvlogin&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;@rmtsrvname&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;N&amp;#39;SSAS_LINKED_SERVER&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;@useself&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;N&amp;#39;False&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;@locallogin&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=NULL,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;@rmtuser&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;N&amp;#39;Account to run command via&amp;#39;&amp;nbsp;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;@rmtpassword&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;########&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then I created a stored procedure :-&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;CREATE&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;PROC&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [dbo]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;[SSAS_whoIsActive]&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;BEGIN&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;SELECT&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ssasSessions&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SESSION_SPID &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [SPID]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;ssasSessions&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SESSION_USER_NAME &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [User ID]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;ssasSessions&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SESSION_CURRENT_DATABASE &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [Database]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;ssasConnections&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;connection_host_name &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;Client IP address&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff00ff" size="2"&gt;&lt;font color="#ff00ff" size="2"&gt;
&lt;p&gt;ROUND&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff00ff" size="2"&gt;&lt;font color="#ff00ff" size="2"&gt;CAST&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;ssasCommands&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;COMMAND_CPU_TIME_MS &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;)/&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;1000&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 2&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [Command Time(in sec)]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;ssasCommands&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;COMMAND_START_TIME &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [Command Start Time]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;ssasCommands&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;COMMAND_END_TIME &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [Command End Time]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;ssasCommands&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;COMMAND_TEXT &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [MDX Command]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;connection_host_application &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;Application&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#ff00ff" size="2"&gt;&lt;font color="#ff00ff" size="2"&gt;CHARINDEX&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;&amp;lt;/Process&amp;gt;&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;ssasCommands&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;COMMAND_TEXT&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ProcessRunning&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;FROM&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;OPENQUERY&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SSAS_LINKED_SERVER&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;select * from $system.discover_sessions&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ssasSessions&lt;/p&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;
&lt;p&gt;LEFT&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;JOIN&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;OPENQUERY&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SSAS_LINKED_SERVER&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;select * from $system.discover_commands&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ssasCommands &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ON&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ssasSessions&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SESSION_SPID &lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ssasCommands&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SESSION_SPID&lt;/p&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;
&lt;p&gt;LEFT&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;JOIN&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;OPENQUERY&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SSAS_LINKED_SERVER&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;select * from $system.discover_connections&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;AS&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ssasConnections &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ON&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ssasSessions&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;SESSION_connection_id &lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ssasConnections&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;connection_id&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ORDER&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;BY&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; [Command Start Time] &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;DESC&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; 
&lt;p&gt;END&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;I use the &amp;#39;ProcessRunning&amp;#39; column to idenitfy if a cube process command is running, and then display this MDX command in a different colour (red) in my report.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This can be done by adding an expression to the&amp;nbsp;report &amp;#39;MDX Command&amp;#39; text box properties.&amp;nbsp;&amp;nbsp;=IIF(Fields!ProcessRunning.Value &amp;gt; 0, &amp;quot;Red&amp;quot;, &amp;quot;Black&amp;quot;)&lt;/p&gt;
&lt;p&gt;The MDX command column can sometimes be very large&amp;nbsp;in this report output&amp;nbsp;- it can be quite a shock for a DBA to see how complicated MDX generated by SSAS sometimes can be ! I usually change the font size on this output column to be 8pt.&lt;/p&gt;
&lt;p&gt;Note my sproc is named in honour of the famous sp_whoIsActive written by &lt;a title="Adam Machanic" href="http://sqlblog.com/blogs/adam_machanic/default.aspx"&gt;Adam Machanic&lt;/a&gt;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=16026" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/performance/default.aspx">performance</category><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/SSAS/default.aspx">SSAS</category></item><item><title>Auto Update Stats change in SQL 2008 R2 sp 1</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2011/09/13/auto-update-stats-change-in-sql-2008-r2-sp-1.aspx</link><pubDate>Tue, 13 Sep 2011 11:43:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:15882</guid><dc:creator>steveh99999</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=15882</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2011/09/13/auto-update-stats-change-in-sql-2008-r2-sp-1.aspx#comments</comments><description>&lt;p&gt;I came across a &lt;a href="http://blogs.msdn.com/b/saponsqlserver/archive/2011/09/07/changes-to-automatic-update-statistics-in-sql-server-traceflag-2371.aspx?"&gt;very interesting post&lt;/a&gt; via Brent Ozar’s weekly news email – ( I strongly recommend you go to&amp;nbsp; &lt;a href="http://www.brentozar.com/"&gt;Brent&amp;#39;s excellent website&lt;/a&gt; and subscribe to the weekly update) &lt;/p&gt;  &lt;p&gt;The post states that a new trace flag had been made available in SQL 2008 R2 sp1 to change auto-update stats behaviour.&amp;nbsp; Using the new 2371 trace flag, SQL Server will now run auto-update-stats much more aggressively. ie at a much lower threshold than the previous default of 20% change.&lt;/p&gt;  &lt;p&gt;Although this post relates to SAP – I think for many SQL DBAs this could be a very relevant trace flag. I have certainly encountered many situations where this would have been a useful option.&lt;/p&gt;  &lt;p&gt;I also hope Microsoft consider introducing this for SQL 2008 ?&lt;/p&gt;  &lt;p&gt;As always, any change to a production SQL Server needs to be well-tested before deploying – but this does look worthy of further investigation…&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=15882" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/performance/default.aspx">performance</category><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/trace+flags/default.aspx">trace flags</category><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/sql+2008+r2/default.aspx">sql 2008 r2</category></item><item><title>Denali / SSAS Free Training in Reading–Expedition Denali workshop</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2011/06/07/denali-ssas-free-training-in-reading-expedition-denali-workshop.aspx</link><pubDate>Tue, 07 Jun 2011 09:13:30 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:15688</guid><dc:creator>steveh99999</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=15688</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2011/06/07/denali-ssas-free-training-in-reading-expedition-denali-workshop.aspx#comments</comments><description>&lt;p&gt;I came across&amp;#160; &lt;a href="https://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-GB&amp;amp;EventID=1032486549&amp;amp;IO=mwvyQq%2bPZaumMAp%2bZgKTkg%3d%3d"&gt;this&lt;/a&gt; Microsoft Training event being held in Reading at the end of June – sounds excellent….&amp;#160; 2 days free, intensive training !&lt;/p&gt;  &lt;p&gt;Hope to see you there..&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=15688" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/training/default.aspx">training</category></item><item><title>Do you send output from sys.dm_exec_query_stats to your developers ?</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2011/03/22/do-you-send-output-from-sys-dm-exec-query-stats-to-your-developers.aspx</link><pubDate>Tue, 22 Mar 2011 00:10:22 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:15507</guid><dc:creator>steveh99999</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=15507</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2011/03/22/do-you-send-output-from-sys-dm-exec-query-stats-to-your-developers.aspx#comments</comments><description>&lt;p&gt;A few years ago, I had the good fortune to work on an engagement with Kevin McPherrin of Microsoft. Kevin is one of those Microsoft employees that you never hear about, but is an absolute expert on DBA good-practice and SQL advice. &lt;/p&gt;  &lt;p&gt;One really useful tip he gave me was to regularly run reports on my production servers, to email details of heavily-used and badly performing stored procedures to your developers… the DMV &lt;a href="http://msdn.microsoft.com/en-us/library/ms189741.aspx"&gt;sys.dm_exec_query_stats&lt;/a&gt; can be queried for this summary information.&lt;/p&gt;  &lt;p&gt;Now, I send out reports every night, using SSRS, such as this :-&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblogcasts.com/blogs/steveh/image_5D6DB8F5.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px 5px 5px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblogcasts.com/blogs/steveh/image_thumb_0E20C0A1.png" width="832" height="309" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;See how often ‘proc A’ is run – and also that the oldest entry in procedure cache is only 6 hours old…&lt;/p&gt;  &lt;p&gt;Using this information, developers can focus their attention on optimising the most heavily-used stored procedures in a system.&lt;/p&gt;  &lt;p&gt;The query used to produce this report can easily be altered to show what procedures use the most CPU…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblogcasts.com/blogs/steveh/image_794EC820.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px 5px 5px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblogcasts.com/blogs/steveh/image_thumb_0A52F604.png" width="835" height="340" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Interestingly now that although stored procedure A is run over 25 million timesin 5 and a half hours – there are other stored procedures that use a lot more CPU.&lt;/p&gt;  &lt;p&gt;For example, Proc H uses more CPU, even though it has only been run 32 times. And note the CPU usage from this proc only relates to the last hour and a half..&lt;/p&gt;  &lt;p&gt;I find these reports are excellent for focusing developer attention on production problems.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The SQL used to produce a report of procedures using the highest average logical IO per execution :-&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;SELECT&amp;#160; TOP 20 RANK() OVER(ORDER BY&amp;#160; (&lt;font color="#ff0000"&gt;qs.total_logical_reads + qs.total_logical_writes) /qs.execution_count&lt;/font&gt; desc) AS &amp;#39;Rank&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.execution_count AS &amp;#39;Executions&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.last_execution_time,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.max_elapsed_time/1000 AS &amp;#39;Max Duration ms&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.total_elapsed_time/1000 AS &amp;#39;Total Duration ms&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; (qs.total_elapsed_time/(qs.execution_count*1000)) AS [Avg Duration ms],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.total_worker_time/1000 AS &amp;#39;Total CPU ms&amp;#39;, (qs.total_worker_time/(qs.execution_count*1000)) AS &amp;#39;Avg CPU ms&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.max_worker_time/1000 AS &amp;#39;Max CPU ms&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.total_logical_reads + qs.total_physical_reads AS &amp;#39;Total Reads&amp;#39;, qs.total_logical_writes AS &amp;#39;TotalWrites&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; (qs.total_logical_reads + qs.total_logical_writes) /qs.execution_count AS [Avg IO],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.max_logical_reads AS &amp;#39;Max logical reads&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.max_logical_writes AS &amp;#39;Max logical writes&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SUBSTRING(qt.text,qs.statement_start_offset/2,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; (CASE WHEN qs.statement_end_offset = -1     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; THEN LEN(CONVERT(nvarchar(MAX), qt.text)) * 2     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ELSE qs.statement_end_offset END -qs.statement_start_offset)/2)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; AS query_text,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; dbname=DB_NAME(qt.dbid),     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OBJECT_NAME(qt.objectid,qt.dbid) AS &amp;#39;object&amp;#39;,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; qs.creation_time AS &amp;#39;plan creation time&amp;#39;     &lt;br /&gt;FROM sys.dm_exec_query_stats qs     &lt;br /&gt;CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt     &lt;br /&gt;WHERE object_name(qt.objectid,qt.dbid) IS NOT NULL     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Change the text in red to produce a report based on a different order.&lt;/p&gt;  &lt;p&gt;I usually include 4 subreports in one email :-&lt;/p&gt;  &lt;p&gt;- top 20 most executed stored procedures.&lt;/p&gt;  &lt;p&gt;- top 20 highest total CPU stored procedures.&lt;/p&gt;  &lt;p&gt;- top 20 highest average logical IOs stored procedures.&lt;/p&gt;  &lt;p&gt;- top 20 highest maximum duration stored procedures.&lt;/p&gt;  &lt;p&gt;Be aware of the limitations of the sys.dm_exec_query_stats view – for example, it only reports on stored procedures with plans still in cache – but I find this a cheap and easy way of exposing production performance data to a wider audience.&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=15507" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/performance/default.aspx">performance</category></item><item><title>The Exceptional EXCEPT clause</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2011/02/02/the-exceptional-except-clause.aspx</link><pubDate>Wed, 02 Feb 2011 23:03:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:15331</guid><dc:creator>steveh99999</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=15331</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2011/02/02/the-exceptional-except-clause.aspx#comments</comments><description>&lt;p&gt;Ok, I exaggerate, but it can be useful…&lt;/p&gt;
&lt;p&gt;I came across some ‘poorly-written’ stored procedures on a SQL server recently, that were using sp_xml_preparedocument. &lt;/p&gt;
&lt;p&gt;Unfortunately these procs were&amp;nbsp; not properly removing the memory allocated to XML structures – ie they were not subsequently calling sp_xml_removedocument…&lt;/p&gt;
&lt;p&gt;I needed a quick way of identifying on the server how many stored procedures this affected..&lt;/p&gt;
&lt;p&gt;Here’s what I used..&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#ff0000"&gt;EXEC sp_msforeachdb &amp;#39;USE ? &lt;br /&gt;SELECT DB_NAME(),OBJECT_NAME(s1.id) &lt;br /&gt;FROM syscomments s1 &lt;br /&gt;WHERE [text] LIKE &amp;#39;&amp;#39;%sp_xml_preparedocument%&amp;#39;&amp;#39; &lt;br /&gt;EXCEPT &lt;br /&gt;SELECT DB_NAME(),OBJECT_NAME(s2.id) &lt;br /&gt;FROM syscomments s2 &lt;br /&gt;WHERE [text] LIKE &amp;#39;&amp;#39;%sp_xml_removedocument%&amp;#39;&amp;#39; ‘&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#333333"&gt;There’s three nice features about the code above…&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;1. It uses sp_msforeachdb. There’s a nice blog on this statement &lt;a href="http://www.sqlservercurry.com/2009/04/6-common-uses-of-undocumented-stored.html"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2. It uses the EXCEPT clause.&amp;nbsp; So in the above query I get all the procedures which include the sp_xml_preparedocument string, but by using the EXCEPT clause I remove all the procedures which contain sp_xml_removedocument.&amp;nbsp; Read more about EXCEPT &lt;a href="http://msdn.microsoft.com/en-us/library/ms188055.aspx"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;3. It can be used to quickly identify incorrect usage of sp_xml_preparedocument. Read more about this &lt;a href="http://msdn.microsoft.com/en-us/library/ms187367.aspx"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The above query isn’t perfect – I’m not properly parsing the SQL text to ignore comments for example - but for the quick analysis I needed to perform, it was just the job…&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=15331" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/scripts/default.aspx">scripts</category><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/sql+2005/default.aspx">sql 2005</category></item><item><title>Free Microsoft one day BI Seminar in Reading</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2011/01/27/free-microsoft-one-day-bi-seminar-in-reading.aspx</link><pubDate>Thu, 27 Jan 2011 13:18:52 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:15296</guid><dc:creator>steveh99999</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=15296</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2011/01/27/free-microsoft-one-day-bi-seminar-in-reading.aspx#comments</comments><description>&lt;p&gt;A colleague passed details of &lt;a href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032475056&amp;amp;Culture=en-GB"&gt;this event&lt;/a&gt; on to me this morning. Sounds interesting…&lt;/p&gt;  &lt;p&gt;Free, so if you are interested, register quickly – I imagine this will soon fill up….&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=15296" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/training/default.aspx">training</category></item><item><title>The overlooked OUTPUT clause</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2011/01/17/the-overlooked-output-clause.aspx</link><pubDate>Mon, 17 Jan 2011 22:01:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:15249</guid><dc:creator>steveh99999</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=15249</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2011/01/17/the-overlooked-output-clause.aspx#comments</comments><description>&lt;p&gt;I often find myself applying ad-hoc data updates to production systems – usually running scripts written by other people. One of my favourite features of SQL syntax is the OUTPUT clause – I find this is rarely used, and I often wonder if this is due to a lack of awareness of this feature..&lt;/p&gt;
&lt;p&gt;The OUTPUT clause was added to SQL Server in the SQL 2005 release – so has been around for quite a while now, yet I often see scripts like this…&lt;/p&gt;
&lt;p&gt;SELECT somevalue FROM sometable WHERE keyval = XXX&lt;/p&gt;
&lt;p&gt;UPDATE sometable&lt;/p&gt;
&lt;p&gt;SET somevalue = newvalue&lt;/p&gt;
&lt;p&gt;WHERE keyval = XXX&lt;/p&gt;
&lt;p&gt;-- now check the update has worked…&lt;/p&gt;
&lt;p&gt;SELECT somevalue FROM sometable WHERE keyval = XXX&lt;/p&gt;
&lt;p&gt;This can be rewritten to achieve the same end-result using the OUTPUT clause. &lt;/p&gt;
&lt;p&gt;UPDATE sometable&lt;/p&gt;
&lt;p&gt;SET somevalue = newvalue&lt;/p&gt;
&lt;p&gt;OUTPUT deleted.somevalue AS ‘old value’,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;inserted.somevalue AS ‘new value’&lt;/p&gt;
&lt;p&gt;WHERE keyval = XXX&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;Update statement with output clause also requires less IO - ie I&amp;#39;ve replaced three SQL Statements with one,&amp;nbsp;using only a third of the IO.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are not aware of the power of the output clause – I recommend you look at &lt;a href="http://msdn.microsoft.com/en-gb/library/ms177564(v=SQL.100).aspx"&gt;the output clause in books online&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And finally here’s an example of the output produced using the Northwind database…&lt;/p&gt;
&lt;p&gt;&lt;img border="0" alt="" src="http://sqlblogcasts.com/blogs/steveh/output%20clause.png" width="768" height="480" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-gb/library/ms177564(v=SQL.100).aspx"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=15249" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/scripts/default.aspx">scripts</category><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/sql+2005/default.aspx">sql 2005</category></item><item><title>SQL 2005 Transaction Rollback Hung–unresolved deadlock</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2010/12/14/sql-2005-transaction-rollback-hung-unresolved-deadlock.aspx</link><pubDate>Tue, 14 Dec 2010 17:53:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:15151</guid><dc:creator>steveh99999</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=15151</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2010/12/14/sql-2005-transaction-rollback-hung-unresolved-deadlock.aspx#comments</comments><description>&lt;p&gt;Encountered an interesting issue recently with a SQL 2005 sp3 Enterprise Edition system.&lt;/p&gt;  &lt;p&gt;Every weekend, a full database reindex was being run on this system – normally this took around one and a half hours.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Then, one weekend, the job ran for over 17 hours&amp;#160; - and had yet to complete...&lt;/p&gt;  &lt;p&gt;At this point, DBA cancelled the job. Job status is now cancelled – issue over…&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;However, cancelling the job had not killed the reindex transaction – DBCC OPENTRAN was still showing the transaction being open. &lt;/p&gt;  &lt;p&gt;The oldest open transaction in the database was now over 17 hours old.&amp;#160; Consequently, transaction log % used growing dramatically and locks still being held in the database...&lt;/p&gt;  &lt;p&gt;Further attempts to kill the transaction did nothing. ie we had a transaction which could not be killed. &lt;/p&gt;  &lt;p&gt;In sysprocesses, it was apparent the SPID was in rollback status, but the spid was not accumulating CPU or IO. Was the SPID stuck ?&lt;/p&gt;  &lt;p&gt;On examination of the SQL errorlog – shortly after the reindex had started, a whole bunch of deadlock output had been produced by trace flag 1222. Then this :-&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff"&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ***Stack Dump being sent to&amp;#160;&amp;#160; xxxxxxx\SQLDump0042.txt      &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * *******************************************************************************       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; *       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * BEGIN STACK DUMP:       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; *&amp;#160;&amp;#160; 12/05/10 01:04:47 spid 5       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; *       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * &lt;font color="#ff0000"&gt;Unresolved deadlock&lt;/font&gt;       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; *       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; *&amp;#160;&amp;#160; &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * *******************************************************************************       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * -------------------------------------------------------------------------------       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * Short Stack Dump       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Stack Signature for the dump is 0x000001D7       &lt;br /&gt;spid5s&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; External dump process return code 0x20000001.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Unresolved deadlock – don’t think I’ve ever seen one of these before…. &lt;/p&gt;  &lt;p&gt;A quick call to Microsoft support confirmed the following bug had been hit :- &lt;a title="http://support.microsoft.com/kb/961479" href="http://support.microsoft.com/kb/961479"&gt;http://support.microsoft.com/kb/961479&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So, only option to get rid of the hung spid – to restart SQL Server…&lt;/p&gt;  &lt;p&gt;Fortunately SQL Server restarted without any issues. I was pleasantly surprised to see that recovery on this particular database was fast. However, restarting SQL Server to fix an issue is not something I would normally rush to do...&lt;/p&gt;  &lt;p&gt;Short term fix – the reindex was changed to use MAXDOP of 1. Longer term fix will be to apply the correct CU, or wait for SQL 2005 sp 4 ?? This should be released any day soon I hope..&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=15151" width="1" height="1"&gt;</description></item><item><title>Outlying DBAs</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2010/12/07/outlying-dbas.aspx</link><pubDate>Tue, 07 Dec 2010 22:45:06 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:15141</guid><dc:creator>steveh99999</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=15141</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2010/12/07/outlying-dbas.aspx#comments</comments><description>&lt;p&gt;Read an interesting book recently, ‘Outliers – the story of success’ by Malcolm Gladwell.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblogcasts.com/blogs/steveh/image_7A78957A.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblogcasts.com/blogs/steveh/image_thumb_200212DC.png" width="168" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;There’s a good synopsis of the book &lt;a href="http://en.wikipedia.org/wiki/Outliers_(book)"&gt;here&lt;/a&gt; on wikipedia.&lt;/p&gt;    &lt;p&gt;I don’t want to write in detailed review of the book, but it’s well worth a read. There were a couple of sections which I thought were possibly relevant to IT professionals and DBAs in particular.&lt;/p&gt;  &lt;p&gt;Firstly, ‘the 10,000 hour rule’, in this section Gladwell asserts that to be a real ‘elite performer’ takes 10,000 hours of practice. &lt;/p&gt;  &lt;p&gt;‘Practice isn’t the thing you do once you’re good, it’s the thing you do that makes you good’.&amp;#160; He gives many interesting examples – the Beatles, Bill Gates etc – but I was wondering could this be applied to DBAs ?&lt;/p&gt;  &lt;p&gt;If it takes 10,000 hours to be a really elite DBA – how long does that really take ? 8 hours a day makes 1250 days. If we assume that most DBAs work around 230 days a year – then it takes around 5 and a half years to become an elite DBA.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;But how much time per day does a DBA spend actually doing DBA work ? Certainly it’s my experience that the more experienced I get as a DBA, the less time I seem to spend actually doing DBA work – ie meetings, change-control meetings, project planning, liasing with other teams, appraisals etc.&amp;#160; Is it more accurate to assume that a DBA spends half their time actually doing ‘real’ DBA work – or is that just my bad luck ?&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;So, in reality, I’d argue it can take at least 5 1/2 and more likely closer to 10 years to become an elite DBA. Why do I keep receiving CVs for senior DBAs with 2-4 years actual DBA experience ?&lt;/p&gt;  &lt;p&gt;In the second section I found particularly interesting, Gladwell writes about analysis of plane crashes and the importance of in-cockpit communications. He describes a couple of crashes involving Korean Airlines – where co-pilots were often deferrential to pilots, and unwilling to openly criticise their more senior colleagues or point out errors when things were going badly wrong…&lt;/p&gt;  &lt;p&gt;&lt;img style="margin:5px 5px 5px 0px;" src="http://t3.gstatic.com/images?q=tbn:ANd9GcQJwW8wyNG-ELfGl9F_GAccMDM3mCyBIaKKm1krE-5NZuq7JatJyJ5rZC58" width="303" height="212" alt="" /&gt;&lt;a href="http://sqlblogcasts.com/blogs/steveh/image_1557676D.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px 5px 5px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblogcasts.com/blogs/steveh/image_thumb_7246F5FC.png" width="285" height="212" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;There’s a better summary of Gladwell’s concepts on mitigation&amp;#160; &lt;a href="http://fullwindsor.blogspot.com/2009/01/mitigated-speech.html"&gt;here&lt;/a&gt; – but to apply this to a DBA role… If you are a DBA and you do not agree with&amp;#160; a decision of one of your superiors, then it’s your duty as a DBA to say what you think is wrong, before it’s too late…&amp;#160; &lt;/p&gt;  &lt;p&gt;Obviously there’s a fine line between constructive criticism and moaning, but a good senior DBA or manager should be able to take well-researched criticism\debate from a more junior DBA.&amp;#160;&amp;#160; Is this really possible ? &lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=15141" width="1" height="1"&gt;</description></item><item><title>SQL 2008 sp 2 – partitioning changes</title><link>http://sqlblogcasts.com/blogs/steveh/archive/2010/10/05/sql-2008-sp-2-partitioning-changes.aspx</link><pubDate>Tue, 05 Oct 2010 11:26:08 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:14879</guid><dc:creator>steveh99999</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/steveh/rsscomments.aspx?PostID=14879</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/steveh/archive/2010/10/05/sql-2008-sp-2-partitioning-changes.aspx#comments</comments><description>&lt;p&gt;I was interested to see that SQL 2008 service pack 2 includes support for an increased number of partitions. ie In SQL 2008, the maximum number of partitions on a table is 1,000 – but now with sp2, the maximum number is 15,000.&lt;/p&gt;  &lt;p&gt;Microsoft have published a whitepaper to document this change – &lt;a title="Support for 15000 Partitions" href="http://go.microsoft.com/fwlink/?LinkId=199773"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;A couple of interesting points…&lt;/p&gt;  &lt;p&gt;1. A new stored procedure has been introduced to turn this on, sp_db_increased_partitions.&amp;#160; I do not like how options are now set by ALTER DATABASE – for example recovery model – but then Microsoft introduce new functionality such as this using&amp;#160; ‘older style’ stored procedures...&amp;#160; &lt;/p&gt;  &lt;p&gt;2. SQL 2008 R2 does not support this increase in maximum partition numbers – yet…&amp;#160; So you cannot take a database with more than 1,000 partitions in SQL 2008 and upgrade it to SQL 2008 R2.&lt;/p&gt;  &lt;p&gt;3 There are also implications with log shipping and mirroring. Again, you need to be very aware of the versions\service packs involved in your log-shipping and mirroring configuration.&lt;/p&gt;  &lt;p&gt;When I first saw this improvement, I was very pleased – however after reading the whitepaper, clearly it needs some planning/thought/testing before you decide to implement this feature.&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=14879" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/sql+2008/default.aspx">sql 2008</category><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/sp2/default.aspx">sp2</category><category domain="http://sqlblogcasts.com/blogs/steveh/archive/tags/partitioning/default.aspx">partitioning</category></item></channel></rss>
