Solved

migrating sql databases to new server

Posted on 2014-09-08
6
121 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 47

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

786 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