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
 General SQL Server Forums
 New to SQL Server Administration
 restoring databases and recreating user and roles

Author  Topic 

JSK
Starting Member

1 Post

Posted - 2012-02-02 : 05:03:07
Hello,

I will restore several databases (.bak files) to a different SQL server. All databases are related to each other. I was told, after I restored the databases I have to delete the users under each database\Security\users. After this I should create new Logins under Security\Logins and map these users to my restored databases and define the role memberships.

1st: is there an easier way to do this
2nd: can I script my restore procedure to automate the restore

Thanks to all...

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-02-02 : 13:23:51
What you were told is not necessarily correct. You can easily work with the existing users by either matching up the sids or unorphaning them. Here are some options that'll match up the sids: http://weblogs.sqlteam.com/tarad/archive/2008/06/24/How-to-transfer-SQL-logins-between-SQL-Server-2005-instances.aspx

To automate the restore, have look at this blog article: http://weblogs.sqlteam.com/tarad/archive/2009/02/25/How-to-refresh-a-SQL-Server-database-automatically.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -