Attachment using backup

  • I can setup a script using sp_send_db_mail to include the attachment of a backup job But I can't include an attachment if I use the the backup wizard correct?

  • No, a backup needs to be restored. You can only attach a database that has been detached (or at least shut down).

    "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

  • I don't know if you understand what I was asking. If you run a command backup database dbname ......... , when it's done you see information as such "Processed 0 pages for database

    'DBName', on file 1.BACKUP LOG successfull........" I can script the backup job & use db_send_mail to include the attachment but If I create the backup job using the maintenance plan can I have it send the email with the attachment to the operator.

  • Oh, I don't know. I don't use SQL Server to send emails except for alerts. If I had to do that, I'd probably go to Powershell for it anyway. There's no reason why you couldn't include a backup in an email from there, although that's potentially a big file to be emailing around.

    "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

  • Depends on how big the backup is. You could use an Execute T-SQL Statement Task to send the email, but I think there's a size limitation on the attachment using this method and it's not very large. Though the issue could be the size limitation in Outlook rather than in SSIS (the base for the maintenance plan wizard).

    I would not send a backup file via email anyway. Too easy for it to get corrupted or intercepted or just to plain fail due to backup size. Use a NAS share that only a select few have access to and copy it there. That way you can control access and it is less likely to cause other issues.

    I certainly wouldn't want to receive an attachment that large in my inbox. Outlook would freeze while trying to process that.

    EDIT: From BOL about sp_send_dbmail - By default, Database Mail limits file attachments to 1 MB per file. For more information, see Database Mail Configuration Wizard.

    EDIT 2: It occurs to me you might be talking about the log instead of the actual backup file. If the log, then usually those aren't big. You could send that using the Execute T-SQL Statement Task.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

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

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