Solved

How to restore a database

Posted on 2013-11-21
5
198 Views
Last Modified: 2013-12-05
Trying to migrate an SQL database to a different server computer. I have backed up the database to a .bak file. When I try to restore, in the new SQL server (microsoft) it asks for which database to restore to. Do I create a blank database first? And should the blank database be the same name as the old one?
0
Comment
Question by:bobox00
5 Comments
 
LVL 12

Expert Comment

by:Tony303
ID: 39667038
You don't need to create a new Db first.
You can restore it from the backup file you are using, you can rename the DB here too if you wish.

Check the path of the ldf and mdf file locations, are they the correct place for your log and data files on your server you are restoring on?

The last part is important too.
Goto the options tab (I am presuming you are using SSMS to do all this), and select the "leave database ready to use...." radio button.

Tony.
0
 
LVL 9

Expert Comment

by:QuinnDex
ID: 39667089
it is much easier just to create a blank DB you can name it what you want and then restore to that...
0
 
LVL 26

Accepted Solution

by:
Zberteoc earned 500 total points
ID: 39667158
Either way you will have to map the .mdf data file and .ldf log file over to the new locations on the new server.

If the database doesn't exist on the target server, in the destination text box in the restore window it will show the original database name anyway and it will be created for you automatically.
0
 
LVL 1

Expert Comment

by:BradySQL
ID: 39668271
I'm a T-SQL nut so here is what I would do.

RESTORE DATABASE [DatabaseName] FROM  DISK = N'E:\DatabaseName.bak' WITH  FILE = 1,  MOVE N'DatabaseName' TO N'E:\SQLData\DatabaseName.mdf',  MOVE N'DatabaseName_log' TO N'F:\SQLData\DatabaseName.LDF',  NOUNLOAD,  STATS = 1

If you are not sure of the filenames to move them you can run

RESTORE FILELISTONLY FROM  DISK = N'E:\DatabaseName.bak'

This will give you any info that you need to use with your MOVE statement.
0
 

Author Closing Comment

by:bobox00
ID: 39699084
Thanks
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

821 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