question

vivekchandra09 avatar image
vivekchandra09 asked

can I copy mdf and ldf files instead of doing a backup

I am trying to take a backup of a database. Will that break the chain in the current database backup cycle. Can I copy the ldf and mdf files instead and apply it to secondary server instead?
databasedatabase-filescopy-databaseldf
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ASK SQL Server Central runs by you voting. For all helpful answers below, please indicate this by clicking on the thumbs up next to those answers. If any one answer lead to a solution, please indicate this by clicking on the check mark next that answer.
0 Likes 0 ·
Tim avatar image
Tim answered
If you are needing a one off backup, you can backup using WITH COPY_ONLY to avoid disrupting the differential bitmaps. To copy the mdf and ldf would require an outage. Simplest thing to do is use the current backups that have already been made to restore to your secondary server, why have to take an additional backup.
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sule avatar image
Sule answered
However, if you decide to copy mdf and ldf files, this is procedure: 1. detach 'source' database (IMPORTANT: from that moment database will be inaccessible) 2. Copy mdf and ldf files on another location 3. Attach 'source' database 4. Attach new database from copied files
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

vivekchandra09 avatar image
vivekchandra09 answered
I just used backup , copy files to target server and restore (before that I had to delete the existing database).
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DavidSwiss avatar image
DavidSwiss answered

@Sule

I use DataAdapters in Visual Studio and starting to use SQL Server. Whereas I could always connect to Access databases, I was unable to establish a connection to the DB on SQL Server (error: Database already exists no acess). This allows me to access the copy independently.

Will have to now find how to handle maintenance, but thanks for the help

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.