Solved

How to copy/attach mdf to new installation

Posted on 2010-11-17
4
719 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Stored Proc - Rewrite 42 73
VB.net Filesystem watcher not working 5 38
Need help with a query 14 40
Assigning Database Principals to Database Roles 3 20
In this article I will describe the Copy Database Wizard 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.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…

697 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