all groups > sql server msde > april 2006 >
You're in the

sql server msde

group:

Restoring a db from .bak file


Restoring a db from .bak file Bob
4/10/2006 8:25:18 PM
sql server msde: Hi,

I'm new to sql but have a website running it on a hosted site. I want to
have a local copy of the site running here for testing. I have everything
set on my local machine to run it including MSDE and Enterprise Mgr.

I've created a blank db with the same name,username and password on my local
machine. From my host I received a dbname.bak file which they said I should
just restore to my local machine. This sounded simple but I have no idea
how to do this. When I right click on the db file within Ent.Mgr I see the
Restore option but I can figure out how to designate the dbname.bak file as
the source. I also see an option to import but that isn't any better.

Does anyone have some simple directions which will show me the proper steps
and where I should be to do this? I'd really appreciate it. I assume it's
simple but not having ever done it it has me stumped.

Thanks!

Re: Restoring a db from .bak file Andrea Montanari
4/11/2006 4:10:51 PM
hi Bob,
[quoted text, click to view]

using Enterprise Manager, select the database you want to "restore".. access
the "restore" dialog..
select the From device" restore option..
press the "Select devices" button
in the "cools restore devices" dialog press the "Add.." button..
in the following dialog select the "File name" option and the [...] button
to open a browsing dialog..
there you have to locate the ".bak" file on the server's file system...
once done, press ok and return the the initial restor dialog..

in the devices frame you should now have the c:\...\x.bak file listed..
select the appropriate restore type, that should be "Database - complete"..
in the "Options" tab, modify (if needed) the "Move to physical file name"
properties of the files to reflect YOUR os file system position..
the "Recovery completion state" should be "Leave database operational. No
additiona transaction log can be restored" as I understand you are
performing a complete database restore...
press ok...

if you want to do it via standard Transact-SQL statement, you can open Query
Analyzer (or the tool of your choice) and execute the
RESTORE DATABASE [your_db]
FROM DISK = 'C:\your_path_to the_bak_file.bak'
MOVE N'logical_datafile_name' TO
N'C:\your_physical_os_path_to_the_DataFile_file.MDF',
MOVE N'logical_logfile_name' TO
N'C:\your_physical_os_path_to_the_LogFile_file.LDF'
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.18.0 - DbaMgr ver 0.62.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply

AddThis Social Bookmark Button