how to schedule differential backup

  • How can we schedule differential backup for a database without overwriting the previous diff backup

  • Google sql server maintenance plan, specifically the database backup task.

  • Declare @STR varchar(100)

    set @STR='myDatabase_Diff_' + convert(varchar, getdate(),112) + left(convert(varchar, getdate(),108),2)+'.BAK'

    backup database myDatabase to disk=@str1 with differential

    see if the above code runs.

    Place the code in a job and schedule it to run at desired interval.

    EDIT - fixed missing character in the code



    Pradeep Singh

  • As long as you don't use the INIT clause, you can simply add differentials to the same backup file. That's not how I prefer to do it. I like the solution immediately above better, but you do have that option.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

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