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

x
?
Solved

Properly Backing up .MDF and .LDF files

Posted on 2011-02-18
9
Medium Priority
?
522 Views
Last Modified: 2012-05-11
Hello, were looking for a simple soultion to backing up .ldf and .mdf files.  Our current backup solutions and software skip over these files and were concerned we don't have proper backups of them.

Just want to know what's the standard for backing up this type of data.
0
Comment
Question by:printmedia
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 2

Accepted Solution

by:
tonymike earned 668 total points
ID: 34926163
Your backup software cannot backup live files.  Unless you purchase a better backup app like BackupExec with the SQL option - this is expensive.  Use SQL Manager to backup your database files to flat files.  Then your backup software can backup the flat files.  Automate the backup to flat file to happen just before your main backup takes place.  hope this helps,
0
 
LVL 40

Expert Comment

by:lcohan
ID: 34926830
Why would you backup those files? In my opinion you may be never able to use them because you can't attach them to another server anyway. You should do a proper database backup and save the backup files/tapes instead.
0
 
LVL 3

Expert Comment

by:clinker83
ID: 34927809
Create this file in notepad and save it with .bat file extension
------------------
ECHO on
SQLCMD -i C:\location\backupdb.sql
---------------------
Create another file below in same location and save as backupdb.sql
-------------------
SQLCMD
DECLARE @DB varchar(20)
DECLARE @DiskLoc varchar(100)
DECLARE @NumofDays int


SET @DB = 'dbname'
SET @DiskLoc = 'C:\location\YourDbBackup.bak'
SET @NumofDays = 7

BACKUP DATABASE @DB TO DISK = @DiskLoc
WITH RETAINDAYS = @NumofDays,
INIT,
SKIP;
----------------------

Now you can use windows scheduled tasks to run the bat file which will create .bak file in same location as above. The bak file, once restored, will restore your mdf and ldf files


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:Aaron Shilo
ID: 34932803
hi

very simple , start with using sql server maintenance plan wizard to create a plan to backupp your databases using sql server agent job on a regular basis.

read this : http://msdn.microsoft.com/en-us/library/ms189953.aspx
0
 

Author Comment

by:printmedia
ID: 34954496
We currently have a maintenance plan that does backup the databases.  The maintenance plan creates a .bak file in another location on the same drive as the live data and then we back up those files with Veritas.  Those .bak files backup without a problem.  

Is this a sufficient backup for SQL?
0
 
LVL 40

Assisted Solution

by:lcohan
lcohan earned 664 total points
ID: 34954772
That should be "sufficient backup for SQL" from backup/restore point of view especially if you keep those backed up backup files off site and for a specific length of time driven by your business rules.
I suggest you check "Planning for Disaster Recovery" article and see what applies to your business rules.

http://msdn.microsoft.com/en-us/library/ms178094(SQL.90).aspx
http://msdn.microsoft.com/en-us/library/ms178094(v=SQL.105).aspx

If you need quick recovery (and you can afford it) from a disaster (hardware failure/data corruption) then you may need to look at lot more expensive solutions like SAN disks mirroring. Hope this helps.
0
 
LVL 2

Expert Comment

by:tonymike
ID: 34954824
Check out the very first comment again.  This is how i answered the question.  
0
 

Author Comment

by:printmedia
ID: 35086262
What is the reason for the difference in size between the .ldf, .mdf files compared to the backup files SQL creates with the maintenance plan?
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 668 total points
ID: 35086632
A backup is a representation of the data contained in the Transaction Logs (LDF) and Data Files (MDF, NDF, etc.) and has little bearing on the size of the physical files (LDF, MDF, NDF, etc.).  In other words, you can define data file as having 100GB, but it contains only data for 1GB.  The backup will be closer to 1 GB than 100 GB.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

971 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