Backup Question

qsac226qsac226 Posts: 22
edited April 17, 2007 3:03AM in SQL Backup Previous Versions
When i run the script below in Query Analyzer, it returns the results.

If i run the script below in a Job, is there anyway to record to output? Does it already write teh resutls to a table?

master..sqlbackup N'-SQL "BACKUP DATABASES [*]
TO DISK = ''E:\MSSQL\Backups\<AUTO>''
WITH NAME = ''<AUTO>'',
DESCRIPTION = ''<AUTO>'',
VERIFY,
ERASEFILES_ATSTART = 20h,
COMPRESSION = 3"'

Comments

  • Hi there,

    master..sqlbackup takes two out parameters @errorCode and @sqlErrorCode which will return any warning or error codes SQL Backup has (@errorCode) or any SQL Server errors (@sqlErrorCode). These codes are documented in the help file.

    - James
    James Moore
    Head of DBA Tools
    Red Gate Software Ltd
  • peteypetey Posts: 2,358 New member
    The output is stored in a log file. The default folder is <system drive>\Documents and Settings\All Users\Application Data\Red Gate\SQL Backup\Log\<instance name>. You can store additional copies in a folder of your choice by using the LOGTO option e.g.
    master..sqlbackup N'-SQL "BACKUP DATABASES &#91;*&#93; 
    TO DISK = ''E:\MSSQL\Backups\&lt;AUTO&gt;'' 
    WITH NAME = ''&lt;AUTO&gt;'', 
    DESCRIPTION = ''&lt;AUTO&gt;'', 
    VERIFY, 
    ERASEFILES_ATSTART = 20h, 
    COMPRESSION = 3, LOGTO = &#91;E:\Logs&#93;"'
    
    In this case, SQL Backup will store an additional copy of the log file in the E:\Logs folder.

    You can also retrieve the backup/restore statistics from the standard SQL Server backup tables. See http://www.red-gate.com/messageboard/viewtopic.php?t=2241 for details.
    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.