หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Applies to:
SQL Server
Azure SQL Managed Instance
Important
On Azure SQL Managed Instance, most, but not all SQL Server Agent features are currently supported. See Azure SQL Managed Instance T-SQL differences from SQL Server or SQL Agent job limitations in SQL Managed Instance for details.
This article describes how to disable a SQL Server Agent job in SQL Server by using SQL Server Management Studio or Transact-SQL. When you disable a job, it isn't deleted and can be enabled again when necessary.
Security
For detailed information, see Implement SQL Server Agent security.
Use SQL Server Management Studio
In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
Expand SQL Server Agent.
Expand Jobs, and then right-click the job that you want to disable or enable.
To disable a job, select Disable. To enable a job, select Enable.
Use Transact-SQL
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, select New Query.
Copy and paste the following example into the query window and select Execute. This example changes the name and description, and disables the status of the
NightlyBackupsjob.USE msdb; GO EXECUTE 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.