Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

migrating sql databases to new server

Posted on 2014-09-08
6
Medium Priority
?
130 Views
Last Modified: 2014-12-09
I have 2 SQL servers running Windows 2003 and SQL 2005.  The user accounts and SA (I dont know what the SA passwords are, someone long time ago did the installs and didnt document them) on the existing 2 servers are different.  I have a new server running Windows 2012 R2 and am installing SQL 2008 R2 w/SP2.  Trying to find some documentation/steps to migrate the databases on SQL servers 1 and 2 to the new SQL server.

The applications using the SQL databases are:  MIP eSite and Raiser's Edge.
0
Comment
Question by:supprteng
6 Comments
 
LVL 53

Expert Comment

by:Vitor Montalvão
ID: 40311785
You have access to the old databases?
If so, I would run the SQL Server 2008R2 Upgrade Advisor on those databases to see what are the issues if you migrate them. Once the issues are resolved (if it found some) then a simple backup and restore in the new server will solve your problem.

Do not forget to migrate the databases users as well. I don't think SA will be needed since is not a good practice to use that user for applications.
0
 
LVL 35

Expert Comment

by:David Todd
ID: 40313078
Hi,

Additionally to what Vitor said, if you need to migrate a large number of user accounts (logins) look up the appropriate sp_help_revlogin procedure and apply that.

Do check out the post restore on 2008 tasks - sp_updateusage(?), update stats and the like, check the database compatibility setting, the page recovery setting as well.

HTH
  David
0
 
LVL 16

Expert Comment

by:DcpKing
ID: 40313520
Get hold of the company blackbaud in Charleston, SC. Thay make The Raisers' Edge and may be able to help you here.

hth

Mike
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:supprteng
ID: 40350915
The KB article for moving DBs between machines is simple.  The problem I have is running the restore to the new server.

1) Original server is Windows 2003 with SQL 2005
2) New server is Windows 2012 with SQL 2008 R2.  

I backup the DB on the Original Server and copy the bak to the New Server. Using the Restore utility in SQL I get WITH MOVE errors.  See below:

Command:
RESTORE DATABASE [re7] FROM  DISK = N'E:\AD\Test.bak' WITH  FILE = 1,  MOVE N'DB_2' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf',  MOVE N're7_bio' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf',  MOVE N're7_gift' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf',  MOVE N're7_index' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf',  MOVE N're7_temp' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf',  MOVE N'DB_2_log' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7_1.ldf',  NOUNLOAD,  REPLACE,  STATS = 10
GO

Error Result:
Msg 3176, Level 16, State 1, Line 1
File 'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf' is claimed by 're7_bio'(3) and 'DB_2'(1). The WITH MOVE clause can be used to relocate one or more files.
Msg 3176, Level 16, State 1, Line 1
File 'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf' is claimed by 're7_gift'(4) and 'DB_2'(1). The WITH MOVE clause can be used to relocate one or more files.
Msg 3176, Level 16, State 1, Line 1
File 'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf' is claimed by 're7_index'(5) and 'DB_2'(1). The WITH MOVE clause can be used to relocate one or more files.
Msg 3176, Level 16, State 1, Line 1
File 'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7.mdf' is claimed by 're7_temp'(6) and 'DB_2'(1). The WITH MOVE clause can be used to relocate one or more files.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
0
 
LVL 35

Accepted Solution

by:
David Todd earned 2000 total points
ID: 40351052
Hi,

Your restore command is meaningless. Let me write the first bit in plain English. Restore database called re7 from this disk file, move the logical file db_2 to the physical file re7.mdf, move the logical file re7_bio and trash the physical file of re7.mdf, etc.

The mistake is that you have re-used the re7.mdf physical file in the one command.

Try this:
RESTORE DATABASE [re7] 
FROM  DISK = N'E:\AD\Test.bak' 
WITH  
    FILE = 1
	, replace 
	, MOVE N'DB_2' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7_data.mdf'
	, MOVE N're7_bio' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7_bio.ndf'
	, MOVE N're7_gift' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7_gift.ndf'
	, MOVE N're7_index' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7_index.ndf'
	, MOVE N're7_temp' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7_temp.ndf'
	, MOVE N'DB_2_log' TO N'E:\SQLDatabases\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\re7_log.ldf'
	, STATS = 10
 GO

Open in new window


Note that the secondary data files have ndf as a file extension, that each physical file is unique, that each clause is on its own line.

HTH
  David

PS Test first before applying to production, etc.
0
 
LVL 3

Expert Comment

by:smilieface
ID: 40439122
And to recover the SA account password requires a brief outage.

http://technet.microsoft.com/en-us/magazine/jj853293.aspx
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

578 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