Saturday, February 25, 2012

Restoring DB

Hi,

I have created a DB on my local machine.
Now I would like to copy this on to another machine.
I stopped the service and then copied both the MDF file and the
log files into the same folder as in Data folder of the second machine.

When I run theStudio express I cannot find the MDF file.It does not show up in the
the DB folder or window.
When I try to create one it says that the DB exists.

What am I missing?

I tried doing a backup and restore but then the DB is not created on the second machine and
hence wont work.

Tnx

How are you looking for the file in Management Studio? Are you using the Attach functionality? If there is more than one SQL Server running on the computer, there will be more than one Data directory, so it's possible that you've put the files in the wrong directory.

Let us know the exact steps you're using to attach the database on the new machine.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

|||Hi Mike,

>>How are you looking for the file in Management Studio? Are you using the Attach >>functionality?

I stoped the service on the first machine and then went into the folder:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
and copied both the DB and the Log files on to my CD.

I stoped the service on the second machine and then went into the folder.
copied them both into the second machine's :
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data

There is only one SQL server installed on both the machines'.

Tnx

|||

Hi,

great you found the button for making fonts real big ! :-)

As Mike said you have to attach the database for before you can see it, use the Sp_attach procedure for this or use the graphical UI (SQL Server Management Studio Express) for that, I don′t know if there is a possibility to use this function for attaching otherwise sp_attachdb is quite easy to code in TSQL, there are samples on the BOL for that.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment