Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Scripting out permission for database? Expand / Collapse
Author
Message
Posted Wednesday, November 14, 2012 9:34 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
Hi All,

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

thanks in advance.
Post #1384732
Posted Wednesday, November 14, 2012 9:43 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:41 AM
Points: 12,902, Visits: 32,140
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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1384734
Posted Wednesday, November 14, 2012 9:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
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..
Post #1384743
Posted Wednesday, November 14, 2012 10:25 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:45 AM
Points: 5,872, Visits: 12,976
try this, exactly what you want.

read the discussion afterwards as well


---------------------------------------------------------------------

Post #1384758
Posted Wednesday, November 14, 2012 2:32 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
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.
Post #1384868
Posted Wednesday, November 14, 2012 2:34 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, September 19, 2014 5:16 AM
Points: 887, Visits: 1,774
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

Jeremy Oursler
Post #1384869
Posted Wednesday, November 14, 2012 4:15 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:45 AM
Points: 5,872, Visits: 12,976
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?


---------------------------------------------------------------------

Post #1384918
Posted Thursday, November 15, 2012 8:24 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 16, 2014 10:44 AM
Points: 153, Visits: 583
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.

Post #1385195
Posted Thursday, November 15, 2012 8:37 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:45 AM
Points: 5,872, Visits: 12,976
have you looked at the link i posted?

---------------------------------------------------------------------

Post #1385204
Posted Thursday, November 15, 2012 9:22 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:41 AM
Points: 12,902, Visits: 32,140
Georges link again for clarity:
http://www.sqlservercentral.com/scripts/Permissions/76450/


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1385238
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse