Link to home
Start Free TrialLog in
Avatar of Software Engineer
Software Engineer

asked on

SQL: Default Database Integrity Jobs Failing

Hello:

This morning, I reviewed the SQL Server Agent of SQL Server 2016.  There are what I believe are two default database integrity jobs that come with SQL.  They are both failing, according to the Agent.

I say that they are "default" jobs, because they are the ones that reference "SYSTEM_DATABASE" and "USER_DATABASES" and the one step for each job appears to be written in PowerShell scripting.

Anyway, since I did not have access to Event Viewer, I reviewed the results in the Agent.  The only thing that the Agent could tell me is that the person that is supposed to get e-mails about failures could not be e-mailed.  I think that the Agent was saying that database mail setup could not be configured or was not set up or something along those lines.

In any case, is the reason for the failure because of the simple fact that this person could not be e-mailed?  The Agent stated that the last step invoked was Step 1--the only step of each job.  

I may simply try to set up my own jobs for the system and user databases.

Thank you!

John
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

There's no such default agent jobs.
With that said, somebody created those jobs. Maybe those are part of the maintenance jobs (check under the Management / Maintenance Plans). If true, edit the maintenance plan and remove or replace the email address that's configured there.
Avatar of Software Engineer
Software Engineer

ASKER

Thank you, Vitor!

So, the issue with e-mailing is what is causing the Agent to display these as failed jobs.  But, the database integrity check has been running.  Is that all correct?

John
I removed the e-mailed person and manually ran the job.  It failed.

Here is the script that someone created:

sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d DBAMgmtInfo -Q "EXECUTE [dbo].[DatabaseIntegrityCheck] @Databases = 'SYSTEM_DATABASES', @LogToTable = 'Y'" -b

What's wrong with this, then?  Frankly, the script is Greek to me.

John
The job is running a sqlcmd? That's make not sense.
What's the error now?
There is no real error given.  I removed the requirement to e-mail an alert, last night.  Yet, the job still failed without telling me why.

Fortunately, I noticed that someone else had already created a successful job that runs database integrity.  So, perhaps, this is all a moot point.  It would be nice to know why these two jobs fail, but...

John
ASKER CERTIFIED SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial