September 10, 2012 at 5:28 am
So I have restored a database to a new server and a check reveals a DB-user being orphaned. However, this user must have been created as CREATE USER WITHOUT LOGIN, for on the original server this user is not connected with a login.
Now, how do I solve the orphaned user? Is there a problem, I wonder, since there was no login in the first place? sp_change_users_login does not work here, for it needs a login to connect the db-user with.
Any help?
Greetz,
Hans Brouwer
September 10, 2012 at 5:42 am
FreeHansje (9/10/2012)
So I have restored a database to a new server and a check reveals a DB-user being orphaned. However, this user must have been created as CREATE USER WITHOUT LOGIN, for on the original server this user is not connected with a login.Now, how do I solve the orphaned user? Is there a problem, I wonder, since there was no login in the first place? sp_change_users_login does not work here, for it needs a login to connect the db-user with.
Any help?
there's nothing to fix;
if you create a user without login, it literally never logs in...so there is nothing to change.
you might create a user like that so that you can run EXECUTE AS under higher permissions in a procedure or trigger, but noone will ever use that USER to actually connect.
If you need an example, let me know, but you should be good to go if you fixed the other users that do have logins.
Lowell
September 10, 2012 at 7:33 am
Tnx, I figured that much, but it is good to read confirmatiuon.
Greetz,
Hans Brouwer
September 11, 2012 at 3:14 am
The user may have been created as a login as normal and given database permissions but then if the server login was deleted the user would be left in the database I believe.
If users were sql logins in the database and valid on the old server you need to create the sql logins on the new server and just default them to master database then run sp_change_users_login to link the server login to the database login
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply