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

Loading Users into instance security Expand / Collapse
Author
Message
Posted Tuesday, March 19, 2013 7:57 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 1:05 PM
Points: 321, Visits: 571
We are moving from a server with SQL server 2005 to one with SQL server 2008. Is there any way to script a bulk load of users into the instance security? I have mounted the databases, from backup, but need to get the users set-up in the instance. With over 1,000 users this would take a while going through the SSMS GUI interface.
Post #1432661
Posted Tuesday, March 19, 2013 9:41 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:34 AM
Points: 7,098, Visits: 12,606
I am assuming you meant Logins and not Users. Users are at the database level and are stored within the databases themselves so should come over when you restore the backups to the new instance.

To bring the Server Logins across you'll want to make sure you maintain the SIDs for the SQL Server-authentication-based Logins, else the Users in all your databases linked to those Logins on the new instance will be orphaned. You can do this by following this article:

How to transfer logins and passwords between instances of SQL Server


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1432745
Posted Thursday, March 28, 2013 9:29 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 1:05 PM
Points: 321, Visits: 571
Yep that is it. Thanks.
Post #1436553
Posted Thursday, March 28, 2013 11:14 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:34 AM
Points: 7,098, Visits: 12,606
My pleasure. One item of note, the revlogin proc does not pickup Fixed Server Role membership. Here is a query you can adapt to pickup those memberships as well. I actually have it incorporated in a custom version of the revlogin proc I use. I would share the whole thing but it has some other items in it that are specific to my utiltiy database so it's not easily shareable.

SELECT  'EXEC master.sys.sp_addsrvrolemember @loginame = ''' + SUSER_SNAME(r.sid) + ''', @rolename = ''' + p.name + ''';
'
FROM master.sys.server_principals r
JOIN master.sys.server_role_members m ON r.principal_id = m.member_principal_id
JOIN master.sys.server_principals p ON m.role_principal_id = p.principal_id;



__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1436626
Posted Thursday, March 28, 2013 2:37 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 1:05 PM
Points: 321, Visits: 571
Thanks... our roles are simple, but that does save a bunch of key strokes.
Post #1436745
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse