Solved

Properly Backing up .MDF and .LDF files

Posted on 2011-02-18
9
500 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 15

Expert Comment

by:Aaron Shilo
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:printmedia
Comment Utility
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
Comment Utility
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
Comment Utility
Check out the very first comment again.  This is how i answered the question.  
0
 

Author Comment

by:printmedia
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
From Coral's  "So You Want To Play With Computers" Series Preface: What follows is a tweaked reprint from 2005/06. This is a True Story. The names have been changed to protect the guilty. While this deals with a fairly simple, text file recovery…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
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.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now