Solved

trying to just copy the mdf and ldf

Posted on 2006-06-19
8
1,002 Views
Last Modified: 2008-02-20
Im in windows explorer and im trying to just copy these to another directory so that i can delete the database in sql em....but i keep getting file in use....

How to keep copy of the mdf and ldf and delete from sql.

Detach first.........?
0
Comment
Question by:TRACEYMARY
[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
8 Comments
 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 100 total points
ID: 16936693
Hi TRACEYMARY,

Detach first.

Regards,

Patrick
0
 
LVL 7

Author Comment

by:TRACEYMARY
ID: 16936770
Thanks i do that ..............its ok to  reattach to any server i like in future?
0
 
LVL 9

Assisted Solution

by:sasapopovic
sasapopovic earned 200 total points
ID: 16936905
Yes, you can do the reattache from both the SQL Enterprise Manager or using stored procedure.
If you just want to copy those files to another location and use them for some other db server then you can also stop the SQL Server, copy files and start the server again.

I hope this will help you.
Regards,
Sasa
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 100 total points
ID: 16940409
when you re-attach (particularly to a different server) you may have to sort out your user/login again...

check Books on line (BOL) for orphaned users...
0
 
LVL 4

Assisted Solution

by:csachdeva
csachdeva earned 100 total points
ID: 16940796
Tracymary,

You can use attach detach method. but there is a risk of deletionof database. So First of open Service manger from program files then Stop the services. and using operating system commands to copy the database and then start the service.

This is a safer method to take a backup of database. and then delete datbase from Enterprise manager.

Hope this will help you to sort down your problem.

Regards,
Chetan Sachdeva

0
 
LVL 7

Author Comment

by:TRACEYMARY
ID: 16941492
hmm thinking over here...which way to do this.
I got the bak files.........but i be keeping them for a long time could be a year or so...
and i am hoping i can restore from bak some day.............i wanted the mdf and ldf as i know their my physical files and i can just re attach.

I can't stop server live production........
So i just do detach ..............Copy mdf and ldf in windows explorer and then
do drop database mydatabase


Thats odd now i think about it i asked my network guy to take backup of the mdf and ldf files ...now if i cannot copy them cause they are on the server....how did he take a copy of them.....(maybe i go ask him for a printout of the tape he just gave me)...........
0
 
LVL 9

Accepted Solution

by:
sasapopovic earned 200 total points
ID: 16941806
But why don't you use backup files?
I use it always for moving database from one place to another and never use MDF & LDF combination. In my practice it showed as much better solution. You can hold that bak file for years and then restore it when you want.
The only thing that you will need to do is to remove all users from database after you restore it on other server and add those users again manually (but that is a few minutes work).

I would say: just go with the backup & restore option instead of using MDF & LDF.

btw, if one database was not accessed never from the last server start/restart then you can copy MDF and LDF files without detach or server stoping. Maybe that is how your friend did it.

I hope this will help you.
0
 
LVL 7

Author Comment

by:TRACEYMARY
ID: 16944964
Thanks...............im just going to delete it.................
the others here cannot even find the interface to access it.....

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

615 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