<?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>Przemysław Łukawski&#039;s blog &#187; SQL Server</title>
	<atom:link href="http://p-lider.lideve.eu/wordpress/?cat=15&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://p-lider.lideve.eu/wordpress</link>
	<description>Solutions for IT technical problems admins and developers may face with.</description>
	<lastBuildDate>Tue, 23 Sep 2014 18:29:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.22</generator>
	<item>
		<title>Mapping orphaned database users to SQL Server 2005 logins</title>
		<link>http://p-lider.lideve.eu/wordpress/?p=93</link>
		<comments>http://p-lider.lideve.eu/wordpress/?p=93#comments</comments>
		<pubDate>Mon, 04 Oct 2010 10:51:49 +0000</pubDate>
		<dc:creator><![CDATA[p_lider]]></dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://p-lider.rootnode.net/wordpress/?p=93</guid>
		<description><![CDATA[If you have many users defined in your MS SQL Server 2005 database, then if you will backup your database and then restore in a new, clean SQL Server instance, you will not be able to map database users with logins in your SQL Server instance. This is because of different SID numbers between the source [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>If you have many users defined in your MS SQL Server 2005 database, then if you will backup your database and then restore in a new, clean SQL Server instance, you will not be able to map database users with logins in your SQL Server instance. This is because of different SID numbers between the source and destination SQL Server instances. So even creating logins named exactly the same as users in a restored database will not help.</p>
<p>Fortunately, I found a solution. The SQL scipt below will map orphaned users in databases to logins in SQL Server instance even when their SIDs do not match:</p>
<p>sp_change_users_login @Action=&#8217;update_one&#8217;,<br />
@UserNamePattern=&#8217;<em>&lt;database user name&gt;</em>&#8216;,<br />
@LoginName=&#8217;<em>&lt;sql server instance login name&gt;</em>&#8216;<br />
GO</p>
]]></content:encoded>
			<wfw:commentRss>http://p-lider.lideve.eu/wordpress/?feed=rss2&#038;p=93</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
