Full & Differential backups

  • 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[/url]

    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

  • 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

  • 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[/url]

    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

  • 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

  • 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[/url]

    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

  • 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

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply