ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister


Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters




General discussions > Public newsgroups > microsoft.public.sqlserver.server > Can't restore a DB to a new server. Error 21002 User already exists

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread



Author Can't restore a DB to a new server. Error 21002 User already exists
S49
Guest




Registered: Not Yet
Location:
Country:
State:
Certifications:
Working on:

Total Posts: N/A
Can't restore a DB to a new server. Error 21002 User already exists

MS Win2000 SP3
MS SQL Server 2000

I have a database called SALES on a test server. I have backed up this
database.

I have moved the physical file created by the backed to a live server.

I create a new empty database called SALES on the live server.

I restore the backedup database into the SALES database on the live server.

Success.

All tables in the SALES database are owned by the user SALESOWNER.

I attempt to create a login SALESOWNER for this user but the it always
returns Error 21002 User already exists when I click the permit checkbox for
database access.

I have also tried creating the login first then, the create the SALES db and
give permit access to the login. This works, however once I restore the
database permit access is revoke and an attempt to reapply it fails with the
same message.

Any help would be appreciated on this.

Thx


Report this post to a moderator

Old Post 10-31-02 04:23 PM
Reply w/Quote Edit/Delete Message IP: Logged
Don Peterson
Guest




Registered: Not Yet
Location:
Country:
State:
Certifications:
Working on:

Total Posts: N/A
Re: Can't restore a DB to a new server. Error 21002 User already exists

You have an "orphaned user". Users are stored at the database level so when
you moved the database, you moved the users defined for it. However, Logins
are stored in the Master DB. This means that the users in you database are
not mapped to valid logins in Master.

execute sp_change_users_login 'update_one','<username>','<login>'

Obviously, the login must already exist.
This remaps the user to a login and solves the problem...

"S49" <s49@s49.com> wrote in message news:ezGp1aPgCHA.1760@tkmsftngp12...
> MS Win2000 SP3
> MS SQL Server 2000
>
> I have a database called SALES on a test server. I have backed up this
> database.
>
> I have moved the physical file created by the backed to a live server.
>
> I create a new empty database called SALES on the live server.
>
> I restore the backedup database into the SALES database on the live

server.
>
> Success.
>
> All tables in the SALES database are owned by the user SALESOWNER.
>
> I attempt to create a login SALESOWNER for this user but the it always
> returns Error 21002 User already exists when I click the permit checkbox

for
> database access.
>
> I have also tried creating the login first then, the create the SALES db

and
> give permit access to the login. This works, however once I restore the
> database permit access is revoke and an attempt to reapply it fails with

the
> same message.
>
> Any help would be appreciated on this.
>
> Thx
>
>



Report this post to a moderator

Old Post 10-31-02 05:23 PM
Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply


Forum Jump:
Rate This Thread:
Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is OFF.
 

ExamNotes forum archive


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps