All jobs / Database administrator / Security
Database administrator interview question · 0–1 years
What is the difference between a server-level login and a database-level user, and why does it bite you after a restore?
The strongest answer
The login authenticates to the instance; the user lives in one database and holds the permissions. Restore that database elsewhere and the users arrive without their logins, so they must be remapped
Why it works
Right — authentication at the instance, authorisation inside the database, and the mapping between them is what a restore leaves dangling.
What a good answer covers
- Login: authenticate to the instance.
- User: permissions inside one database.
- Restores leave users orphaned.
- Recreate and remap, do not over-grant.
Answers that fall short
- Close, but not the strongest: One is at server level and the other at database level, so after a restore you have to sort the permissions out again
True, but naming the symptom — orphaned users whose login does not exist on this server — is what shows you have done it. - Weak: They are the same account seen from two places, so restoring a database brings the account along with it
Only what lives inside the database travels with it; the server-level principal stays behind. - Red flag: I work around it by giving the application account server-wide rights, so restores never break access
Widening privileges to skip a mapping step trades a large security hole for a small convenience.
Who gets asked this
More Security questions
- A developer asks for the application account to have superuser or db_owner rights “so nothing blocks the…
- The whole team logs in with one shared admin account. What is wrong, and what do you propose?
- Security asks for “the database to be encrypted”. What do you actually put in place?
- HR asks who changed a salary value last Tuesday. Can you answer, and what would you set up?
- Developers want a copy of the production database in staging. Conditions?
- How do you rotate the application’s database password without downtime?
- On an instance you have inherited, permissions are granted directly to dozens of named accounts, each set…
- At three in the morning the application account starts running large SELECTs over the customer table from an…