Re: User already exists in the database error

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 01/03/05


Date: Mon, 3 Jan 2005 23:11:58 +0100

I suggest you create the logins *with the correct SID* before restoring. To create them with the
correct sid, you first run sp_help_revlogin (which I mentioned in my prior post) on the originating
server.

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"John E Davis" <JohnEDavis@discussions.microsoft.com> wrote in message 
news:F865032F-B991-4B69-8906-DF51811A462E@microsoft.com...
> ONe last question on this issue, and then I will be done.
>
> Would it be a good idea to have the SQL logins created before restoring the
> database? I could then run the Stored Procedure to fix the orphaned user
> accounts.
>
> Let me know, I am just trying to find a way in order to match the users with
> the least amount of resistence.
>
> In any case, I need to have the users already created on the SQL server yes?
>
> "Kelly Herald" wrote:
>
>> Or download the program Sync SQL Logins found here: http://www.dbmaint.com/SyncSqlLogins.asp
>>
>> This program will make the task of matching logins much easier and quicker.
>>
>>
>>
>> "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in message 
>> news:%23zkXuAz7EHA.1400@TK2MSFTNGP11.phx.gbl...
>> > Name of the machine is irrelevant. Read up on the connection between sysusers and syslogins, 
>> > the
>> > "sid" column and it all should become clear to you. Also, I suggest you also check out
>> > sp_help_revlogin, which you can fins in MS KB.
>> >
>> > -- 
>> > Tibor Karaszi, SQL Server MVP
>> > http://www.karaszi.com/sqlserver/default.asp
>> > http://www.solidqualitylearning.com/
>> > http://www.sqlug.se/
>> >
>> >
>> > "John E Davis" <JohnEDavis@discussions.microsoft.com> wrote in message
>> > news:335566B8-B9DE-43F2-9792-4234A4782120@microsoft.com...
>> >> Even if the server that I restored it to, is the same exact name??
>> >>
>> >> Thanks for the earlier response though
>> >>
>> >> "Mark" wrote:
>> >>
>> >>> When you restore the database on another server, the users
>> >>> in the database now are orphaned. Check
>> >>> out 'sp_change_users_login' stored procedure.
>> >>>
>> >>>
>> >>> >-----Original Message-----
>> >>> >I have backed up the SQL database on server X.
>> >>> >
>> >>> >I have restored that database to server Y. This server
>> >>> was named the same as
>> >>> >server X and has the same IP. After restoring the
>> >>> database everything looks
>> >>> >fine, until I get ready to create users in the "Logins"
>> >>> section of Enterprise
>> >>> >Manager.
>> >>> >
>> >>> >Apparently the imported database already has the same
>> >>> user name associated
>> >>> >to it that I am trying to create and tells me that the
>> >>> user already exists. I
>> >>> >am unable to create the "Logins"
>> >>> >
>> >>> >Do you think I will get away if I create the "Logins"
>> >>> first and then restore
>> >>> >the database afterwards?
>> >>> >
>> >>> >Thanks
>> >>> >.
>> >>> >
>> >>>
>> >
>> > 


Relevant Pages

  • Re: Restore master?
    ... The Logins would come with Master but the users are stored in each db. ... Errors After Restoring Dump ... for SQL Server ...
    (microsoft.public.sqlserver.setup)
  • Re: Logins between SQL Databases on diff. servers.
    ... If they are NT logins and on the same domain you shouldn't have to do ... Errors After Restoring Dump ... for SQL Server ... > So how can I move the logins first with its passwords and SID? ...
    (microsoft.public.sqlserver.security)
  • Re: Disaster Recovery
    ... Errors After Restoring Dump ... for SQL Server ... > After i restored the master, msdb and user databases, do i have to drop ...
    (microsoft.public.sqlserver.setup)
  • Re: Logins (Sessions)
    ... Errors After Restoring Dump ... Issues When a Database Is Moved Between SQL Servers ... for SQL Server ...
    (microsoft.public.sqlserver.server)
  • Re: Cluster DR
    ... Restoring a cluster is almost exactly the same as restoring a stand-alone ... SQL Server service offline. ... Senior Database Administrator ...
    (microsoft.public.sqlserver.clustering)