Solved

trying to just copy the mdf and ldf

Posted on 2006-06-19
8
995 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

Read about achieving the basic levels of HRIS security in the workplace.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

740 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