Wednesday, March 28, 2012

Maintenance Plan email report failure

Hello,
I have a simple daily maintenance plan for backups.(check integrity, back up, clean up history and then report) However, sending the email report always fails with the following error:

"Could not generate mail report.An exception occurred while executing a Transact-SQL statement or batch.Incorrect syntax near 'sys'."

How can the wizard output Incorrect syntax?

I have set up and tested Database mail and set the default public profile.
I have enabled the mail profile in SQL server agent properties and then restarted SQL server agent.
I have set up operator to receive the mail.
The frustrating thing is that if I set up and schedule a really simple test maintenance plan, the email report works! But it always fails on the real one.
How can I get more detail in the error message and actually see the SQL it is trying to execute when it send the mail?

Thanks,
Adam

More detail.

Having done a few tests it seems that this mail report error only occurs after the check integrity job fails. eg.

Executing the query "DBCC CHECKDB WITH NO_INFOMSGS
" failed with the following error:

"Incorrect PFS free space information for page (1:278) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 0_PCT_FULL, actual value 100_PCT_FULL.
CHECKDB found 0 allocation errors and 1 consistency errors in table 'sys.sysobjvalues' (object ID 60).

CHECKDB found 0 allocation errors and 1 consistency errors in database 'RHJ'.
repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (RHJ).".

Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.


This failure does not affect the backup and maintenance cleanup tasks that run afterwards, only the email report that it tries to send at the end.

No comments:

Post a Comment