ms sql database file direct copy


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


Who is Participating?
James MurrellConnect With a Mentor Product SpecialistCommented:
James MurrellProduct SpecialistCommented:
stesomConnect With a Mentor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.