Monday, February 13, 2012

About loginid anf userid

Hi guys,
I backup a database and restore it to different server. In the diffrent
server, after I restore database, the userid has been reserved, but loginid
has been lost. I want to creat loginid which should be same as oraginal
server and map it to the userid that is existed. I don't want to re-create
the userid because It has too much trouble. I don't know how to do that.
Could anybody help me? Thanks.
Jerry MuThis one may help.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ca-cz_8qzy.asp
--
Regards,
Dave Patrick ...Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"Iter" wrote:
| Hi guys,
| I backup a database and restore it to different server. In the diffrent
| server, after I restore database, the userid has been reserved, but
loginid
| has been lost. I want to creat loginid which should be same as oraginal
| server and map it to the userid that is existed. I don't want to re-create
| the userid because It has too much trouble. I don't know how to do that.
| Could anybody help me? Thanks.
|
| Jerry Mu
||||For a Windows login, all you need to do is create the login and it will
automatically be mapped to the user:
SQL 2000:
EXEC sp_grantlogin 'MyDomain\MyUser'
SQL 2005:
CREATE LOGIN 'MyDomain\MyUser' FROM WINDOWS;
For a SQL login, you can remap the user to a login using the
sp_change_users_login stored procedure. For example:
USE MyDatabase
EXEC sp_change_users_login 'Update_One', 'MyUser', 'MyLogin'
See the Books Online for more information.
Hope this helps.
Dan Guzman
SQL Server MVP
"Iter" <Iter@.discussions.microsoft.com> wrote in message
news:3B2995EC-7F84-4983-A28D-F27D6A0CB66F@.microsoft.com...
> Hi guys,
> I backup a database and restore it to different server. In the diffrent
> server, after I restore database, the userid has been reserved, but
> loginid
> has been lost. I want to creat loginid which should be same as oraginal
> server and map it to the userid that is existed. I don't want to re-create
> the userid because It has too much trouble. I don't know how to do that.
> Could anybody help me? Thanks.
> Jerry Mu
>|||Google for sp_help_revlogin.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Iter" <Iter@.discussions.microsoft.com> wrote in message
news:3B2995EC-7F84-4983-A28D-F27D6A0CB66F@.microsoft.com...
> Hi guys,
> I backup a database and restore it to different server. In the diffrent
> server, after I restore database, the userid has been reserved, but loginid
> has been lost. I want to creat loginid which should be same as oraginal
> server and map it to the userid that is existed. I don't want to re-create
> the userid because It has too much trouble. I don't know how to do that.
> Could anybody help me? Thanks.
> Jerry Mu
>

No comments:

Post a Comment