Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Backup size confusion Expand / Collapse
Author
Message
Posted Thursday, November 15, 2012 3:26 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 26, 2014 4:08 AM
Points: 708, Visits: 3,286
My backup sproc logs the start and finish of a database backup. It then updates my BackupSchedule table with the size of the backup in MB using the below:

update a
set backupSizeMB = b.backup_size / 1048576
from DBAUtility.dbo.backupschedule as a
inner join msdb.dbo.backupset as b
on a.databasename = b.database_name
where a.databasename = @DBName
and b.backup_set_id = (select MAX(backup_set_id)
from msdb.dbo.backupset as c
where b.database_name = c.database_name)

The weird thing is, for the master database, the size I logged in my table matches the size of the backup file. However, for other databases the size is out by a couple of gigs!!

Any ideas?


---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1385041
Posted Thursday, November 15, 2012 3:28 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:34 AM
Points: 5,131, Visits: 4,920
SQL 2005 or SQL 2008?





Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1385044
Posted Thursday, November 15, 2012 3:44 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 26, 2014 4:08 AM
Points: 708, Visits: 3,286
No, no backup compression no...

This particular server is 2005.


---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1385055
Posted Thursday, November 15, 2012 4:02 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 26, 2014 4:08 AM
Points: 708, Visits: 3,286
Very strange.. so in backupset table, only the master database's size matches the size of the physical file. For my other databases, the backupset table holds a smaller size than the actual physical backup file.

Anyone seen this before?


---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1385069
Posted Thursday, November 15, 2012 4:07 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 2:48 AM
Points: 42,438, Visits: 35,493
Using a 3rd party compression tool? Got hyperbac installed?


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1385073
Posted Thursday, November 15, 2012 4:30 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 26, 2014 4:08 AM
Points: 708, Visits: 3,286
No, I'm using native SQL backup

So the backupset table tells me this:



On the NAS I see this:



Notice the timestamp differences? No idea what's going on!


---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1385082
Posted Thursday, November 15, 2012 4:31 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:34 AM
Points: 5,131, Visits: 4,920
Are you writing to the same file on each backup run?



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1385083
Posted Thursday, November 15, 2012 4:48 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 26, 2014 4:08 AM
Points: 708, Visits: 3,286
anthony.green (11/15/2012)
Are you writing to the same file on each backup run?


Yes I am.

Okay so I've done a local backup of the model database and the backup file size matches the size in the backupset table. No surprises there.

Somethin'gs not quite right with my process.

Basically I have created a backupschedule table like the below:




I then use a sproc which loops through the record above like this:

BEGIN TRY

-- log the start time of the backup
update QbaseDBAUtility.dbo.backupschedule
set backupstartdate = GETDATE()
where databasename = @DBName
and backupdate = dateadd(dd, 0, DATEDIFF(dd, 0, getdate()))

IF @BackupTtype = 'F'

BEGIN
SET @SQL = 'BACKUP DATABASE [' + @DBName + '] TO DISK = N' + CHAR(39) + @BackupFolderPath + @DBName +
'.complete'' WITH NAME = N' + char(39) + @DBName + ' Complete Backup' + char(39) + ', BUFFERCOUNT = 1024, CHECKSUM'
EXEC(@SQL)
END
ELSE IF @BackupTtype = 'D'
BEGIN
SET @SQL = 'BACKUP DATABASE [' + @DBName + '] TO DISK = N' + CHAR(39) + @BackupFolderPath + @DBName +
'.Differential'' WITH DIFFERENTIAL, NAME = N' + char(39) + @DBName + ' differential backup' + char(39) + ', BUFFERCOUNT = 1024, CHECKSUM'
EXEC (@SQL)
END

-- log the end time of the backup
update QbaseDBAUtility.dbo.backupschedule
set backupenddate = GETDATE(),
BackupStatus = 'Success'
where databasename = @DBName
and backupdate = dateadd(dd, 0, DATEDIFF(dd, 0, getdate()))

-- Let's also get the backup size
update a
set backupSizeMB = b.backup_size / 1048576
from QbaseDBAUtility.dbo.backupschedule as a
inner join msdb.dbo.backupset as b
on a.databasename = b.database_name
where a.databasename = @DBName
and backupdate = dateadd(dd, 0, DATEDIFF(dd, 0, getdate()))
and b.backup_set_id = (select MAX(backup_set_id)
from msdb.dbo.backupset as c
where b.database_name = c.database_name)
END TRY



---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1385089
Posted Thursday, November 15, 2012 4:55 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:34 AM
Points: 5,131, Visits: 4,920
The problem is that your expecting to store the file size of the actual physical file into your table which is not what your getting. What your getting is the size of the logical backup which was just appeneded to the file which is correct for your procedure. If you want the file size on disk you will need to loop through your existing sizes in your schedule table and add up the total size or use a WMI query or something similar to get the size from the file system.


One thing I would strongly recommend is to use a timestamp in your backups and write to a new file every time and not append backups to the same file as if you get corruption in the backupset the whole backupset could be rendered invalid and you cannot restore from it so you loose all recoverability.




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1385090
Posted Thursday, November 15, 2012 5:26 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 26, 2014 4:08 AM
Points: 708, Visits: 3,286
Thanks Tony.

I've done some more testing on a different server and it does appear the backup size field is the actual size of thephysical backup file:



As to the difefrence in sizes from last night's backups.. no idea.... weirdness!


---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1385099
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse