Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Log Shipping User permission

Author  Topic 

Westley
Posting Yak Master

229 Posts

Posted - 2005-10-11 : 22:14:59
Hi all,
Just wondering, If I have a log shipping DB to another server (server B), then if I would like to create a user on Server B that have read-only access (it'll be read-only anyway since the DB is read-only), but since the DB is in read-only mode, I cannot assign user to that DB at all, I tried to create the user from ServerA, and let it log ship to Server B, but its not mapping the sid i think, as it still cannot use the new user created? is there anything that can help?
Thanks,

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-10-12 : 01:33:03
Yes you'll need to create the login on the primary server first. Add the user to the database on the primary server and grant it read_only database role. Then run this query from the primary:

ET NOCOUNT ON
SELECT 'EXEC sp_addlogin @loginame = ''' + loginname + ''''
,', @defdb = ''' + dbname + ''''
,', @deflanguage = ''' + language + ''''
,', @encryptopt = ''skip_encryption'''
,', @passwd ='
, cast(password AS varbinary(256))
,', @sid ='
, sid
FROM syslogins
WHERE name = 'UserIdGoesHere'

Copy the output into a QA window that is connected to the secondary server. Run the query. The sids are now synched up.

Tara
Go to Top of Page

Westley
Posting Yak Master

229 Posts

Posted - 2005-10-12 : 02:13:47
Thanks, that works great.
Go to Top of Page
   

- Advertisement -