Solved

Copy Master DB to new instance

Posted on 2010-09-17
4
614 Views
Last Modified: 2012-05-10
I want to make a copy of my production db so that we can use it as a pre-prodcution release scratchpad db.
I was able to make a restore of all the db which I've created, however I can't bring the Master db in as the version of SS of the scratchpad db is a different version of the Production even though they are both 2008.  
Do you know how I can accomplish this>  (I need to do this so that I have all the users which were created in production so that all the apps can be run against then new scratchpad db.
0
Comment
Question by:raphil
  • 2
4 Comments
 
LVL 15

Expert Comment

by:AmmarR
ID: 33702666
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 250 total points
ID: 33702678
Why are you trying to copy master database across servers or instances which is not recommended at all. To copy or transfer logins, run the script from here

http://support.microsoft.com/kb/918992
0
 

Author Comment

by:raphil
ID: 33842947
The above solution by rrjegan17 only creates the users, however it does not bring over the permissions and abilities to login to the db.  :(
I am looking to make an exact copy of one db with all the logins and permissions set. So that it can be used as a testbed.
0
 

Author Comment

by:raphil
ID: 33845807
I used stored proceudre 1 in this article from Pinal Dave which fixed the issue.
http://blog.sqlauthority.com/2007/02/15/sql-server-fix-error-15023-user-already-exists-in-current-database/

/*Following Stored Procedure will fix all the Orphan users in database
by mapping them to username already exist for user on server.
This SP is required when user has been created at server level but does
not show up as user in database.*/
CREATE PROCEDURE dbo.spDBA_FixOrphanUsers
AS
DECLARE @username VARCHAR(25)
DECLARE GetOrphanUsers CURSOR
FOR
SELECT UserName = name
FROM sysusers
WHERE issqluser = 1
AND (sid IS NOT NULL
AND sid <> 0x0)
AND SUSER_SNAME(sid) IS NULL
ORDER BY name
OPEN GetOrphanUsers
FETCH NEXT
FROM GetOrphanUsers
INTO @username
WHILE @@FETCH_STATUS = 0
BEGIN
IF @username='dbo'
EXEC sp_changedbowner 'sa'
ELSE
EXEC sp_change_users_login 'update_one', @username, @username
FETCH NEXT
FROM GetOrphanUsers
INTO @username
END
CLOSE GetOrphanUsers
DEALLOCATE GetOrphanUsers
GO

Open in new window

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now