Solved

How to copy/attach mdf to new installation

Posted on 2010-11-17
4
714 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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