Solved

How to copy/attach mdf to new installation

Posted on 2010-11-17
4
715 Views
Last Modified: 2012-05-10
I just published my first application in VB.NET and installed it on a new machine.  The database was created in SQLExpress 2008.  How do I copy the database to the new machine and attach it to SQL Server there?  Does it matter which version of SQL Server I use on the new machine?  When I try to copy the physical file, I get an error that it is being used by another person or program, although I  have everything shut down.  Help!

Thank you in advance!
0
Comment
Question by:Agent909
  • 3
4 Comments
 
LVL 2

Accepted Solution

by:
marceloOrigoni earned 500 total points
ID: 34161732
It's better if you perform a backup of the database (right click over the database -> Tasks -> backup), if you still want to copy the mdf itself (which I do not recommend), you'll need to dettach the database before copying the file.
 then you can copy the mdf file, and attach it to your new server. You don't need to worry about the log file(ldf), since if it doesn't, sql server will create again.
 It does matter which version of mssql server you are using, unless you created the db as version 9 (server 2005), you won't be able to install it on sql server 2005, same applies with version 8 and sql server 2000. If you have a sql server 2008 installed on your new machine (it doesn't matter if it's express or professional).

 Best

 Marcelo
0
 
LVL 1

Author Comment

by:Agent909
ID: 34161746
Thank you for your quick answer.  How do I detach the mdf?
0
 
LVL 1

Author Comment

by:Agent909
ID: 34161758
I just figured out how to detach it, and I also backed it up.  How do I attach it to the new SQL Server?
0
 
LVL 1

Author Closing Comment

by:Agent909
ID: 34161847
Thank you for your help!
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

21 Experts available now in Live!

Get 1:1 Help Now