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 Programming
 Moving Database Files

Author  Topic 

jpx
Starting Member

4 Posts

Posted - 2007-08-28 : 08:37:46
Sorry for the ultra-beginner question, but I've just recently started playing with SQL 2005 Express Edition for a task I've been assigned to at work.

I'm building an ASP.NET 2.0 web site that needs to connect to a SQL database to pull information. I installed SQL Express 2005 and installed the SQL Server Management Studio and I've managed to build a small database with one table.

I noticed that by default, the mdf and ldf files are located in C:\Program Files\MS SQL Server\MSSQL\DATA (or something along those lines). The website I'm working on is temporarily stored in C:\WebSite. I need to move the database files over to C:\WebSite\App_Data so I can access them easily with ASP.NET and VS 2005 Express.

I can copy and paste the mdf and ldf files, but then I can't figure out how to point the SQL Server Management Studio to the new location.

I am obviously just a complete newbie at all of this. It's pretty sad that I can't figure out how to simply move the database from one directory to another on the same server... it makes me worry about when I'll need to move it to the new webserver!

Could anyone point me in the right direction at least?

Thanks in advance!

Kristen
Test

22859 Posts

Posted - 2007-08-28 : 10:04:44
Your best bet would be to make a backup of the local database and "restore" it to the desired position on the remote machine.

Alternatively take a copy of MDF and LDF WITH THE SQL SERVICE STOPPED, copy them to the desired location on the remote, and use ATTACH to connect them to that machine.

You'll have to sort out the orphaned users too ...

You might find some useful links here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210

Edit: Typo

Kristen
Go to Top of Page

jpx
Starting Member

4 Posts

Posted - 2007-08-28 : 12:03:48
Thanks for the leads... I found some good info in those links.
Go to Top of Page
   

- Advertisement -