SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Scripting out permission for database?


Scripting out permission for database?

Author
Message
anzz
anzz
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1713 Visits: 704
Hi All,

moving databases from Prod to new server. And also want to carry forward permissions.
Need help on moving permissions.

thanks in advance.
Lowell
Lowell
SSC Guru
SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)

Group: General Forum Members
Points: 95839 Visits: 41179
you'll need to get a copy of sp_help_revlogin from microsoft; there are different versions, depending on 2000/2005, maybe even for 2008 and above, i don't quite remember.

assuming you are going to do a backup from Prod and Restore on the new server, you should be good with that...object permissions are stored int eh databases themselves, and the procedure above will carry the correct sids along with it, so that makes it fairly seamless.

don't forget all the other things on production, like certificates, linked servers,
and more; theres a current thread on side by side server migration you might want to peek at:

http://www.sqlservercentral.com/Forums/Topic1384265-391-1.aspx

Lowell
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
anzz
anzz
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1713 Visits: 704
Thanks for your replay,

If I am doing refresh from PROD to DEV.

I need take a backup script out permissions for a database before restoring in DEV.
and restore the permissions back in DEV, when the refresh is done.

So, I need help in scripting out permissions for a database..
george sibbald
george sibbald
SSC-Dedicated
SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)

Group: General Forum Members
Points: 31552 Visits: 13702
try this, exactly what you want.

read the discussion afterwards as well

---------------------------------------------------------------------
anzz
anzz
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1713 Visits: 704
It did'nt help....

I need help in scripting out permissions for a database.
Please don't say sp_help_revlogin: It gives list out all the logins on a server.
CapnHector
CapnHector
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4207 Visits: 1789
User permissions are stored in the database. If i take a backup of MyDatabase and restore it onto a different server all the permissions are going to be the same. the problem comes in when you create users on the new database machine, you will end up with "Orphaned" users in the database. You have two options you can use sp_help_revlogin or you can use ALTER USER http://msdn.microsoft.com/en-us/library/ms189828.aspx to map the orphaned users to a SQL Server login. Once you have mapped the Logins to Database users (or using sp_help_revlogin you do not have to go through this step as the SID's of the users will remain the same) all the permissions will be there.


For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden for the best way to ask your question.

For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw

Need to Split some strings? Jeff Moden's DelimitedSplit8K
Jeff Moden's Cross tab and Pivots Part 1
Jeff Moden's Cross tab and Pivots Part 2
george sibbald
george sibbald
SSC-Dedicated
SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)

Group: General Forum Members
Points: 31552 Visits: 13702
Danzz (11/14/2012)
It did'nt help....

I need help in scripting out permissions for a database.
Please don't say sp_help_revlogin: It gives list out all the logins on a server.


You asked for a script to list database permissions and that is exactly what it does, how did it not help?

---------------------------------------------------------------------
anzz
anzz
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1713 Visits: 704
sp_help_revlogin : List outs all the logins from the server,

I dont want all the logins.
I just need for a list all the logins in a database:

which include login, roles, grant permissions.

Any help is greatly appreciated..Thanks in advance.
george sibbald
george sibbald
SSC-Dedicated
SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)

Group: General Forum Members
Points: 31552 Visits: 13702
have you looked at the link i posted?

---------------------------------------------------------------------
Lowell
Lowell
SSC Guru
SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)SSC Guru (95K reputation)

Group: General Forum Members
Points: 95839 Visits: 41179
Georges link again for clarity:
http://www.sqlservercentral.com/scripts/Permissions/76450/

Lowell
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search