Skip to content

Latest commit

 

History

History
82 lines (57 loc) · 3.11 KB

File metadata and controls

82 lines (57 loc) · 3.11 KB
title Disable or Enable a Job | Microsoft Docs
ms.custom
ms.date 01/19/2017
ms.prod sql
ms.prod_service sql-tools
ms.reviewer
ms.technology ssms
ms.topic conceptual
helpviewer_keywords
stopping jobs
disabling jobs
SQL Server Agent jobs, disabling
jobs [SQL Server Agent], disabling
ms.assetid 5041261f-0c32-4d4a-8bee-59a6c16200dd
author stevestein
ms.author sstein
manager craigg
monikerRange = azuresqldb-mi-current || >= sql-server-2016 || = sqlallproducts-allversions

Disable or Enable a Job

[!INCLUDEappliesto-ss-asdbmi-xxxx-xxx-md]

Important

On Azure SQL Database Managed Instance, most, but not all SQL Server Agent features are currently supported. See Azure SQL Database Managed Instance T-SQL differences from SQL Server for details.

This topic describes how to disable a [!INCLUDEssNoVersion] Agent job in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql]. When you disable a job, it is not deleted and can be enabled again when necessary.

In This Topic

Before You Begin

Security

For detailed information, see Implement SQL Server Agent Security.

Using SQL Server Management Studio

To disable or enable a job

  1. In Object Explorer, connect to an instance of the [!INCLUDEssDEnoversion], and then expand that instance.

  2. Expand SQL Server Agent.

  3. Expand Jobs, and then right-click the job that you want to disable or enable.

  4. To disable a job, click Disable. To enable a job, click Enable.

Using Transact-SQL

To disable or enable a job

  1. In Object Explorer, connect to an instance of [!INCLUDEssDE].

  2. On the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute.

    -- changes the name, description, and disables status of the job NightlyBackups.  
    USE msdb ;  
    GO  
    
    EXEC dbo.sp_update_job  
        @job_name = N'NightlyBackups',  
        @new_name = N'NightlyBackups -- Disabled',  
        @description = N'Nightly backups disabled during server migration.',  
        @enabled = 0 ;  
    GO  
    

For more information, see sp_update_job (Transact-SQL).