Вопрос

I created a SQL Server 2008 Job when runs everyday at a specific time. When the job finishes, I can manually Export the job log as shown in the link below:

http://www.websense.com/support/article/kbarticle/How-do-I-exporting-SQL-logs-and-job-history

Is there a way to automatically export this job log when it finishes.

Это было полезно?

Решение

You could create a CMDEXEC job step at the end, which runs BCP with the QUERYOUT option to export the contents of MSDB.dbo.sysjobhistory to a flat file.

Alternatively you could have a TSQL job step, which runs a query against the same table and then e-mails it using DB Mail.

The third alternative which would be my preference but possibly overkill, would be to have an Execute SSIS package step. You could then have a simple SSIS package which queries the above table and then either writes it to a file, emails it or both.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top