locked
Backup database - overwrite option RRS feed

  • Question

  • Hello,

    I make a backup over maintenance plan wirh script, it works fine:

    USE AdventureWorks2012; GO BACKUP DATABASE AdventureWorks2012 TO DISK = 'Z:\SQLServerBackups\AdventureWorks2012.Bak' GO

    After the job, the backup file exist at folder.

    When i start the job again, he appned at existing file AdventureWorks2012.Bak the database.

    How can i overwrite this file at maintenance plan, not append?

    Horst


    Thanks Horst MOSS 2007 Farm; MOSS 2010 Farm; TFS 2010; IIS 7.5

    Friday, June 22, 2012 6:45 AM

Answers

  • Hi,

    You can add option with init as below

    USE AdventureWorks2012;
    GO
    BACKUP DATABASE AdventureWorks2012
    TO DISK = 'Z:\SQLServerBackups\AdventureWorks2012.Bak' with init
    GO
    This will overwrite all the previuous backups files in this backup.

    - Chintak (My Blog)

    • Marked as answer by wuwu Friday, June 22, 2012 8:03 AM
    Friday, June 22, 2012 7:57 AM

All replies

  • Hi,

    You can add option with init as below

    USE AdventureWorks2012;
    GO
    BACKUP DATABASE AdventureWorks2012
    TO DISK = 'Z:\SQLServerBackups\AdventureWorks2012.Bak' with init
    GO
    This will overwrite all the previuous backups files in this backup.

    - Chintak (My Blog)

    • Marked as answer by wuwu Friday, June 22, 2012 8:03 AM
    Friday, June 22, 2012 7:57 AM
  • Thank You.

    Horst


    Thanks Horst MOSS 2007 Farm; MOSS 2010 Farm; TFS 2010; IIS 7.5

    Friday, June 22, 2012 8:03 AM