ms sql database file direct copy

Posted on 2008-11-06
Medium Priority
Last Modified: 2011-10-03

can i do direct copy of ms sql database files to backup tape or hdd ?

or i need to follow specific procedure to copy the sql database ?

pls provide the procedure as i am very new to database and sql


Question by:techsysnet
  • 2
LVL 31

Accepted Solution

James Murrell earned 1000 total points
ID: 22894529
LVL 31

Expert Comment

by:James Murrell
ID: 22894544

Assisted Solution

stesom earned 1000 total points
ID: 22894576
I'd allways recommend that you do a proper backup using the Enterprise Manager or by scripting it. However you can copy the databasefiles directly as well, in this case you'll need to detach the database - again through Enterprise Manager or by scripts - before you copy the files.

You'll need both the .mdf and .ldf files.

1. Detach the database.
2. Copy <myDatabase>.mdf and <myDatabase>_log.ldf to desired location.
3. Attach the database again.

Let me know if you want scripts to do automatic backup/restore of the database, it is a much cleaner solution, and you won't need to take the database offline while you do it.

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

864 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