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

Full & Differential backups Expand / Collapse
Author
Message
Posted Monday, November 12, 2012 6:36 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: Friday, September 19, 2014 3:37 AM
Points: 708, Visits: 3,288
I would really appreciate it if someone could help understand the following.

I have a stored procedure to backup all user databases on an instance.

Example (D for Differential, F for FULL and L for Log
exec [sp_QB_Backup] @BackupType = 'D', @BackupFolderPath = '\\FileStoreBackup\'

I did the following the test:

1) Created a blank database called Test
2) Ran the above (failed on backing up Test database - fair enough as there isn't a full backup
3) Queried backupset table, no entries for Test DB yet.
4) Restored another database backup on top of the Test DB, rechecked backupset table, still no entry for Test DB.
5) Ran the differential backups again and it worked creating one.

But I never did a full backup of the Test DB so how can it do a differential? Is it because I restored from a FULL backup that SQL is using to work out the differential for the Test DB?


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


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 #1383666
Posted Monday, November 12, 2012 6:43 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 13,872, Visits: 9,596
It's doing a Diff on the one you restored. Obviously, that database has a restorable Full backup, since you just used it to restore the database, so it can do a Diff on it.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1383670
Posted Monday, November 12, 2012 6:50 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: Friday, September 19, 2014 3:37 AM
Points: 708, Visits: 3,288
Hmmmm.... that's what I thought so thanks for confirming.

The reason I'm asking is because I have a job which performs daily differential backups and another which does fortnightly full backups.

So consider the following scenario:

DAY 1 - FULL Backups
Day 2 - Differential Backups
DAY 3 - NEW DATABASE added
DAY 3 - Differential Backups (will fail the job because there isn't a full backup for the new database).

So I thought I could add a check in my sproc to look for entries in the backupset table where the type is D but this won't work where a database is created then restored using a full backup from another database.
I know the differential won't fail but it would be confusing to find a differential backup in the backup folder but no full backup.

am I making sense?


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


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 #1383673
Posted Monday, November 12, 2012 7:00 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 13,872, Visits: 9,596
I build separate logging into that kind of script. It checks its own log to see if a database has had a full backup in the expected timeframe. If not, it runs one, if so, it does a Diff.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1383676
Posted Monday, November 12, 2012 7:54 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: Friday, September 19, 2014 3:37 AM
Points: 708, Visits: 3,288
Yup... I did entertain this idea of custom logging before but I thought I'd check with you guys in case I'm duplicating unnecessary metadata. But it does make sense and it will give me more control.



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


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 #1383710
Posted Monday, November 12, 2012 8:03 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 13,872, Visits: 9,596
Because I use custom maintenance scripts, I maintain a log of "actions done per database". Rebuild some indexes? Log it. Run a backup? Log it. DBCC CHECKDB? Log it. And so on. Gives a one-stop table where all of a database's history is kept. Can get a full history for any database, or the whole server, without having to query dozens of system views.

Same database (DBA is the name of the database) has a DDL log in it for all object create/modify/drop commands. So it becomes easy to see things like, "What's the best backup to use if I want to restore to before that $%&*!@# moron dropped those tables?"


- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1383716
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse