User login problem after restoring DB in MSSQL 2005
After doing a restore of a DB from file it can happened that the database users are no longer linked with the servers login users. This problem will result in a db user being able to log in but not to access the databases.
To check for problem use the following code, change TargetDB to the target database and username with the user.
use master
go
select name as sqllogin,sid as serversid from sys.syslogins where [name] = 'username'
use TargetDB
go
select name as databaseid, sid as databasesid from sysusers where [name] = 'username'
go
use TargetDB
go
sp_change_users_login @Action='Report'
go
Compare serversid and databaseid, if not equal then run
use TargetDB
go
sp_change_users_login @Action='update_one',
@UserNamePattern='username',
@LoginName='username'
go
Read more here
To check for problem use the following code, change TargetDB to the target database and username with the user.
use master
go
select name as sqllogin,sid as serversid from sys.syslogins where [name] = 'username'
use TargetDB
go
select name as databaseid, sid as databasesid from sysusers where [name] = 'username'
go
use TargetDB
go
sp_change_users_login @Action='Report'
go
Compare serversid and databaseid, if not equal then run
use TargetDB
go
sp_change_users_login @Action='update_one',
@UserNamePattern='username',
@LoginName='username'
go
Read more here
Vpranmesump_he Khaled Marte https://wakelet.com/wake/qiQSaZLE6obBrj8bGDTDH
ReplyDeletekennbeadsmorab
stelaccalse Jayson Sandell Camtasia Studio
ReplyDeleteNetBalancer
FL Studio
fthehmuncakal
promobMcont_mi_1982 Jodi Baker Best
ReplyDeleteget
rumdowncycrea