Dela via


Creating Jobs

A job is a specified series of operations performed sequentially by SQL Server Agent. A job can perform a wide range of activities, including running Transact-SQL scripts, command prompt applications, Microsoft ActiveX scripts, Integration Services packages, Analysis Services commands and queries, or Replication tasks. Jobs can run repetitive or schedulable tasks, and they can automatically notify users of job status by generating alerts, thereby greatly simplifying SQL Server administration.

To create a job, a user must be a member of one of the SQL Server Agent fixed database roles or the sysadmin fixed server role. A job can be edited only by its owner or members of the sysadmin role. For more information about the SQL Server Agent fixed database roles, see SQL Server Agent Fixed Database Roles.

Jobs can be written to run on the local instance of SQL Server or on multiple instances across an enterprise. To run jobs on multiple servers, you must set up at least one master server and one or more target servers. For more information about master and target servers, see Automating Administration Across an Enterprise

Organizing Jobs

Job categories help you organize your jobs for easy filtering and grouping. For example, you can organize all your database backup jobs in the Database Maintenance category. You can also create your own job categories.

Multiserver categories exist only on a master server. There is only one default job category available on a master server: [Uncategorized (Multi-Server)]. When a multiserver job is downloaded, its category is changed to Jobs From MSX at the target server.

Job Ownership

For security reasons, only the job owner or a member of the sysadmin role can change the definition of the job. Members of the sysadmin role can assign job ownership to other users, and they can run any job, regardless of the job owner.