Share via


Start a Job

This topic describes how to start running a Microsoft SQL Server Agent job in SQL Server 2012 by using SQL Server Management Studio, Transact-SQL or SQL Server Management Objects.

A job is a specified series of actions that SQL Server Agent performs. SQL Server Agent jobs can run on one local server or on multiple remote servers.

  • Before you begin:  

    Security

  • To start a job, using:

    SQL Server Management Studio

    Transact-SQL

    SQL Server Management Objects

Before You Begin

Security

For detailed information, see Implement SQL Server Agent Security.

Arrow icon used with Back to Top link [Top]

Using SQL Server Management Studio

To start a job

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.

  2. Expand SQL Server Agent, and expand Jobs. Depending on how you want the job to start, do one of the following:

    • If you are working on a single server, or working on a target server, or running a local server job on a master server, right-click the job you want to start, and then click Start Job.

    • If you want to start multiple jobs, right-click Job Activity Monitor, and then click View Job Activity. In the Job Activity Monitor you can select multiple jobs, right-click your selection, and click Start Jobs.

    • If you are working on a master server and want all targeted servers to run the job simultaneously, right-click the job you want to start, click Start Job, and then click Start on all targeted servers.

    • If you are working on a master server and want to specify target servers for the job, right-click the job you want to start, click Start Job, and then click Start on specific target servers. In the Post Download Instructions dialog box, select the These target servers check box, and then select each target server on which this job should run.

Arrow icon used with Back to Top link [Top]

Using Transact-SQL

To start a job

  1. In Object Explorer, connect to an instance of Database Engine.

  2. On the Standard bar, click New Query.

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

    -- starts a job named Weekly Sales Data Backup.  
    USE msdb ;
    GO
    
    EXEC dbo.sp_start_job N'Weekly Sales Data Backup' ;
    GO
    

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

Arrow icon used with Back to Top link [Top]

Using SQL Server Management Objects

To start a job

Call the Start method of the Job class by using a programming language that you choose, such as Visual Basic, Visual C#, or PowerShell. For more information, see SQL Server Management Objects (SMO).

Arrow icon used with Back to Top link [Top]