Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

migrating sql databases to new server

Posted on 2014-09-08
6
124 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 48

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

829 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