<?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/"
	>

<channel>
	<title>Edwin M SarmientoSQL Server 2005 &#8211; Edwin M Sarmiento</title>
	<atom:link href="https://www.edwinmsarmiento.com/category/sql-server/sql-server-2005/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.edwinmsarmiento.com</link>
	<description>Intentional Excellence</description>
	<lastBuildDate>Mon, 13 Apr 2026 21:00:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">84283043</site>		<item>
		<title>Fixing Orphaned Database Users in SQL Server 2005</title>
		<link>https://www.edwinmsarmiento.com/fixing-orphaned-database-users-in-sql-server-2005/</link>
		<comments>https://www.edwinmsarmiento.com/fixing-orphaned-database-users-in-sql-server-2005/#respond</comments>
		<pubDate>Fri, 03 Apr 2009 01:12:00 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[orphaned users]]></category>
		<category><![CDATA[sp_change_users_login]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<guid isPermaLink="false">http://bassplayerdoc.wordpress.com/2009/04/03/fixing-orphaned-database-users-in-sql-server-2005</guid>

				<description><![CDATA[I see this on almost all SQL Server instances I work on &#8211; existing user in a database with dbo permissions yet they could not access anything in the database. This is because SQL Server doesn&#8217;t really look at the user or login name but rather the SID values (I&#8217;ve talked about this in here). [&#8230;]]]></description>
					<content:encoded><![CDATA[<p><span style="font-family:arial;">I see this on almost all SQL Server instances I work on &#8211; existing user in a database with dbo permissions yet they could not access anything in the database. This is because SQL Server doesn&#8217;t really look at the user or login name but rather the SID values (I&#8217;ve talked about this in <a href="http://bassplayerdoc.blogspot.com/2008/03/importance-of-accounts-sid.html">here</a>). Maybe they restored a database back from a development server to the production server without synchronizing the logins. If this was SQL Server 2000, you&#8217;d probably end up dropping logins, recreating the logins using the script provided by Microsoft in this <a href="http://support.microsoft.com/kb/246133">KB</a> article and recreate the database users. Unfortunately, this is not a straight-forward task. Good thing Microsoft has provided the <a href="http://msdn.microsoft.com/en-us/library/ms174378(SQL.90).aspx">sp_change_users_login</a> stored procedure to fix orphaned users. Using the <strong><span style="font-size:85%;">UPDATE_ONE</span></strong> parameter will &#8216;re-map&#8217; an orphaned database user to an existing SQL Server login with the same name. That in itself will spare you the trouble of going thru the process mentioned above (although you will still have to worry about orphaned database users that own schemas which is very much common among databases that have been upgraded from SQL Server 7.0 and 2000). Below is a syntax for &#8216;re-mapping&#8217; an orphaned database user to an existing SQL Server login</span></p>
<p><strong><span style="font-size:85%;"><span style="color:blue;">EXEC </span><span style="color:darkred;">sp_change_users_login </span><span style="color:red;">&#8216;UPDATE_ONE&#8217;</span><span style="color:gray;">,</span><span style="color:red;">&#8216;user&#8217;</span><span style="color:gray;">,</span></span></strong><span style="font-size:85%;"><strong><span style="color:red;">&#8216;user&#8217;<br />
</span><span style="color:black;">GO</span></strong><br />
</span><br />
<span style="font-family:arial;">You still need to run the stored procedure with the <strong><span style="font-size:85%;">REPORT</span></strong> parameter to return a list of orphaned database user</span></p>
<p><span style="font-size:85%;"><strong><span style="color:blue;">EXEC </span><span style="color:darkred;">sp_change_users_login </span></strong><span style="color:red;"><strong>&#8216;Report&#8217;</strong> </span></span></p>
<div class="blogger-post-footer"><img decoding="async" src="https://blogger.googleusercontent.com/tracker/92377218009570869-2362275080004550059?l=bassplayerdoc.blogspot.com" alt="" width="1" height="1" /></div>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/fixing-orphaned-database-users-in-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">179</post-id>	</item>
		<item>
		<title>The Return of the Living Dead:Job Owners who Keep Coming Back</title>
		<link>https://www.edwinmsarmiento.com/the-return-of-the-living-deadjob-owners-who-keep-coming-back/</link>
		<comments>https://www.edwinmsarmiento.com/the-return-of-the-living-deadjob-owners-who-keep-coming-back/#respond</comments>
		<pubDate>Fri, 13 Mar 2009 03:57:00 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[database maintenance plans]]></category>
		<category><![CDATA[job owners]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<guid isPermaLink="false">http://bassplayerdoc.wordpress.com/2009/03/13/the-return-of-the-living-deadjob-owners-who-keep-coming-back</guid>

				<description><![CDATA[Have you ever had the feeling that SQL Server was playing a trick on you? I had those moments. I was updating a database maintenance plan and ran the corresponding job associated with it. I got an error saying that the job owner did not have permissions to execute the task. So I did what [&#8230;]]]></description>
					<content:encoded><![CDATA[<p><span style="font-family:arial;">Have you ever had the feeling that SQL Server was playing a trick on you? I had those moments. I was updating a database maintenance plan and ran the corresponding job associated with it. I got an error saying that the job owner did not have permissions to execute the task. So I did what I would do as part of my testing procedure- change the job owner to <strong>sa</strong> and re-ran. And so it completed successfully until I realized I need to change some parameters in the database maintenance plan. After updating the maintenance plan, I again re-ran the same job and unexpectedly, it failed throwing the same error. When I checked the job owner, it reverted back to the original login prior to me changing it to <strong>sa</strong>. This login happens to be the user account that created the database maintenance plan. The worse part is, the maintenance plan has like 20+ subplans, each creating a SQL Server job. Now, you wouldn&#8217;t want to change the job owner for each job associated with the maintenance job every time you change something, would you? Well, there&#8217;s just no way you can do it directly. But there&#8217;s always a workaround. This <a href="http://sqlblogcasts.com/blogs/acalvett/archive/2007/12/30/the-job-whose-owner-kept-coming-back.aspx">blog post</a> provided a workaround for this case. You just modify the <strong><span style="font-size:85%;">sysdtspackages90</span></strong> table in the <strong><span style="font-size:85%;">msdb</span></strong> database </span></p>
<p><span style="font-size:85%;"><span style="color:blue;"><strong>UPDATE<br />
</strong></span><span style="color:black;"><strong>msdb.dbo.sysdtspackages90<br />
</strong></span><strong><span style="color:blue;">SET<br />
</span><span style="color:black;">OWNERSID </span><span style="color:blue;">= </span><span style="color:magenta;">SUSER_SID</span><span style="color:gray;">(</span><span style="color:red;">&#8216;DOMAINnew_user&#8217;</span></strong><span style="color:gray;"><strong>)<br />
</strong></span><strong><span style="color:blue;">WHERE<br />
</span><span style="color:black;">OWNERSID </span><span style="color:blue;">= </span><span style="color:magenta;">SUSER_SID</span><span style="color:gray;">(</span><span style="color:red;">&#8216;DOMAINold_user&#8217;</span></strong><span style="color:gray;"><strong>)</strong><br />
</span></span><br />
<span style="font-family:arial;color:#000000;">For <strong>SQL Server 2008</strong>, this query should do the trick </span><br />
<span style="font-family:arial;color:#000000;"><br />
</span><span style="font-size:85%;"><span style="font-size:85%;"><span style="color:blue;"><strong>UPDATE </strong></span><strong><span style="color:black;">msdb.dbo.sysssispackages<br />
</span><span style="color:blue;">SET </span><span style="color:black;">OWNERSID </span><span style="color:blue;">= </span><span style="color:magenta;">SUSER_SID</span><span style="color:gray;">(</span><span style="color:red;">&#8216;DOMAINnew_user&#8217;</span></strong><strong><span style="color:gray;">)<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">name </span><span style="color:blue;">= </span><span style="color:red;">&#8216;MaintenancePlan&#8217;</span></strong></span> <strong><span style="color:#000099;">AND</span></strong> <strong>OWNERSID</strong> = <strong><span style="color:#cc66cc;">SUSER_SID</span></strong><span style="color:#c0c0c0;">(</span><span style="color:#ff0000;"><strong>&#8216;DOMAINold_user&#8217;</strong></span><span style="color:#c0c0c0;">)</span><br />
</span><span style="font-size:85%;"><span style="color:gray;"><br />
</span></span><span style="font-family:arial;color:#000000;">There&#8217;s currently a <a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=295846">Microsoft Connect</a> item for this case so feel free to vote on it if you think it&#8217;s worth having a solution that just a workaround</span></p>
<div class="blogger-post-footer"><img decoding="async" src="" alt="" width="1" height="1" /></div>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/the-return-of-the-living-deadjob-owners-who-keep-coming-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">169</post-id>	</item>
		<item>
		<title>Trying to attach an MDF file to SQL Server 2005?</title>
		<link>https://www.edwinmsarmiento.com/trying-to-attach-an-mdf-file-to-sql-server-2005/</link>
		<comments>https://www.edwinmsarmiento.com/trying-to-attach-an-mdf-file-to-sql-server-2005/#respond</comments>
		<pubDate>Fri, 27 Feb 2009 00:20:00 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[attach database]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<guid isPermaLink="false">http://bassplayerdoc.wordpress.com/2009/02/27/trying-to-attach-an-mdf-file-to-sql-server-2005</guid>

				<description><![CDATA[While this is not recommended especially when you&#8217;re a bit paranoid about disaster recovery and data integrity, I still find a lot of people doing it. I guess a lot of independent software vendors don&#8217;t understand the underlying concepts behind the database engine. While it may have worked in SQL Server 2000 using Enterprise Manager, [&#8230;]]]></description>
					<content:encoded><![CDATA[<p><span style="font-family:arial;">While this is not recommended especially when you&#8217;re a bit paranoid about disaster recovery and data integrity, I still find a lot of people doing it. I guess a lot of independent software vendors don&#8217;t understand the underlying concepts behind the database engine. While it may have worked in SQL Server 2000 using Enterprise Manager, trying to attach an MDF file in SQL Server 2005 Management Studio will fail. To work around this, you can use the <strong><span style="font-size:85%;"><a href="http://technet.microsoft.com/en-us/library/ms174385.aspx">sp_attach_single_file_db</a></span></strong> system stored procedure. This will attach the MDF file and create an LDF file as well. This will only work if your database only has one datafile. Using this if your database has multipe datafiles won&#8217;t work. You do have to run the <a href="http://msdn.microsoft.com/en-us/library/ms176064(SQL.90).aspx">DBCC CHECKDB </a>command to validate your database</span></p>
<p><span style="font-family:Arial;">I&#8217;d still prefer the backup/restore approach. Nothing beats having a peace of mind</span></p>
<div class="blogger-post-footer"><img decoding="async" src="" alt="" width="1" height="1" /></div>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/trying-to-attach-an-mdf-file-to-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">166</post-id>	</item>
		<item>
		<title>Why Windows Instant File Initialization for SQL Server 2005 (and higher) matters</title>
		<link>https://www.edwinmsarmiento.com/why-windows-instant-file-initialization-for-sql-server-2005-matters/</link>
		<comments>https://www.edwinmsarmiento.com/why-windows-instant-file-initialization-for-sql-server-2005-matters/#respond</comments>
		<pubDate>Wed, 17 Sep 2008 08:08:00 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[Instant File Initialization]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server Disaster Recovery]]></category>
		<guid isPermaLink="false">http://bassplayerdoc.wordpress.com/2008/09/17/why-windows-instant-file-initialization-for-sql-server-2005-matters</guid>

				<description><![CDATA[SQL Server 2005 supports Database Instant File Initialization which skips zeroing out data pages that can reduce the time when performing operations like creating databases, adding files to an existing database, increasing the size of an existing database file manually or thru autogrowth or restoring a database or filegroup. I&#8217;ve written an article in MSSQLTips.com [&#8230;]]]></description>
					<content:encoded><![CDATA[<p><span style="font-family:arial;">SQL Server 2005 supports </span><a href="http://msdn.microsoft.com/en-us/library/ms175935(SQL.90).aspx"><span style="font-family:arial;">Database Instant File Initialization</span></a><span style="font-family:arial;"> which skips zeroing out data pages that can reduce the time when performing operations like creating databases, adding files to an existing database, increasing the size of an existing database file manually or thru autogrowth or restoring a database or filegroup. I&#8217;ve written an article in <a href="http://mssqltips.com/tip.asp?tip=1572">MSSQLTips.com</a> highlighting it&#8217;s importance both in a disaster recovery and operational performance scenarios. I ran a few tests as well to simply answer a query in the forum regarding the topic. I ran my tests on a VMWare image on a DELL PowerEdge 2650 with 4 X 2.8 GHz CPU and 3GB RAM. The image is running Windows Server 2003 Enterprise Edition with SQL Server 2005 Enterprise Edition as this is an &#8220;Enterprise Edition only&#8221; feature. I&#8217;ve created a 10GB-sized database which took only 0.1 seconds using instant file initialization. Without it, the same took about 2:10 minutes. Imagine doing a restore for a 500GB-sized database. That will save you a lot of time on the restore process. Same goes with file auto growth.</span> <span style="font-family:arial;">The difference in the amount of time it takes to do a restore would definitely matter when you&#8217;re dealing with very large databases. Imagine trying to restore a 500GB-sized database. You&#8217;ll probably agree after trying it out for yourself</span></p>
<div class="blogger-post-footer"><img decoding="async" src="" alt="" width="1" height="1" /></div>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/why-windows-instant-file-initialization-for-sql-server-2005-matters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">139</post-id>	</item>
		<item>
		<title>&gt;And so I need a GRANT IMPERSONATE permission</title>
		<link>https://www.edwinmsarmiento.com/and-so-i-need-a-grant-impersonate-permission/</link>
		<comments>https://www.edwinmsarmiento.com/and-so-i-need-a-grant-impersonate-permission/#respond</comments>
		<pubDate>Thu, 28 Aug 2008 08:27:00 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[EXECUTE AS]]></category>
		<category><![CDATA[GRANT IMPERSONATE]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<guid isPermaLink="false">http://bassplayerdoc.wordpress.com/2008/08/28/and-so-i-need-a-grant-impersonate-permission</guid>

				<description><![CDATA[&#62;SQL Server 2005 has given us the ability to allow more granular permissions, one of which is the EXECUTE AS clause. This would give the user the ability to impersonate a more privileged user should there be a need to do so. But before a user can do impersonation, it must be given the permission [&#8230;]]]></description>
					<content:encoded><![CDATA[<p>&gt;<span style="font-family:arial;">SQL Server 2005 has given us the ability to allow more granular permissions, one of which is the <a href="http://msdn.microsoft.com/en-us/library/ms188354(SQL.90).aspx">EXECUTE AS</a> clause. This would give the user the ability to impersonate a more privileged user should there be a need to do so. But before a user can do impersonation, it must be given the permission to impersonate. This is where the GRANT IMPERSONATE permission is needed &#8211; where a lower privileged user needs to impersonate a higher privileged user and not the other way around, I presume. </span><br /><span style="font-family:Arial;"></span><br /><span style="font-family:Arial;">I&#8217;ve written an article on <a href="http://www.mssqltips.com/tip.asp?tip=1579">MSSQLTips.com</a> to demonstrate how to use the EXCECUTE AS clause with the REVERT clause to impersonate users</span></p>
<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/92377218009570869-2126885858755006159?l=bassplayerdoc.blogspot.com' alt='' /></div>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/and-so-i-need-a-grant-impersonate-permission/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">132</post-id>	</item>
		<item>
		<title>&gt;Did you check your MSDB.dbo.suspect_pages after a database restore?</title>
		<link>https://www.edwinmsarmiento.com/did-you-check-your-msdb-dbo-suspect_pages-after-a-database-restore/</link>
		<comments>https://www.edwinmsarmiento.com/did-you-check-your-msdb-dbo-suspect_pages-after-a-database-restore/#respond</comments>
		<pubDate>Fri, 25 Jul 2008 06:47:00 +0000</pubDate>
		<dc:creator>Edwin M Sarmiento</dc:creator>
				<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[suspect_pages table]]></category>
		<guid isPermaLink="false">http://bassplayerdoc.wordpress.com/2008/07/25/did-you-check-your-msdb-dbo-suspect_pages-after-a-database-restore</guid>

				<description><![CDATA[&#62;In SQL Server 2005, the default behavior of a RESTORE command is to simply continue even if there are corrupted pages in your backups. The only way to find out if there are corruptions is when a user gives you a call saying that they could not query some records and probably gets an error [&#8230;]]]></description>
					<content:encoded><![CDATA[<p>&gt;<span style="font-family:arial;">In SQL Server 2005, the default behavior of a RESTORE command is to simply continue even if there are corrupted pages in your backups. The only way to find out if there are corruptions is when a user gives you a call saying that they could not query some records and probably gets an error similar to the one below</span><br /><span style="font-family:arial;"><br /><strong><span style="font-size:85%;color:#cc0000;"><em>Msg 824, Level 24, State 2, Line 1<br />SQL Server detected a logical consistency-based I/O error:<br />incorrect checksum (expected: 0xf93a020c; actual: 0xf93a820c).<br />It occurred during a read of page (1:69) in database ID 10 at offset 0x0000000013c000 in file<br />&#8216;C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataSalesDB.mdf&#8217;.<br />Additional messages in the SQL Server error log or system event log may provide more detail.<br />This is a severe error condition that threatens database integrity and must be corrected immediately.</em></span></strong></p>
<p>The first thing you need to do after a database restore is to check the <strong><span style="font-size:85%;">MSDB.dbo.suspect_pages</span></strong> to see if there are suspect pages that need to be repaired. Books Online describes the structure of this system table and gives you an idea on what to restore should there be suspect pages. Bear in mind though that this system table can only hold up to a maximum of 1000 records and everything get cycled out so you need to do your own housekeeping.</p>
<p>The Enterprise Edition gives you an option to do a page-level restore should you have corrupt databases. A more low-level discussion on fixing damaged pages can be found on the <a href="http://blogs.msdn.com/sqlserverstorageengine/archive/2007/01/18/fixing-damaged-pages-using-page-restore-or-manual-inserts.aspx">SQL Server Storage Engine blog</a></span><br /></span></p>
<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/92377218009570869-2945273847715928583?l=bassplayerdoc.blogspot.com' alt='' /></div>
]]></content:encoded>
			

		<wfw:commentRss>https://www.edwinmsarmiento.com/did-you-check-your-msdb-dbo-suspect_pages-after-a-database-restore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
				<post-id xmlns="com-wordpress:feed-additions:1">123</post-id>	</item>
	</channel>
</rss>