all groups > sql server replication > november 2004 >
You're in the

sql server replication

group:

sysusers and syspermissions



sysusers and syspermissions Jordan Lan
11/30/2004 1:17:01 PM
sql server replication: We are trying to implement a warm stand-by sql server, but after initializing
a new push subscription, neither the users no the table permissions are being
transferred.

Isn't the snapshot be responsible for those (sysusers and syspermissions)
tables?

Re: sysusers and syspermissions Hilary Cotter
11/30/2004 9:22:02 PM
No, you have to script it out and apply it as a post snapshot command or use
sp_addscriptexec to run the script on all unc deployed subscribers.

--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
[quoted text, click to view]

sysusers and syspermissions Paul Ibison
12/1/2004 4:17:20 AM
As Hilary mentions, this process is manual to an extent.
I have a constantly changing environment, and in order to
save time, I generate the permissions script
automatically. The script I use is below:
SELECT 'Grant ' +
case
when action = 193 then 'SELECT'
when action = 195 then 'INSERT'
when action = 196 then 'DELETE'
when action = 197 then 'UPDATE'
when action = 224 then 'EXECUTE'
end as Grant1,
' ON [' + delivery.dbo.sysobjects.name + '] TO ' +
delivery.dbo.sysusers.name as Grant2
--,ss.srvname
--,delivery.dbo.syspublications.name AS Publication
FROM delivery.dbo.syssubscriptions
INNER JOIN delivery.dbo.sysextendedarticlesview ON
delivery.dbo.syssubscriptions.artid =
delivery.dbo.sysextendedarticlesview.artid
INNER JOIN delivery.dbo.sysobjects ON
delivery.dbo.sysextendedarticlesview.objid =
delivery.dbo.sysobjects.id
INNER JOIN delivery.dbo.syspublications ON
delivery.dbo.sysextendedarticlesview.pubid =
delivery.dbo.syspublications.pubid
INNER JOIN master..sysservers ss on ss.srvid =
delivery.dbo.syssubscriptions.srvid
left outer JOIN delivery.dbo.sysprotects on
delivery.dbo.sysprotects.id = delivery.dbo.sysobjects.id
left outer JOIN delivery.dbo.sysusers on
delivery.dbo.sysprotects.uid = delivery.dbo.sysusers.uid
where action in (193,195,196,197,224)
--and srvname = 'xxx\PDSCOPY'
and srvname = 'yyy\PDSCOPY'
order by ss.srvname, delivery.dbo.syspublications.name,
delivery.dbo.sysobjects.name, delivery.dbo.sysusers.name

You could also script out the logins and users, add this
all into a script file and then run this script
automatically either as the post-snapshot script or using
a jobstep to run sp_addscriptexec.

HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
RE: sysusers and syspermissions Jordan Lan
12/3/2004 8:45:02 AM
Thank you Hilary and Paul - I realized now that sysusers and syspermission
are not being replicated.

Do I need to change anything in your script to make it work besides the
"delivery." portion? If I run it, it won't return anything.

I managed to transfer the sysusers by restoring a backup from the
distribution and initializing. syspermission did not survive the
initialization.

I understand that I need to run manual scripts to make this happen. Is there
anywhere I can find proven working scripts for a warm stand-by server? I
guess that should be a common setup.

[quoted text, click to view]
Re: sysusers and syspermissions Paul Ibison
12/3/2004 8:19:23 PM
Copying the logins, creating the users then running the permission script
should be enough. Once the first 2 have been done (be sure that the logins
and users are linked, and use sp_change_users_login if not) then it's only
the third step that is necessary.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Re: sysusers and syspermissions Jordan Lan
12/9/2004 12:23:03 PM
Is there any step-by-step guide (for dummies) explaining this available
online? How am I supposed to copy the logins? DTS won't show sysusers. Where
can I find the permission script?
Thanks

[quoted text, click to view]
Re: sysusers and syspermissions Paul Ibison
12/10/2004 7:22:34 PM
Jordan,
to copy logins I use sp_help_revlogin, which is detailed here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;246133
There are various ways to script users, but the easiest is to use Enterprise
Manager. Right-click on a database and select All Tasks, Generate SQL
Script. On the options tab select to script database users and database
roles.
HTH
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Re: sysusers and syspermissions - may be a problem with this. rmartin NO[at]SPAM trammellcrow.com
3/3/2005 9:45:08 AM
Hello Paul,
I read this post and thought I might point something out I saw. I
encountered an problem with Enterprise Manager using the "Generate SQL
Script" function last week. The Server is a W2k3 server with SQL 2000 SP3a.
Enterprise Manager won't "Generate SQL Scripts" if you only choose "DROP"
under formatting and then any combination under the "security scripting
options." I've tried to find a way to let MS know, but haven't run across it
yet. If you want to see what I'm talking about, Try it and let us know if
it's some anomaly on our servers or an defect. I've tried it on several
servers.
Thanks.

[quoted text, click to view]
Re: sysusers and syspermissions - may be a problem with this. Randy Martin
3/4/2005 11:55:01 AM
I select the Database in Enterprise Manager:
right click on the db, select "All Tasks", Select "Generate SQL Script"
Select the "Formatting" tab
Uncheck the "Generate the CREATE <object> command for each object" box
Check the "Generate scripts for all dependent objects"
Select the "Options" tab
Check the "Script database users and database roles" box
Check the "Script object-level permissions" box
Select the "OK" button.
The file it creates contains nothing. At least on my servers that's what
happens.
Hope someone can figure this out.

[quoted text, click to view]
Re: sysusers and syspermissions - may be a problem with this. Randy Martin
3/4/2005 12:31:03 PM
Wow, never saw that, significant product limitation. A "feature" perhaps?
hehehe

Thanks Paul.

[quoted text, click to view]
Re: sysusers and syspermissions - may be a problem with this. Paul Ibison
3/4/2005 6:37:43 PM
Hi Martin,
I just tried to reproduce this using Northwind. I selected all tables, drop
and script database and it worked fine. Please can you tell me exactly what
you selected which made it fail and I'll give it another go.
Rgds,
Paul

"rmartin@trammellcrow.com"
[quoted text, click to view]

Re: sysusers and syspermissions - may be a problem with this. Paul Ibison
3/4/2005 8:15:13 PM
Hi,

although misleading, the help describes what's happening:

"Generate the DROP <object> command for each object" as Generate a
Transact-SQL statement to drop each object you selected on the General tab.

So, it isn't intended to apply to logins, roles, users etc.

Rgds,
Paul

AddThis Social Bookmark Button