MSSQL: JOB CANCELLED

MS-SQLQueriesSQL

There are three situations where jobs can be cancelled. A user can cancel a job while it is being executed, prevent it from running at all, or a job may stop while executing due to some operating system intervention.

Many SQL agents trigger jobs that run specific maintenance functions – one example is transaction log backup. In cases where the job was running infrastructure maintenance operations such as backup and indexing, its interruption after launch has a negative impact on performance, which will be restored only when the same job is run to completion.
In cases of application-related jobs, our recommended best practice is to set up proper notification procedures in each agent so that appropriate notification will be given in case of failure, enabling follow-up action to be taken.

Find out how you can save hours of work when investigating the root cause of this issue.
Symptoms

An SQL job has been cancelled.

Impact: High

This alert notifies that the designated SQL job has not finished. This may cause loss of data and disruption of the application’s integrity or negatively impact the system’s performance.

Expected behavior

SQL jobs should not be stopped while running and should run without reducing performance or harming the application’s activity.

Possible causes

1- User action.  Priority: Medium

Users might manually stop a job that’s running longer than expected or prevent it from running if there are concerns about its impact on the system. 

Problem identification:

When identifying that the job was canceled, look for messages mentioning that it’s a user’s intervention and not anything else.

Hands-on approach
Get the answer in just seconds!
Hands-on approach
  1. Connect to the SQL Server Management Studio, navigate to SQL Server Agent, go to Job History Logs, and follow the steps. Look for specific job history entries related to job steps being stopped manually. This will be mentioned in a “message”.
  2. Check audit logs to track user activity records of interactions related to job cancellation.
  3. Review system logs or security logs on the host server for any related events that might indicate user interventions for job cancellation.
Get the answer in just seconds!

You will be immediately notified once a job is canceled – no need to search for the error message. 

Recommended action :

Confirm the need for the intervention by the user who stopped the job. Track the job event to locate the step at which it was stopped and rerun if needed.

2- Operating System action.   Priority: Medium

In cases when the job consumes excessive OS resources (CPU, Memory, Disk I/O) and degrades performance, it might be cancelled by the OS. A sudden system restart or shutdown might cause this cancellation as well.

Problem identification:

Identify if a job was canceled and that the Operating System itself initiated it. Look for a shutdown event or interference of the job with other OS tasks scheduled.

Hands-on approach
Get the answer in just seconds!
Hands-on approach
  1. Connect to the SQL Server Management Studio, navigate to SQL Server Agent, go to Job History Logs, and follow the steps. Look for specific job history entries related to job steps being canceled by the OS. This will be mentioned in a “message”.
  2. Check the Event log of Windows in the server of the SQL Engine, and look for events that have happened at the time of the job cancellation. You will probably find events related to system restarts, shutdowns, or other system-level actions.
  3. Check for incidents in OS tasks scheduled at the Windows task scheduler that were executed at the time of the job’s cancellation.
  4. Check if there is a pending server reboot or Windows update installation that might interfere with the execution of jobs. System shutdown or restart will cause the same outcome.
  5. The OS might take action to stop processes when its resources are overloaded. Check for these events in the event viewer and look at the resources’ current status as the Performance Monitor.
Get the answer in just seconds!

Exceptions are provided by AimBetter in one control panel, along with alerts for both job cancellations and exceptions.

Tracking and connecting the dots between OS and SQL Server issues is easy using our solution.

Recommended action :

Make sure that urgent system events and tasks are scheduled at times different from the scheduled jobs, in order to prevent a conflict between them. If possible, schedule jobs to execute at low system activity periods.

3- The job’s execution is incorrect or facing errors in the job’s step.  Priority: Medium

A job may be cancelled after it starts its execution due to some error in one of its steps or tasks. There might be several reasons for it: syntax errors, misconfigured parameters, issues with external resources, or conflict with other jobs.

Problem identification:

Check for the job’s message of failure reason and see if it’s related to the whole job or one of its steps, misconfiguration, or errors.
Hands-on approach
Get the answer in just seconds!
Hands-on approach
  1. Connect to the SQL Server Management Studio, navigate to SQL Server Agent, go to Job History Logs, and follow the steps. Look for specific job history entries related to job steps being canceled and why. This will be mentioned in a “message”.
  2. Track the next execution of the job by putting a trace before its next execution, filtering by exceptions in order to identify the correct error message and leading events.
  3. Investigate the exceptions and check for solutions. Look for more details: query code, the reason for the error, the server’s status at the moment, and more.
Get the answer in just seconds!

Exceptions are provided by AimBetter in one control panel, along with alerts about both job cancellations and exceptions.

Tracking and connecting the dots between OS and SQL Server issues is easy using our solution.

Recommended action :

Following the exception’s error message, you are able to know how to handle the specific error. Track the next job’s executions, or else test the steps that caused the issue if possible.

    Learn more how you can solve IT systems performance issues faster.



    Share with friends:

    Testimonials:

    FEATURED POSTS

    Menu
    Skip to content