BACKUP SYNTAX

michellem33michellem33 Posts: 19
edited December 15, 2005 5:41AM in SQL Backup Previous Versions
Hi,
I have been trying to get the backup syntax correct but with no success. I would like to specify a password for encryption as well as the compression level. I am able to backup with encryption using the following command:

xp_cmdshell 'C:\progra~1\RedGat~1\SqlBac~1\sqlbac~1.EXE -SQL "BACKUP DATABASE master TO DISK = ''f:\backup\master\masterkeycomp7_db_200512141310.BAK.SQB'' WITH PASSWORD = ''test''"'

I had tried to add the COMPRESSION = ''3'' argument with no success. Could I please have some help with I am doing wrong or point me in the direction of some useful examples. :oops:

Comments

  • peteypetey Posts: 2,358 New member
    The compression value need not be enclosed in single quotes.

    Is there a reason you need to use xp_cmdshell? You could try using the sqlbackup extended stored procedure directly e.g.

    exec master..sqlbackup '-SQL "BACKUP DATABASE master TO DISK = [f:\backup\master\masterkeycomp7_db_200512141310.BAK.SQB] WITH PASSWORD = [test], COMPRESSION = 3 " '
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
Sign In or Register to comment.