Solved

How to restore a database

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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 setup several different housekeeping processes for a SQL Server.

758 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

17 Experts available now in Live!

Get 1:1 Help Now