<?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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Eric Humphrey</title>
	
	<link>http://www.erichumphrey.com</link>
	<description>aka @lotsahelp</description>
	<lastBuildDate>Wed, 09 Nov 2011 19:01:54 +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/EricHumphrey" /><feedburner:info uri="erichumphrey" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Script level upgrade for database ‘master’ failed</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/zvgmQ102jYY/</link>
		<comments>http://www.erichumphrey.com/2011/11/script-level-upgrade-for-database-master-failed/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 16:17:04 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[clusters]]></category>
		<category><![CDATA[dba]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=248</guid>
		<description><![CDATA[A few weeks ago one of our clustered server nodes blue-screened and when it came back on SQL refused to start. I started digging in and this is what I found in the Event Log: &#8220;Script level upgrade for database &#8216;master&#8217; failed because upgrade step &#8216;sqlagent100_msdb_upgrade.sql&#8217; encountered error 200, state 7, severity 25.&#8221; Immediately I [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago one of our clustered server nodes blue-screened and when it came back on SQL refused to start. I started digging in and this is what I found in the Event Log: &#8220;Script level upgrade for database &#8216;master&#8217; failed because upgrade step &#8216;sqlagent100_msdb_upgrade.sql&#8217; encountered error 200, state 7, severity 25.&#8221; Immediately I started to suspect a corrupt master database. And I found this in the SQL Error Log:</p>
<blockquote><p>Creating procedure sp_sqlagent_get_perf_counters&#8230;<br />
Error: 468, Severity: 16, State: 9.<br />
<strong>Cannot resolve the collation conflict between &#8220;SQL_Latin1_General_CP1_CI_AS&#8221; and &#8220;Latin1_General_CI_AS&#8221; in the equal to operation.</strong><br />
Error: 912, Severity: 21, State: 2.<br />
Script level upgrade for database &#8216;master&#8217; failed because upgrade step &#8216;sqlagent100_msdb_upgrade.sql&#8217; encountered error 200, state 7, severity 25. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the &#8216;master&#8217; database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.<br />
Error: 3417, Severity: 21, State: 3.<br />
Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.<br />
SQL Trace was stopped due to server shutdown. Trace ID = &#8217;1&#8242;. This is an informational message only; preser action is required.</p></blockquote>
<p>It turns out that the collation of msdb did not match master. Master was using SQL_Latin1_General_CP1_CI_AS while only msdb and one other database was using  Latin1_General_CI_AS. The upgrade script that SQL Server ran at startup performed a join across those two databases resulting in the error. I&#8217;m still not sure about why this script got run as no service packs / cumulative updates had been applied to this server recently and it was originally installed as 2008, not an upgrade from 2005. With the upgrade script interrupted, it left the master db unusable.</p>
<p>I started going through the <a href="http://msdn.microsoft.com/en-us/library/ms190679.aspx">steps to restore master</a>. I was able to <a href="http://msdn.microsoft.com/en-us/library/ms188236%28v=sql.100%29.aspx">start the server in single user mode</a>, yet I could never get in as the single user. Something seemed to always be taking the connection before I could get in.</p>
<p>I had a long, long conversation with the #sqlhelp folks on Twitter about this. All of these guys and gals were tossing out help: @sqlinsaneo @kbriankelly @darrelllandrum @rusanu @DBArgenis @Kendra_Little @mrdenny @Bugboi @SQLSoldier. We stopped all services that were known to connect, stopped the browser service, changed the port, only allow IP connections, paused the cluster node I was working on, and still I was getting an error that only one admin was allowed at a time in single user mode.</p>
<p>Since I was getting nowhere fast, I decided on a different tact, namely to <a href="https://blogs.msdn.com/themes/blogs/generic/post.aspx?WeblogApp=psssql&amp;y=2008&amp;m=08&amp;d=29&amp;WeblogPostName=how-to-rebuild-system-databases-in-sql-server-2008&amp;GroupKeys=">rebuild master</a> then recover from backup. Rebuilding master was a fairly quick process. An important note about rebuilding master is that is also rebuilds msdb. Now I had two databases to recover from backup. Once the rebuild was complete, I was successfully able to start the service in single user mode  and was able to connect (yay!!!). Now I could restore a backup of master, restart SQL normally and restore msdb. I finally had a running instance 2.5 hours later.</p>
<p>Important lessons learned from this experience:</p>
<ul>
<li>If single user mode isn&#8217;t working and you have a good backup of msdb, rebuild then recover. Rebuilding might fix some issues and get you on the road to recovery quicker.</li>
<li>Collations of all the system databases really should match. This whole issue was because of a collation conflict between master and msdb.</li>
</ul>
<div>Thanks again to:</div>
<div>
<ul>
<li>Allen Kinsel (<a href="http://www.allenkinsel.com">blog</a> | <a href="http://twitter.com/#!/sqlinsaneo">twitter</a>)</li>
<li>K. Brian Kelley (<a href="http://www.truthsolutions.com">blog</a> | <a href="http://twitter.com/#!/kbriankelley">twitter</a>)</li>
<li>Darrell Landrum (<a href="http://twitter.com/#!/darrelllandrum">twitter</a>)</li>
<li>Remus Rusanu (<a href="http://rusanu.com">blog</a> | <a href="http://twitter.com/#!/rusanu">twitter</a>)</li>
<li>Argenis Fernandez (<a href="http://www.sqlblog.com/blogs/argenis_fernandez">blog</a> | <a href="http://twitter.com/#!/DBArgenis">twitter</a>)</li>
<li>Kendra Little (<a href="http://littlekendra.com">blog</a> | <a href="http://twitter.com/#!/Kendra_Little">twitter</a>)</li>
<li>Denny Cherry (<a href="http://www.mrdenny.com">blog</a> | <a href="http://twitter.com/#!/mrdenny">twitter</a>)</li>
<li>Bugboi (<a href="http://twitter.com/#!/Bugboi">twitter</a>)</li>
<li>Robert Davis (<a href="http://www.sqlsoldier.com">blog</a> | <a href="http://twitter.com/#!/SQLSoldier">twitter</a>)</li>
</ul>
</div>
<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/zvgmQ102jYY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/11/script-level-upgrade-for-database-master-failed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/11/script-level-upgrade-for-database-master-failed/</feedburner:origLink></item>
		<item>
		<title>Sync SSMS Tools Pack Across Computers Using SyncToy</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/hiXVCsAOHmg/</link>
		<comments>http://www.erichumphrey.com/2011/10/synctoy-ssmstools/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 18:44:06 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[dba]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=243</guid>
		<description><![CDATA[My favorite and most used feature of the SSMS Tools Pack is the query history. This feature has saved me a lot of time and effort. DBAs where I work are assigned both a desktop for normal day to day operations and a laptop for when we&#8217;re at home, meetings, travel, etc. Today I ran [...]]]></description>
			<content:encoded><![CDATA[<p>My favorite and most used feature of the <a href="http://www.ssmstoolspack.com/">SSMS Tools Pack</a> is the query history. This feature has saved me a lot of time and effort. DBAs where I work are assigned both a desktop for normal day to day operations and a laptop for when we&#8217;re at home, meetings, travel, etc. Today I ran into a scenario that made me want to keep the query history of both machines in sync. I asked <a href="http://twitter.com/#!/MladenPrajdic">Mladen Prajdic</a>, the creator, about syncing across computers and he directed me to a <a href="http://www.real-sql-guy.com/2011/10/wonder-twin-powers-activate.html">blog post</a> written by <a href="https://twitter.com/#!/RealSQLGuy">REAL SQL Guy</a> that does just that. Unfortunately his method uses Dropbox which is blocked at work, so I needed an alternative. I use <a href="https://www.microsoft.com/download/en/details.aspx?id=15155">SyncToy</a> from Microsoft regularly to keep other folders in sync, so I decided to do the same for this project. Using SyncToy manually means that both machines need to be powered on and can see each other on the network since there is no intermediary.</p>
<p>The first thing I did was to share the C:\SSMSTools folder on each machine so I can trigger the sync from whichever computer I&#8217;m sitting at. I then created a folder pair on each machine specifying the &#8220;Left&#8221; folder as the remote shared folder and the &#8220;Right&#8221; folder as the local one. I made sure to use the &#8220;Synchronize&#8221; setting so that changes can go both ways. Give it a name, click Preview and Run. Now I have my entire history from both machines available from either one.</p>
<p>Link Recap:</p>
<ul>
<li><a href="http://www.ssmstoolspack.com/">SSMS Tools Pack</a></li>
<li><a href="http://www.real-sql-guy.com/2011/10/wonder-twin-powers-activate.html">Real SQL Guy</a></li>
<li><a href="https://www.microsoft.com/download/en/details.aspx?id=15155">SyncToy</a></li>
</ul>
<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/hiXVCsAOHmg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/10/synctoy-ssmstools/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/10/synctoy-ssmstools/</feedburner:origLink></item>
		<item>
		<title>Get All SESSIONPROPERTY Values for Your Session</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/jvvNf06seAI/</link>
		<comments>http://www.erichumphrey.com/2011/08/sessionproperty/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 20:26:45 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=238</guid>
		<description><![CDATA[As a follow-up to my SERVERPROPERTY() post, this is a quick script to grab all the SESSIONPROPERTY() values from your current session in a table. Useful when you forget what the propertyname options are. Properties obtained from http://msdn.microsoft.com/en-us/library/ms175001.aspx. DECLARE @props TABLE &#40;propertyname sysname PRIMARY KEY&#41; INSERT INTO @props&#40;propertyname&#41; SELECT 'ANSI_NULLS' UNION ALL SELECT 'ANSI_PADDING' UNION ALL [...]]]></description>
			<content:encoded><![CDATA[<p>As a follow-up to my <a title="Get all SERVERPROPERTY values for SQL Server" href="http://www.erichumphrey.com/2011/04/serverproperty/">SERVERPROPERTY() post</a>, this is a quick script to grab all the SESSIONPROPERTY() values from your current session in a table. Useful when you forget what the propertyname options are. Properties obtained from <a href="http://msdn.microsoft.com/en-us/library/ms175001.aspx">http://msdn.microsoft.com/en-us/library/ms175001.aspx</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">DECLARE</span> @props <span style="color: #0000FF;">TABLE</span> <span style="color: #808080;">&#40;</span>propertyname sysname <span style="color: #0000FF;">PRIMARY</span> <span style="color: #0000FF;">KEY</span><span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">INSERT</span> <span style="color: #0000FF;">INTO</span> @props<span style="color: #808080;">&#40;</span>propertyname<span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ANSI_NULLS'</span>
<span style="color: #0000FF;">UNION</span> <span style="color: #808080;">ALL</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ANSI_PADDING'</span>
<span style="color: #0000FF;">UNION</span> <span style="color: #808080;">ALL</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ANSI_WARNINGS'</span>
<span style="color: #0000FF;">UNION</span> <span style="color: #808080;">ALL</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ARITHABORT'</span>
<span style="color: #0000FF;">UNION</span> <span style="color: #808080;">ALL</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'CONCAT_NULL_YIELDS_ NULL'</span>
<span style="color: #0000FF;">UNION</span> <span style="color: #808080;">ALL</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'NUMERIC_ROUNDABORT'</span>
<span style="color: #0000FF;">UNION</span> <span style="color: #808080;">ALL</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'QUOTED_IDENTIFIER'</span>
&nbsp;
<span style="color: #0000FF;">SELECT</span> propertyname, <span style="color: #FF00FF;">SESSIONPROPERTY</span><span style="color: #808080;">&#40;</span>propertyname<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">FROM</span> @props</pre></div></div>

<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/jvvNf06seAI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/08/sessionproperty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/08/sessionproperty/</feedburner:origLink></item>
		<item>
		<title>Dallas Tech Fest – Demo Files for SQL Server CLR: An Introduction</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/Kq3gx1w7X9g/</link>
		<comments>http://www.erichumphrey.com/2011/08/dallas-tech-fest-demo-files-for-sql-server-clr-an-introduction/#comments</comments>
		<pubDate>Fri, 12 Aug 2011 18:00:27 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[clr]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[speaking]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=231</guid>
		<description><![CDATA[Demo files from my presentation at Dallas Tech Fest 2011. SQL Server CLR &#8211; An Introduction &#8211; Dallas Tech Fest 2011 *Updated 8/13: presentation with link to the MCM Readiness Video on SQLCLR]]></description>
			<content:encoded><![CDATA[<p>Demo files from my presentation at Dallas Tech Fest 2011.</p>
<p><a href="http://www.erichumphrey.com/wp-content/uploads/2011/08/SQL-Server-CLR-An-Introduction1.zip">SQL Server CLR &#8211; An Introduction &#8211; Dallas Tech Fest 2011</a></p>
<p><strong>*Updated 8/13:</strong> presentation with link to the MCM Readiness Video on SQLCLR</p>
<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/Kq3gx1w7X9g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/08/dallas-tech-fest-demo-files-for-sql-server-clr-an-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/08/dallas-tech-fest-demo-files-for-sql-server-clr-an-introduction/</feedburner:origLink></item>
		<item>
		<title>Prevent SQL Logins from using SSMS … or any other app</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/a2lcb7MS8W4/</link>
		<comments>http://www.erichumphrey.com/2011/06/prevent-sql-logins-from-using-ssms/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 02:20:59 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[dba]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql triggers]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=222</guid>
		<description><![CDATA[In a continuation of my previous LOGON TRIGGER post. A downside to SQL logins is that anyone with the username / password combination can login as that user. This prevents us from knowing who truly logged in and performed some action. It is possible to trace and log everything by IP address and correlate back [...]]]></description>
			<content:encoded><![CDATA[<p><em>In a continuation of my previous <a title="Have SQL Demand Application Identification" href="http://www.erichumphrey.com/2009/11/have-sql-demand-application-identification/">LOGON TRIGGER post</a>.</em></p>
<p>A downside to SQL logins is that anyone with the username / password combination can login as that user. This prevents us from knowing who truly logged in and performed some action. It is possible to trace and log everything by IP address and correlate back to that.</p>
<p>Another downside is these accounts are usually service accounts, at least in our environment. These SQL logins may have more permissions than they should because they may be part of a vendors product, and the vendor&#8217;s app requires them to have sysadmin on the server. We have an issue with some of our users logging in as these SQL logins and running queries or manipulating data that they shouldn&#8217;t be.</p>
<p>So how can we allow the login to still exist, but deny normal users from logging in under those credentials? There&#8217;s a few different ways, one could be isolating these users to specific endpoints that would allow only that user from a given ip range. Another option, and the one that made sense here, was to use a LOGON TRIGGER. This allows us a great amount of flexibility on deciding when to prevent a connection from happening.</p>
<p>In this case, we wanted any SQL login using Management Studio to be denied access. Any of the other apps that log in with this account will still work. This includes SqlCmd, Access, etc. Our main problem, though, were devs coming in under SSMS. We also wanted to log any login attempts using this method.</p>
<p>This script creates a logging table in our management database (T1001), creates a view to make things nicer then creates the logon trigger to reject any connections that match our criteria.</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #008080;">--------------------------------------------------------------------------------</span>
<span style="color: #008080;">-- Create table to hold rejected login attempts</span>
<span style="color: #008080;">--------------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #0000FF;">USE</span> T1001;
GO
&nbsp;
<span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">TABLE</span> T1001.<span style="color: #202020;">SQLTrace</span>.<span style="color: #202020;">loginData</span> <span style="color: #808080;">&#40;</span>
	id <span style="color: #0000FF;">INT</span> <span style="color: #0000FF;">IDENTITY</span> <span style="color: #0000FF;">PRIMARY</span> <span style="color: #0000FF;">KEY</span>,
	<span style="color: #0000FF;">data</span> XML,
	program_name sysname
<span style="color: #808080;">&#41;</span>
GO
&nbsp;
<span style="color: #008080;">--------------------------------------------------------------------------------</span>
<span style="color: #008080;">-- Create view to make querying the table a little nicer</span>
<span style="color: #008080;">--------------------------------------------------------------------------------</span>
<span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">VIEW</span> SQLTrace.<span style="color: #202020;">loginDataView</span>
<span style="color: #0000FF;">AS</span>
<span style="color: #0000FF;">SELECT</span> id
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/EventType)[1]'</span>, <span style="color: #FF0000;">'sysname'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> EventType
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/PostTime)[1]'</span>, <span style="color: #FF0000;">'datetime'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> PostTime
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/SPID)[1]'</span>, <span style="color: #FF0000;">'int'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> SPID
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/ServerName)[1]'</span>, <span style="color: #FF0000;">'nvarchar(257)'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> ServerName
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/LoginName)[1]'</span>, <span style="color: #FF0000;">'sysname'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> LoginName
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/LoginType)[1]'</span>, <span style="color: #FF0000;">'sysname'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> LoginType
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/SID)[1]'</span>, <span style="color: #FF0000;">'nvarchar(85)'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> SID
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/ClientHost)[1]'</span>, <span style="color: #FF0000;">'sysname'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> ClientHost
      ,<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/IsPooled)[1]'</span>, <span style="color: #FF0000;">'bit'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> IsPooled
      ,program_name
<span style="color: #0000FF;">FROM</span> SQLTrace.<span style="color: #202020;">loginData</span>
GO
&nbsp;
<span style="color: #008080;">--------------------------------------------------------------------------------</span>
<span style="color: #008080;">-- Create logon trigger</span>
<span style="color: #008080;">--------------------------------------------------------------------------------</span>
<span style="color: #0000FF;">USE</span> <span style="color: #808080;">&#91;</span>master<span style="color: #808080;">&#93;</span>;
GO
&nbsp;
<span style="color: #008080;">/****** Object: DdlTrigger [Deny_SQLLogin_SSMS_Trigger] ******/</span>
<span style="color: #0000FF;">IF</span> <span style="color: #808080;">EXISTS</span><span style="color: #808080;">&#40;</span>
	<span style="color: #0000FF;">SELECT</span> <span style="color: #808080;">*</span> <span style="color: #0000FF;">FROM</span> master.<span style="color: #202020;">sys</span>.<span style="color: #202020;">server_triggers</span>
	<span style="color: #0000FF;">WHERE</span> parent_class_desc <span style="color: #808080;">=</span> <span style="color: #FF0000;">'SERVER'</span>
		<span style="color: #808080;">AND</span> name <span style="color: #808080;">=</span> N<span style="color: #FF0000;">'Deny_SQLLogin_SSMS_Trigger'</span><span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">DROP</span> <span style="color: #0000FF;">TRIGGER</span> <span style="color: #808080;">&#91;</span>Deny_SQLLogin_SSMS_Trigger<span style="color: #808080;">&#93;</span> <span style="color: #0000FF;">ON</span> <span style="color: #808080;">ALL</span> SERVER
GO
&nbsp;
<span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">TRIGGER</span> Deny_SQLLogin_SSMS_Trigger
<span style="color: #0000FF;">ON</span> <span style="color: #808080;">ALL</span> SERVER <span style="color: #0000FF;">WITH</span> <span style="color: #0000FF;">EXECUTE</span> <span style="color: #0000FF;">AS</span> <span style="color: #FF0000;">'sa'</span>
<span style="color: #0000FF;">FOR</span> LOGON
<span style="color: #0000FF;">AS</span>
<span style="color: #0000FF;">BEGIN</span>
<span style="color: #0000FF;">DECLARE</span> @<span style="color: #0000FF;">data</span> XML
<span style="color: #0000FF;">SET</span> @<span style="color: #0000FF;">data</span> <span style="color: #808080;">=</span> EVENTDATA<span style="color: #808080;">&#40;</span><span style="color: #808080;">&#41;</span>
&nbsp;
<span style="color: #0000FF;">DECLARE</span> @AppName sysname
       ,@LoginName sysname
       ,@LoginType sysname
<span style="color: #0000FF;">SELECT</span> @AppName <span style="color: #808080;">=</span> <span style="color: #808080;">&#91;</span>program_name<span style="color: #808080;">&#93;</span>
<span style="color: #0000FF;">FROM</span> sys.<span style="color: #202020;">dm_exec_sessions</span>
<span style="color: #0000FF;">WHERE</span> session_id <span style="color: #808080;">=</span> @<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/SPID)[1]'</span>, <span style="color: #FF0000;">'int'</span><span style="color: #808080;">&#41;</span>
&nbsp;
<span style="color: #0000FF;">SELECT</span> @LoginName <span style="color: #808080;">=</span> @<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/LoginName)[1]'</span>, <span style="color: #FF0000;">'sysname'</span><span style="color: #808080;">&#41;</span>
      ,@LoginType <span style="color: #808080;">=</span> @<span style="color: #0000FF;">data</span>.<span style="color: #0000FF;">value</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'(/EVENT_INSTANCE/LoginType)[1]'</span>, <span style="color: #FF0000;">'sysname'</span><span style="color: #808080;">&#41;</span>
&nbsp;
<span style="color: #0000FF;">IF</span> @AppName <span style="color: #808080;">LIKE</span> <span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'Microsoft SQL Server Management Studio%'</span><span style="color: #808080;">&#41;</span> <span style="color: #008080;">--If it's SSMS</span>
   <span style="color: #808080;">AND</span> @LoginName <span style="color: #808080;">&amp;</span>lt;<span style="color: #808080;">&amp;</span>gt; <span style="color: #FF0000;">'sa'</span>
   <span style="color: #808080;">AND</span> @LoginType <span style="color: #808080;">=</span> <span style="color: #FF0000;">'SQL Login'</span> <span style="color: #008080;">--('SQL Login' | 'Windows (NT) Login')</span>
<span style="color: #0000FF;">BEGIN</span>
    <span style="color: #0000FF;">ROLLBACK</span>; <span style="color: #008080;">--Disconnect the session</span>
&nbsp;
    <span style="color: #008080;">--Log the exception to our table</span>
    <span style="color: #0000FF;">INSERT</span> <span style="color: #0000FF;">INTO</span> T1001.<span style="color: #202020;">SQLTrace</span>.<span style="color: #202020;">loginData</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">data</span>, program_name<span style="color: #808080;">&#41;</span>
	<span style="color: #0000FF;">VALUES</span><span style="color: #808080;">&#40;</span>@<span style="color: #0000FF;">data</span>, @AppName<span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">END</span>
&nbsp;
<span style="color: #0000FF;">END</span>;
GO</pre></div></div>

<p>Don&#8217;t forget to create a job to purge historical log data at sufficient intervals for you.</p>
<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/a2lcb7MS8W4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/06/prevent-sql-logins-from-using-ssms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/06/prevent-sql-logins-from-using-ssms/</feedburner:origLink></item>
		<item>
		<title>Locking While Dropping or Altering an Index</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/sBe_IN8j4l8/</link>
		<comments>http://www.erichumphrey.com/2011/05/locking_drop_index/#comments</comments>
		<pubDate>Thu, 12 May 2011 01:19:04 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[dba]]></category>
		<category><![CDATA[observation]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=208</guid>
		<description><![CDATA[Yesterday I was trying to drop some hypothetical indexes in production against a fairly active table. I started causing blocking so I had the bright idea of disabling the indexes first, then dropping. Well, that didn&#8217;t help, even when setting DEADLOCK_PRIORITY to LOW. I ended up waiting until early morning to remove those indexes to [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was trying to drop some hypothetical indexes in production against a fairly active table. I started causing blocking so I had the bright idea of disabling the indexes first, then dropping. Well, that didn&#8217;t help, even when setting DEADLOCK_PRIORITY to LOW. I ended up waiting until early morning to remove those indexes to prevent from blocking other users.</p>
<p>Finding no info on the web about the locks taken during the process of dropping or disabling an index, I set about doing this small bit of research.</p>
<p>The queries I used:<br />
In Window 1 (Execute first)</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">BEGIN</span> <span style="color: #0000FF;">TRAN</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #0000FF;">TOP</span> <span style="color: #000;">100</span> <span style="color: #808080;">*</span> <span style="color: #0000FF;">FROM</span> myTable <span style="color: #0000FF;">WITH</span> <span style="color: #808080;">&#40;</span>TABLOCKX<span style="color: #808080;">&#41;</span></pre></div></div>

<p>* I use TABLOCKX to simulate many updates going to this table.</p>
<p>In Window 2</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">DROP</span> <span style="color: #0000FF;">INDEX</span> <span style="color: #808080;">&#91;</span>ix_myTable_testIndex<span style="color: #808080;">&#93;</span> <span style="color: #0000FF;">ON</span> myTable</pre></div></div>

<p>Using Adam Machanic&#8217;s (<a href="http://sqlblog.com/blogs/adam_machanic/">blog</a> | <a href="http://twitter.com/#!/AdamMachanic">twitter</a>) <a href="http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/">sp_WhoIsActive</a> I was able to get the lock details easily.</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;">sp_whoisactive @get_locks <span style="color: #808080;">=</span> <span style="color: #000;">1</span></pre></div></div>

<p>When you disable an index, you end up trying to acquire a Sch-M or Schema Modification lock.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Database</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Sandbox&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Locks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Lock</span> <span style="color: #000066;">request_mode</span>=<span style="color: #ff0000;">&quot;S&quot;</span> <span style="color: #000066;">request_status</span>=<span style="color: #ff0000;">&quot;GRANT&quot;</span> <span style="color: #000066;">request_count</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Locks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Objects<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Object</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;myTable&quot;</span> <span style="color: #000066;">schema_name</span>=<span style="color: #ff0000;">&quot;dbo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Locks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Lock</span> <span style="color: #000066;">resource_type</span>=<span style="color: #ff0000;">&quot;OBJECT&quot;</span> <span style="color: #000066;">request_mode</span>=<span style="color: #ff0000;">&quot;Sch-M&quot;</span> <span style="color: #000066;">request_status</span>=<span style="color: #ff0000;">&quot;WAIT&quot;</span> <span style="color: #000066;">request_count</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Locks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Object<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Objects<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Database<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Then the next select query comes along and trys to grab an IS or Intent Shared lock</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Database</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Sandbox&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Locks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Lock</span> <span style="color: #000066;">request_mode</span>=<span style="color: #ff0000;">&quot;S&quot;</span> <span style="color: #000066;">request_status</span>=<span style="color: #ff0000;">&quot;GRANT&quot;</span> <span style="color: #000066;">request_count</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Locks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Objects<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Object</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;myTable&quot;</span> <span style="color: #000066;">schema_name</span>=<span style="color: #ff0000;">&quot;dbo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Locks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Lock</span> <span style="color: #000066;">resource_type</span>=<span style="color: #ff0000;">&quot;OBJECT&quot;</span> <span style="color: #000066;">request_mode</span>=<span style="color: #ff0000;">&quot;IS&quot;</span> <span style="color: #000066;">request_status</span>=<span style="color: #ff0000;">&quot;WAIT&quot;</span> <span style="color: #000066;">request_count</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Locks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Object<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Objects<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Database<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>So at this point yesterday, I was thinking, maybe I can disable the index and then drop it. Well, ALTER INDEX &#8230; DISABLE also waits on a Sch-M lock before it can proceed. I&#8217;m not any better off. Even after the disabling the index, SQL Server still tries to grab a Sch-M lock to drop the disabled index. All these rules also seem to apply to hypothetical indexes. I&#8217;m sure there&#8217;s some internals reason why it does this, but why worry about locks when dropping a disabled or hypothetical index since neither are used by active queries?</p>
<p>Lesson learned, drop indexes when the table usage is low.</p>
<p><strong>*Update</strong><br />
<div class="quotedtweet" id="tw68491945105821696" style="background-color:#eef;padding:5px;margin-bottom:5px">
	<div class="tw_user-info" style="padding:10px 10px 5px 0;float:left;text-align:center;width:100px;">
		<div class="tw_thumb">
			<a href="http://twitter.com/SQLskills" title="SQLskills.com" class="quoting_pic" rel="external"><img src="http://img.tweetimag.es/i/SQLskills_n" alt="SQLskills" /></a>
		</div>
		<div class="tw_screen-name">
			<em><a href="http://twitter.com/SQLskills" title="Twitter page : SQLskills.com" rel="external">SQLskills</a></em>
		</div>
		<div class="tw_full-name">
			<strong>(SQLskills.com)</strong>
		</div>
	</div>
	<div class="tw_content" style="float: left; width: 500px; font: 20pt Georgia, Verdana, sans-serif; font-style: normal;">
		<div class="tw_entry-content">
				<a href="http://www.twitter.com/lotsahelp" rel="external">@lotsahelp</a> Yup - all index ops need a schema-mod lock at some point to make plans recompile and bump major schema version number.

		</div>
	</div>
	<div style="clear: both; text-align: left;font-style:italic;margin-left:110px">
		<p class="tw_meta tw_entry-meta" style="margin: 0;padding-top:5px">
			<small>
				<span>On <a href="http://twitter.com/SQLskills/status/68491945105821696" rel="external">12-5-2011 01:45:26</a></span> 
				<span>from <a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a></span> 
				<span> in reply to <a href="http://twitter.com/lotsahelp/status/68488421106126849" rel="external">Eric Humphrey</a></span>
			</small>
		</p>
	</div>
</div></p>
<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/sBe_IN8j4l8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/05/locking_drop_index/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/05/locking_drop_index/</feedburner:origLink></item>
		<item>
		<title>Disable SQL Agent Jobs with PowerShell</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/Clhmto9VqV8/</link>
		<comments>http://www.erichumphrey.com/2011/04/disable-sql-agent-jobs-with-powershell/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 18:46:38 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[dba]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=201</guid>
		<description><![CDATA[I had a need today to disable all of our admin jobs while I moved our admin database to another file location. We didn&#8217;t want to get a lot of alerts or job failures during the move, even though it took less than 5 minutes. This script runs best in sqlps or by adding the [...]]]></description>
			<content:encoded><![CDATA[<p>I had a need today to disable all of our admin jobs while I moved our admin database to another file location. We didn&#8217;t want to get a lot of alerts or job failures during the move, even though it took less than 5 minutes. This script runs best in sqlps or by adding the appropriate snap-ins to your regular console.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">cd</span> SQLSERVER:\SQL\<span style="color: #000000;">&#91;</span>server<span style="color: #000000;">&#93;</span>\<span style="color: #000000;">&#91;</span>instance<span style="color: #000000;">&#93;</span>\JobServer\Jobs
<span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">|</span> <span style="color: pink;">?</span><span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.Name.StartsWith<span style="color: #000000;">&#40;</span><span style="color: #800000;">'!Admin'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: pink;">%</span><span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.IsEnabled <span style="color: pink;">=</span> <span style="color: #800080;">$false</span>; <span style="color: #000080;">$_</span>.Alter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#125;</span> <span style="color: #008000;">#rerun with $true to enable</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/Clhmto9VqV8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/04/disable-sql-agent-jobs-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/04/disable-sql-agent-jobs-with-powershell/</feedburner:origLink></item>
		<item>
		<title>Get all SERVERPROPERTY values for SQL Server</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/DTyJs45X5MU/</link>
		<comments>http://www.erichumphrey.com/2011/04/serverproperty/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 14:13:03 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[dba]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=196</guid>
		<description><![CDATA[A quick script to grab all the SERVERPROPERTY() values from a SQL instance in a table. Useful when you forget what the propertyname options are. Properties obtained from http://msdn.microsoft.com/en-us/library/ms174396.aspx. DECLARE @props TABLE &#40;propertyname sysname PRIMARY KEY&#41; INSERT INTO @props&#40;propertyname&#41; SELECT 'BuildClrVersion' UNION SELECT 'Collation' UNION SELECT 'CollationID' UNION SELECT 'ComparisonStyle' UNION SELECT 'ComputerNamePhysicalNetBIOS' UNION SELECT 'Edition' [...]]]></description>
			<content:encoded><![CDATA[<p>A quick script to grab all the SERVERPROPERTY() values from a SQL instance in a table. Useful when you forget what the propertyname options are. Properties obtained from <a href="http://msdn.microsoft.com/en-us/library/ms174396.aspx">http://msdn.microsoft.com/en-us/library/ms174396.aspx</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">DECLARE</span> @props <span style="color: #0000FF;">TABLE</span> <span style="color: #808080;">&#40;</span>propertyname sysname <span style="color: #0000FF;">PRIMARY</span> <span style="color: #0000FF;">KEY</span><span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">INSERT</span> <span style="color: #0000FF;">INTO</span> @props<span style="color: #808080;">&#40;</span>propertyname<span style="color: #808080;">&#41;</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'BuildClrVersion'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'Collation'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'CollationID'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ComparisonStyle'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ComputerNamePhysicalNetBIOS'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'Edition'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'EditionID'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'EngineEdition'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'InstanceName'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'IsClustered'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'IsFullTextInstalled'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'IsIntegratedSecurityOnly'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'IsSingleUser'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'LCID'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'LicenseType'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'MachineName'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'NumLicenses'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ProcessID'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ProductVersion'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ProductLevel'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ResourceLastUpdateDateTime'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ResourceVersion'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'ServerName'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'SqlCharSet'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'SqlCharSetName'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'SqlSortOrder'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'SqlSortOrderName'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'FilestreamShareName'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'FilestreamConfiguredLevel'</span>
<span style="color: #0000FF;">UNION</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #FF0000;">'FilestreamEffectiveLevel'</span>
&nbsp;
<span style="color: #0000FF;">SELECT</span> propertyname, <span style="color: #FF00FF;">SERVERPROPERTY</span><span style="color: #808080;">&#40;</span>propertyname<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">FROM</span> @props</pre></div></div>

<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/DTyJs45X5MU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/04/serverproperty/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/04/serverproperty/</feedburner:origLink></item>
		<item>
		<title>Notes for Moving BizTalk’s Databases</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/3gmpnLGWLD0/</link>
		<comments>http://www.erichumphrey.com/2011/04/moving-biztalk-databases/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 15:41:57 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[dba]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=193</guid>
		<description><![CDATA[Yesterday, I was tasked with helping a team move their BizTalk databases to another server. These are my notes for anyone else in this predicament. In our case we had 6 databases to move: BizTalkDTADb BizTalkHwsDb BizTalkMgmtDb (This is the management database that tells BizTalk where everything else is.) BizTalkMsgBoxDb BizTalkRuleEngineDb SSODB We had originally [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I was tasked with helping a team move their BizTalk databases to another server. These are my notes for anyone else in this predicament.</p>
<p>In our case we had 6 databases to move:</p>
<ul>
<li>BizTalkDTADb</li>
<li>BizTalkHwsDb</li>
<li>BizTalkMgmtDb (This is the management database that tells BizTalk where everything else is.)</li>
<li>BizTalkMsgBoxDb</li>
<li>BizTalkRuleEngineDb</li>
<li>SSODB</li>
</ul>
<p>We had originally moved just 5 of these, not realizing that SSODB was part of the pack. Once the dbs were moved, the engineer worked on getting the service talking to the management database. We were still getting errors about connecting. After a little Googling of MSDN, I <a href="http://msdn.microsoft.com/en-us/library/ee267630(v=bts.10).aspx">found there was some changes</a> that needed to be made to the registry and database. The engineers handled the registry, I handled the data changes. Here’s a script of all the data changes I had to make.</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">USE</span> BizTalkMgmtDb;
GO
&nbsp;
<span style="color: #0000FF;">UPDATE</span> dbo.<span style="color: #202020;">adm_Group</span>
<span style="color: #0000FF;">SET</span> TrackingDBServerName <span style="color: #808080;">=</span> <span style="color: #FF0000;">'newServerInstance'</span>
    ,SubscriptionDBServerName <span style="color: #808080;">=</span> <span style="color: #FF0000;">'newServerInstance'</span>
   <span style="color: #008080;">--More columns exist in this table for other servers</span>
   <span style="color: #008080;">--but these are just the two we needed to change</span>
&nbsp;
<span style="color: #0000FF;">UPDATE</span> dbo.<span style="color: #202020;">adm_OtherDatabases</span>
<span style="color: #0000FF;">SET</span> ServerName <span style="color: #808080;">=</span> <span style="color: #FF0000;">'newServerInstance'</span>
&nbsp;
<span style="color: #0000FF;">UPDATE</span> dbo.<span style="color: #202020;">adm_OtherBackupDatabases</span>
<span style="color: #0000FF;">SET</span> ServerName <span style="color: #808080;">=</span> <span style="color: #FF0000;">'newServerInstance'</span>
&nbsp;
<span style="color: #0000FF;">UPDATE</span> dbo.<span style="color: #202020;">adm_MessageBox</span>
<span style="color: #0000FF;">SET</span> DBServerName <span style="color: #808080;">=</span> <span style="color: #FF0000;">'newServerInstance'</span></pre></div></div>

<p>There was a lot more to this move than just what I&#8217;ve put down, but this is the extent of the database changes.</p>
<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/3gmpnLGWLD0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/04/moving-biztalk-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/04/moving-biztalk-databases/</feedburner:origLink></item>
		<item>
		<title>Meme Monday: 11 Words or Less</title>
		<link>http://feedproxy.google.com/~r/EricHumphrey/~3/NwKn5qbwYZs/</link>
		<comments>http://www.erichumphrey.com/2011/04/mememonday-11words/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 20:56:09 +0000</pubDate>
		<dc:creator>lotsahelp</dc:creator>
				<category><![CDATA[community]]></category>

		<guid isPermaLink="false">http://www.erichumphrey.com/?p=191</guid>
		<description><![CDATA[Thomas LaRock (Blog &#124; Twitter) has started a community blog series call Meme Monday. Here&#8217;s my entry: Community is nice, but displaces work if you are not disciplined. I would tag others, but I think everyone I would have tagged has already posted.]]></description>
			<content:encoded><![CDATA[<p>Thomas LaRock (<a href="http://thomaslarock.com/">Blog</a> | <a href="http://twitter.com/SQLRockstar">Twitter</a>) has started a community blog series call <a href="http://thomaslarock.com/2011/04/welcome-to-meme-monday/">Meme Monday</a>.</p>
<p>Here&#8217;s my entry:<br />
Community is nice, but displaces work if you are not disciplined.</p>
<p>I would tag others, but I think everyone I would have tagged has already posted.</p>
<img src="http://feeds.feedburner.com/~r/EricHumphrey/~4/NwKn5qbwYZs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.erichumphrey.com/2011/04/mememonday-11words/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.erichumphrey.com/2011/04/mememonday-11words/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.erichumphrey.com @ 2012-02-04 00:40:47 -->

