Solved

How to copy/attach mdf to new installation

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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