Backup Text Report

  • Hi

    How can i make textreports after backup with t-sql without using Database Maintenance Plan.

    thanks

    alex

  • If you're doing it through a scheduled job, then use the advanced options of the job step to send output to a text file.


    Cheers,
    - Mark

  • Can you tell me how can i send output to text file.

  • Just wondering if anyone actually had an example of the scripts that would generate a Backup text file similar to DBMaintenance plan when doing backup using T-SQL. There are reason's why we cannot use the DBMaintenance plan through SQL but would like to receive the generated text file for troubleshooting purposes.

  • From the job, you can just run and send output to a text file like mccork said and then using xp_sendmail or any other SQL Mail that use to send the output file

    EXEC xp_sendmail @recipients = 'robertk;laurac',

       @message = 'backup',

       @subject = 'Master Database Status',

       @attachments ='c:\backup.log'

    or not recommendable but you also can do run the backup from @query option and send the result.

    The other way would be to run this and attach the log file to send email by using above method.

    osql -SDWSQLA -E -Q"BACKUP DATABASE [Northwind] TO  [Northwind_Backup] WITH  INIT ,  STATS = 10,  NOFORMAT" -o c:\temp\backup.log

    If you want to do that from sql analyzer, use xp_cmdshell to do that as well.

    Clean way would be to run as a job and send the attachment by using sql mail. There is so many other ways though

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

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