Solved

Properly Backing up .MDF and .LDF files

Posted on 2011-02-18
9
506 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 167 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 39

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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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 39

Assisted Solution

by:lcohan
lcohan earned 166 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 167 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Facing problems with you memory card? Cannot access your memory card? All stored data, images, videos are lost? If these are your questions...than this small article might help you out in retrieving your lost or inaccessible data.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

810 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