Home All Groups Group Topic Archive Search About

user accounts after restore in SQL 2000

Author
19 Jan 2006 11:38 PM
Vasya
We have 2 SQL servers: PROD and TEST. Obviously, the TEST is a test
environment for PROD. Both of them identical and have same user accounts with
same permissions. When there is a need to backup PROD and restore it to TEST
are there any manipulations with user accounts need to be done?
My superior says that after restoring database in TEST, user accounts have
to be deleted by opening Database/Users (quote: not from Security/Logins),
then they have to be deleted from Security/Logins, and finally, they have to
be recreated from Database/Users/New Database user and same permissions as
before applied. He says that after restoring a database, user accounts "don't
get linked to the database properly".
I think that there is nothing to worry about  after restoration since those
accounts already existed on TEST, so they all should work just fine.

Can someone knowledgeable give some "scientific" explanation to this?

Author
20 Jan 2006 12:35 AM
Tom Moreau
Check out sp_change_users_login in the BOL.

--
    Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON   Canada
www.pinpub.com

"Vasya" <Va***@discussions.microsoft.com> wrote in message
news:34FBBCBF-1D87-4D06-AB3A-6F0CF9654A61@microsoft.com...
We have 2 SQL servers: PROD and TEST. Obviously, the TEST is a test
environment for PROD. Both of them identical and have same user accounts
with
same permissions. When there is a need to backup PROD and restore it to TEST
are there any manipulations with user accounts need to be done?
My superior says that after restoring database in TEST, user accounts have
to be deleted by opening Database/Users (quote: not from Security/Logins),
then they have to be deleted from Security/Logins, and finally, they have to
be recreated from Database/Users/New Database user and same permissions as
before applied. He says that after restoring a database, user accounts
"don't
get linked to the database properly".
I think that there is nothing to worry about  after restoration since those
accounts already existed on TEST, so they all should work just fine.

Can someone knowledgeable give some "scientific" explanation to this?
Are all your drivers up to date? click for free checkup

Author
20 Jan 2006 1:07 AM
Vasya
I did. The key word is "MAY".

If you restore a database on a different instance of SQL Server than the one
on which the backup was created, you MAY need to run sp_change_users_login to
update user login information. For more information, see
sp_change_users_login.

May or may not. The instance is different, but it has absolutely same
account as the server on which the backup was created... After restoring, I
can see that the account is there with correct permissions... Will it work?
Author
20 Jan 2006 2:47 AM
Geoff N. Hiten
"Account" doesn't really have a meaning within SQL Server.  You have logins,
which allow you to connect to the server, and users, which control
permissions within a database.  Users and Logins are linked via Security
Identifiers (SIDs).  When you restore a database to a new environment, the
users and corresponding permissions permissions exist as they were on the
source server.  The users are no longer linked to particular logins, even if
the logins and users have the same names.  This is intentional to avoid
accidentally granting access to a restored database.  sp_change_users_logins
allows you to link an existing database user to a server login and is
specifically intended for use in cross-server restores

--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP

..

Show quoteHide quote
"Vasya" <Va***@discussions.microsoft.com> wrote in message
news:4098ED48-5B7C-4AA0-A244-89AB3EE547ED@microsoft.com...
>I did. The key word is "MAY".
>
> If you restore a database on a different instance of SQL Server than the
> one
> on which the backup was created, you MAY need to run sp_change_users_login
> to
> update user login information. For more information, see
> sp_change_users_login.
>
> May or may not. The instance is different, but it has absolutely same
> account as the server on which the backup was created... After restoring,
> I
> can see that the account is there with correct permissions... Will it
> work?

Bookmark and Share