<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>teknoglot: &#187; SQL Server 2005</title>
	<atom:link href="http://www.teknoglot.se/tag/sql-server-2005/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.teknoglot.se</link>
	<description>Techspeak for the socially diminished</description>
	<lastBuildDate>Fri, 18 May 2012 12:28:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>(re)Gain sysadmin access to SQL2005 or SQL2008</title>
		<link>http://www.teknoglot.se/ms/sql2005/regain-sysadmin-access-to-sql2005-or-sql2008/</link>
		<comments>http://www.teknoglot.se/ms/sql2005/regain-sysadmin-access-to-sql2005-or-sql2008/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 13:08:10 +0000</pubDate>
		<dc:creator>Sam T</dc:creator>
				<category><![CDATA[OpsMgr 2007]]></category>
		<category><![CDATA[SQL 2005]]></category>
		<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://teknoglot.hartati.se/?p=239</guid>
		<description><![CDATA[In SQL Server 2005 and 2008 the local Administrators account is not sysadmin by default. This makes it even more important that the one setting up the Database also remembers to add a SQL Server admins group to the sysamin role. If this step is forgotten, the user installing the database server is the only [...]]]></description>
			<content:encoded><![CDATA[<p>In SQL Server 2005 and 2008 the local Administrators account is not sysadmin by default. This makes it even more important that the one setting up the Database also remembers to add a SQL Server admins group to the sysamin role. If this step is forgotten, the user installing the database server is the only one that will ever be sysadmin.</p>
<p>In some extreme cases I’ve seen situations where no one except some dude on vacation is sysadmin and there’s a bunch of applications that needs to be installed/upgraded. In these cases I have also been assigned Local Administrator rights on the server, but since the local Administrators group isn’t sysadmin either I still cannot login to the SQL server.<br />
What to do!?</p>
<p>Thanks to <a href="http://blogs.msdn.com/raulga/archive/2007/07/12/disaster-recovery-what-to-do-when-the-sa-account-password-is-lost-in-sql-server-2005.aspx">Raul Carcia’s blog post</a> it’s not that a big deal. The instructions is written for SQL Server 2005, but works equally fine on SQL Server 2008 and the only requirement is that you are a local server administrator.<br />
Here’s what to do:</p>
<ol>
<li>Open the <em>SQL Server Configuration Manager.</em></li>
<li>In <em>SQL Server Services</em>, open the properties for the SQL Server instance you need access to.</li>
<li>In the <em>Advanced</em> tab, locate <em>Startup Parameters</em>.</li>
<li>Add “;-m” to the end of that line.</li>
<li>Press OK and restart the SQL Server into “Maintenance Mode” or “Single User Mode” if you like. (check that a restart is OK first <img src='http://www.teknoglot.se/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</li>
<li>Open a command prompt (right-click, “Run as Administrator” in Windows 2008) and go to C:Program FilesMicrosoft SQL Server100ToolsBinn<br />
<span style="font-size: xx-small;">(C:Program FilesMicrosoft SQL Server90ToolsBinn for SQL2005</span>)</li>
<li>Execute
<pre class="brush: plain; title: ; notranslate">sqlcmd /A /E /S&amp;lt;SERVERINSTANCE&amp;gt;</pre>
<p> (use . for local default instance and .INSTANCE for local named instance)</li>
<li>In the CLI, execute:
<pre class="brush: plain; title: ; notranslate">EXEC sp_addsrvrolemember 'DOMAINyourusername', 'sysadmin';
GO</pre>
</li>
<li>Return to the <em>SQL Server Configuration Manager</em> and restore the <em>Startup Parameters</em> to it’s previous settings.</li>
<li>Restart the SQL Server instance to allow users to access it again.</li>
</ol>
<p>Now, you should be able to login to the SQL server with sysadmin rights using your current user. This would also be a good point in time to actually establish a SQL Server Admins group (local or domain) to add to the sysadmin role to avoid having others to the above steps when you, yourself, happens to be on vacation. <img src='http://www.teknoglot.se/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>As Raul Carcia point out in his original post, this is really a disaster recovery procedure and there’s definitely nothing sneaky about it since it leaves quite alot of trails in the event logs.</p>
<p>All in all, a Great article by <a href="http://blogs.msdn.com/raulga/">Raul</a> and all credit should go his way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teknoglot.se/ms/sql2005/regain-sysadmin-access-to-sql2005-or-sql2008/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

