Feedbaông chồng will be sent khổng lồ alokapidakaldim.com: By pressing the submit button, your feedbachồng will be used to improve alokapidakaldim.com products and services. Privacy policy.

Bạn đang xem: Sql server agent là gì


In this article

Applies to:

*
SQL Server (all supported versions)
*
Azure SQL Managed Instance


Important

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


Squốc lộ Server Agent is a alokapidakaldim.com Windows service that executes scheduled administrative tasks, which are called jobs in SQL Server.

Benefits of SQL Server Agent

Squốc lộ Server Agent uses Squốc lộ Server lớn store job information. Jobs contain one or more job steps. Each step contains its own task, for example, backing up a database.

SQL Server Agent can run a job on a schedule, in response to a specific event, or on demvà. For example, if you want lớn back up all the company servers every weekday after hours, you can automate this task. Schedule the backup lớn run after 22:00 Monday through Friday. If the backup encounters a problem, Squốc lộ Server Agent can record the sự kiện và notify you.


Note

By default, the Squốc lộ Server Agent service is disabled when Squốc lộ Server is installed unless the user explicitly chooses to lớn autostart the service.


SQL Server Agent Components

Squốc lộ Server Agent uses the following components to define the tasks to lớn be performed, when to lớn perkhung the tasks, & how to report the success or failure of the tasks.

Jobs

A job is a specified series of actions that Squốc lộ Server Agent performs. Use jobs to define an administrative sầu task that can be run one or more times and monitored for success or failure. A job can run on one local VPS or on multiple remote servers.


Important

SQL Server Agent jobs that are running at the time of a failover sự kiện on a SQL Server failover cluster instance vày not resume after failover khổng lồ another failover cluster node. Squốc lộ Server Agent jobs that are running at the time a Hyper-V node is paused bởi not resume if the pause causes a failover khổng lồ another node. Jobs that begin but fail khổng lồ complete because of a failover sự kiện are logged as started, but bởi vì not show additional log entries for completion or failure. Squốc lộ Server Agent jobs in these scenargame ios appear lớn have sầu never ended.


You can run jobs in several ways:

According to one or more schedules.

In response to lớn one or more alerts.

By executing the sp_start_job stored procedure.

Each action in a job is a job step. For example, a job step might consist of running a Transact-SQL statement, executing an SSIS package, or issuing a comm& to lớn an Analysis Services hệ thống. Job steps are managed as part of a job.

Each job step runs in a specific security context. For job steps that use Transact-SQL, use the EXECUTE AS statement lớn set the security context for the job step. For other types of job steps, use a proxy account khổng lồ mix the security context for the job step.

Schedules

A schedule specifies when a job runs. More than one job can run on the same schedule, và more than one schedule can apply to lớn the same job. A schedule can define the following conditions for the time when a job runs:

Whenever Squốc lộ Server Agent starts.

Whenever CPU utilization of the computer is at a màn chơi you"ve sầu defined as idle.

One time, at a specific date and time.

On a recurring schedule.

For more information, see Create and Attach Schedules to Jobs.

Alerts

An alert is an automatic response lớn a specific event. For example, an sự kiện can be a job that starts or system resources that reach a specific threshold. You define the conditions under which an alert occurs.

An alert can respond lớn one of the following conditions:

SQL Server events

SQL Server performance conditions

alokapidakaldim.com Windows Management Instrumentation (WMI) events on the computer where Squốc lộ Server Agent is running

An alert can perform the following actions:

Notify one or more operators

Run a job

For more information, see Alerts.

Operators

An operator defines tương tác information for an individual responsible for the maintenance of one or more instances of Squốc lộ Server. In some enterprises, operator responsibilities are assigned to one individual. In enterprises with multiple servers, many individuals can cốt truyện operator responsibilities. An operator doesn"t contain security information, & doesn"t define a security principal.

SQL Server can notify operators of alerts through...

E-mail

Pager (through e-mail)

net send


Note

To send notifications by using net send, the Windows Messenger service must be started on the computer where SQL Server Agent resides.


Important

The Pager and net send options is removed from Squốc lộ Server Agent in a future version of SQL Server. Avoid using these features in new development work, and plan to modify applications that currently use these features.


To send notifications to lớn operators by using e-mail or pagers, you must configure Squốc lộ Server Agent khổng lồ use Database Mail. For more information, see Database Mail.

You can define an operator as the alias for a group of individuals. In this way, all members of that alias aren"t verified at the same time. For more information, see Operators.

Security for SQL Server Agent Administration

SQL Server Agent uses the SQLAgentUserRole, SQLAgentReaderRole, và SQLAgentOperatorRole fixed database roles in the msdb database to lớn control access khổng lồ Squốc lộ Server Agent for users who aren"t members of the sysadmin fixed hệ thống role. In addition to lớn these fixed database roles, subsystems và proxies help database administrators ensure that each job step runs with the minimum permissions required lớn persize its task.

Roles

Members of the SQLAgentUserRole, SQLAgentReaderRole, và SQLAgentOperatorRole fixed database roles in msdb, and members of the sysadmin fixed server role have sầu access to lớn Squốc lộ Server Agent. A user that doesn"t belong lớn any of these roles can"t use Squốc lộ Server Agent. For more information on the roles used by Squốc lộ Server Agent, see Implement Squốc lộ Server Agent Security.

Subsystems

A subsystem is a predefined object that represents functionality that is available khổng lồ a job step. Each proxy has access to one or more subsystems. Subsystems provide security because they delimit access to the functionality that is available to lớn a proxy. Each job step runs in the context of a proxy, except for Transact-SQL job steps. Transact-SQL job steps use the EXECUTE AS commvà khổng lồ mix the security context to the owner of the Job.

Xem thêm: Mbbg Là Gì ? Nó Có Ý Nghĩa Gì? Mbbg, Mbtm, Mbtc Là Gì Viết Tắt Của Từ Gì

Squốc lộ Server defines the subsystems listed in the following table:

Subsystem nameDescription
alokapidakaldim.com ActiveX ScriptRun an ActiveX scripting job step.Warning The ActiveX Scripting subsystem is removed from Squốc lộ Server Agent in a future version of alokapidakaldim.com SQL Server. Avoid using this feature in new development work, & plan lớn modify applications that currently use this feature.
Operating System (CmdExec)Run an executable program.
PowerShellRun a PowerShell scripting job step.
Replication DistributorRun a job step that activates the replication Distribution Agent.
Replication MergeRun a job step that activates the replication Merge Agent.
Replication Queue ReaderRun a job step that activates the replication Queue Reader Agent.
Replication SnapshotRun a job step that activates the replication Snapshot Agent.
Replication Transaction Log ReaderRun a job step that activates the replication Log Reader Agent.
Analysis Services CommandRun an Analysis Services command.
Analysis Services QueryRun an Analysis Services query.
SSIS package executionRun an SSIS package.

Note

Because Transact-SQL job steps bởi not use proxies, there is no SQL Server Agent subsystem for Transact-SQL job steps.


Squốc lộ Server Agent enforces subsystem restrictions even when the security principal for the proxy would normally have sầu permission to run the task in the job step. For example, a proxy for a user that is a thành viên of the sysadmin fixed hệ thống role can"t run an SSIS job step unless the proxy has access khổng lồ the SSIS subsystem, even though the user can run SSIS packages.

Proxies

SQL Server Agent uses proxies to lớn manage security contexts. A proxy can be used in more than one job step. Members of the sysadmin fixed hệ thống role can create proxies.

Each proxy corresponds to a security credential. Each proxy can be associated with a phối of subsystems & a phối of logins. The proxy can be used only for job steps that use a subsystem associated with the proxy. To create a job step that uses a specific proxy, the job owner must either use a login associated with that proxy or a member of a role with unrestricted access khổng lồ proxies. Members of the sysadmin fixed hệ thống role have unrestricted access khổng lồ proxies. Members of SQLAgentUserRole, SQLAgentReaderRole, or SQLAgentOperatorRole can only use proxies lớn which they have sầu been granted specific access. Each user that is a member of any of these SQL Server Agent fixed database roles must be granted access khổng lồ specific proxies so that the user can create job steps that use those proxies.

Related Tasks

Use the following steps lớn configure Squốc lộ Server Agent khổng lồ automate Squốc lộ Server administration:

Establish which administrative sầu tasks or VPS events occur regularly và whether these tasks or events can be administered programmatically. A task is a good candidate for automation if it involves a predictable sequence of steps and occurs at a specific time or in response lớn a specific event.

Run the SQL Server Agent jobs you"ve defined.


Note

For the mặc định instance of SQL Server, the Squốc lộ Server service is named SQLSERVERAGENT. For named instances, the SQL Server Agent service is named SQLAgent$instancename.


If you"re running multiple instances of SQL Server, you can use multiserver administration to lớn automate tasks comtháng across all instances. For more information, see Automated Administration Across an Enterprise.

Use the following tasks to lớn get started with Squốc lộ Server Agent:

DescriptionTopic
Describes how to configure Squốc lộ Server Agent.Configure SQL Server Agent
Describes how khổng lồ start, stop, and pause the SQL Server Agent service.Start, Stop, or Pause the SQL Server Agent Service
Describes considerations for specifying an tài khoản for the SQL Server Agent service.Select an Account for the Squốc lộ Server Agent Service
Describes how to lớn use the Squốc lộ Server Agent error log.SQL Server Agent Error Log
Describes how to use performance objects.Use Performance Objects
Describes the Maintenance Plan Wizard, which is a utility that you use create jobs, alerts, và operators to automate administration of an instance of Squốc lộ Server.Use the Maintenance Plan Wizard
Describes how khổng lồ automate administrative sầu tasks using Squốc lộ Server Agent.Automated Administration Tasks (SQL Server Agent)

NOSQLPS

Starting with SQL Server 2019, you can disable SQLPS. On the first line of a job step of the type PowerShell you can add #NOSQLPS, which stops the SQL Agent from auto-loading the SQLPS module. Now your Squốc lộ Agent Job runs the version of PowerShell installed on the machine, & then you can use any other PowerShell module you like.

Xem thêm: Free Download Autodesk Maya 2014 Full Version With Crack 64 Bit

To use the SqlServer module in your SQL Agent Job step, you can place this code on the first two lines of your script.

Bài viết liên quan

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *