Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Restoring a .bak file

Author  Topic 

furkank
Starting Member

1 Post

Posted - 2009-11-07 : 07:44:58
Well I am kind of a complete newbie,
There is a MDF file which has been backed-up to a .bak file.

I use SQL server 2005, and I completely have no clue how to run custom SQL commands to a Database, do I need to connect the database to recover a bak file?
How can I connect to a database that actually is not a database but a backup file...

Oh well, I kinda am completely lost here.

But I found this on the forums:

RESTORE DATABASE {your database} FROM DISK = 'c:\backups\northwind\nwind.bak'
WITH
MOVE 'northwind' TO 'd:\Program Files\Microsoft SQL Server\Data\nwind_new.mdf'
MOVE 'northwind_log' TO 'd:\Program Files\Microsoft SQL Server\Data\nwind_new_log.ldf'


It is said that I should run it with T-SQL but I have no knowledge of it either.

Lol I know I sound kind a funny here, but please help.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-07 : 07:55:45
connect to the sql server via sql server management studio.
open a new query window.
be sure the active database for that query window is "master".
take your RESTORE example and paste it into the query window.
change the path and name to you bak-file.
remove the lines:
WITH
MOVE 'northwind' TO 'd:\Program Files\Microsoft SQL Server\Data\nwind_new.mdf'
MOVE 'northwind_log' TO 'd:\Program Files\Microsoft SQL Server\Data\nwind_new_log.ldf'

run it and see wht happens.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -