Sunday, March 25, 2012

Database backup using .LDF & .MDF files

Hi,

I am developing a tool that takes snapshot of a particular database.

By snapshot I mean, attaching the .LDF & .MDF files.

Would you please let me know how to access these files & take a backup of the same.

And also how to restore them back. (using c# programming)

Thanks,

Archana A.A.

MDF (Microsoft data file) and LDF (Log data file), belong to one folder, while Backup file which is .Bak it goes into a different subfolder. Run a search for SMO (sql server management object), it is the way to deal with SQL Server programmatically. The link below shows SMO based backup code. I am assuming you know if all three files get corrupted you will loose your database. Run a search for SMO in the BOL (books online). Hope this helps.

http://www.sqldbatips.com/showarticle.asp?ID=37

sql

No comments:

Post a Comment