Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to determine why is a Login is losing a User mapping?

I've created them with the following SQL ...

CREATE LOGIN [qauser] WITH PASSWORD = 'xxxx', DEFAULT_DATABASE = [app_tst],  
                           CHECK_EXPIRATION=OFF, CHECK_POLICY = OFF

CREATE USER [qauser] FOR LOGIN [qauser] WITH DEFAULT_SCHEMA = [devdba]

and then successfully used the matching login on a linked server with synonyms to tables in the original.

Some time later, the synonyms fail and checking the LOGIN properties, the User Mapping have gone for the database / user. I have to re-run the CREATE LOGIN / USER script to get them to work ... but using the main devdba login, the synonyms continues to work

What could be causing this loss ?

share|improve this question

migrated from Jun 17 '12 at 23:54

This question came from our site for professional and enthusiast programmers.

Are you restoring [app_tst] sometimes by any chance? – Josien Jun 15 '12 at 10:12
@Josien Not that I'm aware of, but it's not my server, and it's a "test" server, so you may well be right ... I'll check. – SteveC Jun 15 '12 at 11:08
Have you seen that article? – David Brabant Jun 15 '12 at 13:54
@DavidBrabant Nope, but I have now ... thanks for the pointer ... SPOT ON, there is a restore every morning from a copy of the live db. You should put this in as an answer, so I can vote it – SteveC Jun 15 '12 at 14:01
up vote 2 down vote accepted

From the post here (user mapping disappearing):

"The only time I have seen something like this happen, was when the application DBAs where restoring test scenario DB backups over the existing databases, without telling us SQL Server SysAdmins what they were doing. This would of course wipe out all of our later user mappings to those databases. So, you might want to check for something like that... "

And in the same thread, a pointer to a script for knowing when the database was last restored.

share|improve this answer
Again thanks for the help – SteveC Jun 15 '12 at 14:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.