Solved

trying to just copy the mdf and ldf

Posted on 2006-06-19
8
968 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
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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…

747 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

12 Experts available now in Live!

Get 1:1 Help Now