Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL Server Agent Keith Binford. SQL Server Agent SQL Server Agent is a Windows service that can execute and schedule tasks and jobs.

Similar presentations


Presentation on theme: "SQL Server Agent Keith Binford. SQL Server Agent SQL Server Agent is a Windows service that can execute and schedule tasks and jobs."— Presentation transcript:

1 SQL Server Agent Keith Binford

2 SQL Server Agent SQL Server Agent is a Windows service that can execute and schedule tasks and jobs.

3 SQL Server Agent Configuration Manager

4

5 Configuring SQL Server Agent Properties Executing jobs based on resource availability Idle CPU Condition When to restart SQL Server Agent Auto restart SQL Server (Recommended) Auto restart SQL Server Agent (Recommended) How much information to persist in the error log Include Execution Trace Messages(check disk space) Alerts and notifications

6 Configuring SQL Server Agent Properties

7

8

9 SQL Server Agent Job Schedule Operator Alert Proxy

10 Configuring 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-line applications, Microsoft ActiveX scripts, Integration Services packages, Analysis Services commands and queries, or Replication tasks. Jobs can run repetitive tasks or those that can be scheduled, and they can automatically notify users of job status by generating alerts, thereby greatly simplifying SQL Server administration. *

11 SQL Server Agent SQL Server Integration Services (SSIS) packages T-SQL scripts PowerShell scripts ActiveX scripts Replication tasks Analysis Services tasks Operating system task (CmdExec)

12 Configuring Jobs

13 USE msdb ; GO EXEC = N'Weekly Sales Data Backup' ; GO EXEC = N'Weekly Sales Data = N'Set database to read = = N'ALTER DATABASE SALES SET = = 5 ; GO EXEC = = = ; USE msdb ; GO EXEC = N'Weekly Sales Data = N'RunOnce'; GO EXEC = N'Weekly Sales Data Backup'; GO

14 Creating Operators An Operator is the person to be notified when a certain action or event occurs on SQL Server or SQL Server Agent.

15 Creating Operators

16 Only members of the sysadmin fixed server role can create operators. SQLAgentUserRole SQLAgentReaderRole SQLAgentOperatorRole Note that SQL Server Agent must be configured to use Database Mail to send and pager notifications to operators. The Pager and net send options will be removed from SQL Server Agent in a future version of Microsoft SQL Server. Avoid using these features in new development work, and plan to modify applications that currently use these features.

17 Creating Operators -- sets up the operator information for user 'danwi.' The operator is enabled. -- SQL Server Agent sends notifications by pager from Monday through Friday from 8 A.M. to 5 P.M. USE msdb ; GO EXEC = N'Dan = = = = = 62 ; GO

18 Creating Alerts Alerts are automated notifications that are fired when certain events are triggered. SQL Server event SQL Server performance conditions Windows Management Instrumentation(WMI) event Windows Management Instrumentation (WMI) is the infrastructure for management data and operations on Windows-based operating systems. You can write WMI scripts or applications to automate administrative tasks on remote computers but WMI also supplies management data to other parts of the operating system and products, for example System Center Operations Manager, formerly Microsoft Operations Manager (MOM), or Windows Remote Management (WinRM).WinRM

19 Creating Alerts

20 USE msdb EXEC = 'Test = = = 'Error has occurred. The database will be backed = 'Back up the Customer Database'

21 Creating Alerts -- adds an notification for the specified alert (Test Alert) -- This example assumes that Test Alert already exists and that François Ajenstat is a valid operator name. USE msdb ; GO EXEC = N'Test = N'François = 1 ; GO

22 Creating Proxies A SQL Server Agent proxy defines the security context for a job step. A proxy provides SQL Server Agent with access to the security credentials for a Microsoft Windows user. Each proxy can be associated with one or more subsystems. A job step that uses the proxy can access the specified subsystems by using the security context of the Windows user. Before SQL Server Agent runs a job step that uses a proxy, SQL Server Agent impersonates the credentials defined in the proxy, and then runs the job step by using that security context.

23 Creating Credentials Credentials provide a way to allow SQL Server Authentication users to have an identity outside of SQL Server. Credentials can also be used when a SQL Server Authentication user needs access to a domain resource, such as a file location to store a backup A credential can be mapped to several SQL Server logins at the same time. A SQL Server login can only be mapped to one credential at a time.

24 Creating Credentials

25 Creating Proxies

26 sp_add_proxy = ] 'proxy_name', = ] is_enabled, = ] 'description', = ] 'credential_name', = ] credential_id, = ] id OUTPUT

27 References Microsoft SQL Server 2012 by Patrick LeBlanc

28 END


Download ppt "SQL Server Agent Keith Binford. SQL Server Agent SQL Server Agent is a Windows service that can execute and schedule tasks and jobs."

Similar presentations


Ads by Google