Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Properly Backing up .MDF and .LDF files

Posted on 2011-02-18
9
Medium Priority
?
516 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 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

705 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