Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

trying to just copy the mdf and ldf

Posted on 2006-06-19
8
Medium Priority
?
1,010 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 93

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 400 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 800 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 400 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 400 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 800 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

927 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