Solved

Properly Backing up .MDF and .LDF files

Posted on 2011-02-18
9
509 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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 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

Industry Leaders: 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!

Question has a verified solution.

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

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…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

739 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