Solved

How to restore a database

Posted on 2013-11-21
5
196 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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tempdb latch contention 12 48
How to identify differences between 2 backup files? 7 30
Get Duration of last Status Update 4 30
sql Total query 2 16
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
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.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

910 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

16 Experts available now in Live!

Get 1:1 Help Now