Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.

Slides:



Advertisements
Similar presentations
Little Used, but Powerful Features with GP Cathy Fregelette, CPA, PMP Practice Manager BroadPoint Technologies September 20, 2012.
Advertisements

Module 5: Performing Administrative Tasks. Overview Configuration Tasks Routine SQL Server Administrative Tasks Automating Routine Maintenance Tasks Creating.
Maintaining and Automating SQL Server
SQL Server Agent Keith Binford. SQL Server Agent SQL Server Agent is a Windows service that can execute and schedule tasks and jobs.
CNT 4603: Managing/Maintaining Server 2008 – Part 3 Page 1 Dr. Mark Llewellyn © CNT 4603: System Administration Spring 2014 Managing And Maintaining Windows.
Lesson 17: Configuring Security Policies
SQL Server 2005 Implementation and Maintenance Chapter 10: Maintaining and Automating SQL Server.
Chapter 9 Auditing Database Activities
1 Chapter 12 Working With Access 2000 on the Internet.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 11: Monitoring Server Performance.
70-270, MCSE/MCSA Guide to Installing and Managing Microsoft Windows XP Professional and Windows Server 2003 Chapter Thirteen Performing Network.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 10: Server Administration.
Check Disk. Disk Defragmenter Using Disk Defragmenter Effectively Run Disk Defragmenter when the computer will receive the least usage. Educate users.
Using the Windows Event Viewer and Task Scheduler Chapter 5.
AGENDA Tools used in SQL Server 2000 Graphical BOL Enterprise Manager Service Manager CLI Query Analyzer OSQL BCP.
Week 2 - Installation SQL SERVER2000 ENTERPRISE EDITION INSTALLATION.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Week 5 – Chap. 5 Data Transfer DBAs often must transfer data to and from text files, Excel spreadsheets, Access, Oracle or other SQL Server databases This.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
1 Chapter Overview Creating User and Computer Objects Maintaining User Accounts Creating User Profiles.
Today’s Agenda Chapter 12 Admin Tasks Chapter 13 Automating Admin Tasks.
Module 13 Automating SQL Server 2008 R2 Management.
Overview What is SQL Server? Creating databases Administration Security Backup.
1 Chapter Overview Monitoring Server Performance Monitoring Shared Resources Microsoft Windows 2000 Auditing.
1 Chapter Overview Planning an Audit Policy Implementing an Audit Policy Using Event Viewer.
1 Chapter Overview Creating a User Database Setting Database Options Managing User Database Size Placing Database Files on Multiple Disks.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Today’s Objectives Chapters 10 and 11 Security in SQL Server –Manage server logins and database users. –Manage server-level, database-level, and application.
5.1 © 2004 Pearson Education, Inc. Lesson 5: Administering User Accounts Exam Microsoft® Windows® 2000 Directory Services Infrastructure Goals 
Microsoft ® Official Course Module XA Using Windows PowerShell ®
Appendix A Starting Out with Windows PowerShell™ 2.0.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Informix IDS Administration with the New Server Studio 4.0 By Lester Knutsen My experience with the beta of Server Studio and the new Informix database.
Module 10: Monitoring ISA Server Overview Monitoring Overview Configuring Alerts Configuring Session Monitoring Configuring Logging Configuring.
The VPO Operator. [vpo_operator] 2 The VPO Operator Section Overview The role of the VPO operator Starting and stopping the Motif GUI The VPO Operator.
1 SQL Server 2000 Administration Kashef Mughal MSB.
DIT314 ~ Client Operating System & Administration CHAPTER 5 MANAGING USER ACCOUNTS AND GROUPS Prepared By : Suraya Alias.
Windows Vista Inside Out Chapter 22 - Monitoring System Activities with Event Viewer Last modified am.
Learningcomputer.com SQL Server 2008 – Administration, Maintenance and Job Automation.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Module 14 Configuring Security for SQL Server Agent.
Module 1: Exploring Replication. Overview Understanding SQL Server Replication Setting Up Replication Understanding Agents in Replication Securing Replication.
Oracle Data Integrator Procedures, Advanced Workflows.
Module 5: Upgrading to SQL Server 7.0. Overview Planning an Upgrade Preparing to Upgrade Verifying the Upgrade Setting a Compatibility Level.
1 Chapter Overview Preparing to Upgrade Performing a Version Upgrade from Microsoft SQL Server 7.0 Performing an Online Database Upgrade from SQL Server.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
Module 15 Monitoring SQL Server 2008 R2 with Alerts and Notifications.
© 2006 Cisco Systems, Inc. All rights reserved.1 Connection 7.0 Serviceability Reports Todd Blaisdell.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 9 Auditing Database Activities.
2. SQL Security Objectives –Learn SQL Server 2000 components Contents –Understanding the Authentication Process –Understanding the Authorization Process.
1 Chapter Overview Defining Operators Creating Jobs Configuring Alerts Creating a Database Maintenance Plan Creating Multiserver Jobs.
SMS Software Distribution. Overview  Explaining How SMS Distributes Software  Managing Distribution Points  Configuring Software Distribution and the.
Configuring and Troubleshooting Identity and Access Solutions with Windows Server® 2008 Active Directory®
IT System Administration Lesson 3 Dr Jeffrey A Robinson.
Maintenance Practices. Goal  Automate the necessary DBA chores to put organizations on the path of having healthier, consistent and more trustworthy.
Interactions & Automations
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
Mainframe – Control-M Architecture.
SQL Server Agent All the Knobs You Need to Know Taiob M Ali.
SQL Database Management
Managing, Storing, and Executing DTS Packages
SQL Server Agent All the Knobs You Need to Know
Troubleshooting Tools
Chapter 2: System Structures
Deploying and Configuring SSIS Packages
Automating SQL Server Management
Lesson #8 MCTS Cert Guide Microsoft Windows 7, Configuring Chapter 8 Configuring Applications and Internet Explorer.
Windows Server Administration Fundamentals
Chapter 11 Managing Databases with SQL Server 2000
Ch 10. Maintaining and Automating SQL Server
Presentation transcript:

Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies

Benefits of Automation 1.Saves time 2.Reduces chance of human error (forgetting, running wrong task, …) 3.Allows easy execution of tasks in non- peak times or at scheduled times

SQL Server Agent  SQL Server’s primary tool for automation and scheduling  A service in the control panel of the SQL Server2000 machine  Configured with Enterprise Manager in Management object  Can automate many tasks using SQL statements Operating System Commands Programming

Configuring SQL Server Agent SQL Server Agent must be running at all times. To do this: Using Service Manager, configure SQL Server Agent to auto start Using Enterprise Manager, configure SQL Server and SQL Server Agent service to restart automatically if these services stops unexpectedly

Configuring SQL Server Agent (ctd)  SQL Server Agent logon Account must be mapped to sysadmin role Map this account to administrators local group Use a windows domain user account logon account  Use windows authentication mode for SQL Server Agent to permit greater flexibility

SQL Server Agent Objects SQL Server agent works with following objects: Jobs – series of tasks Operators – names and contact info Alerts – response to conditions (normally for errors)

Jobs A job is a set of instructions, schedules and notifications Each individual operation is called a step Step types include Transact-SQL commands, O/S commands, Scripts (ActiveX) Scripts can use VBScript, JavaScript, etc Jobs can use conditional logic Notification methods include , pager and Windows NET SEND

Create a Job Ensure that job is enabled (jobs are enabled by default) Specify the owner who is responsible for performing the job (by default the owner is the logon account creating the job) Define whether the job is to execute on a local server or on multiple remote servers Job categories help to organize, filter and manage many jobs

Define job step using T-SQL Identify database to be used Include required variable and parameters Can send a result set of a job step to an output file (output files are often used in troubleshooting to capture an error message that may have occurred while the statement is executing)

Define a job step using OS commands Operating System commands are identified by.exe,.bat,.cmd,.com files extension Identify a process exit code to indicate that process was successful Include the full path to the executable application in the command text box.

Defining Job Steps Can use ActiveX Script with languages such as Microsoft VBScript, Microsoft Jscript etc. Must identify scripting language in which the job step is written Write or Open Active Script (use the SQL ActiveScriptHost object to print output to the job step history or create object)

Job Flow Logic Example JOB 1: Data Transfer Job Step 1: Back Up Database Type: Transact-SQL: Retry attempts: 1 Job Step2: Transfer Data Type: CmdExec; Retry attempts : 2 Job Step3: Custom Application Type: Active Scripting: Retry attempts: 0 Write to Windows Application Log Notify Operator FAIL? Y Y N N Y Notify Operator N

Job Scheduling  After job has been defined you can schedule the job to be executed automatically  A schedule must be enabled to permit automated execution  Can use Enterprise Manager (GUI) or execute sp_add_jobschedule stored procedure to define job schedule  Job schedules are stored in the msdb.sysjobschedules system tables

Job Scheduling (ctd)  Can schedule jobs to start automatically: When SQL Server Agent started At a specific time (one time only) On a recurring basis (daily, weekly, or monthly) When CPU is idle

Notification  Operators are notified of events that take place on SQL Server  Operators don’t require a SQL Server login  Notifications are messages sent to the operators  Notification methods can be: pager Windows NET SEND command  Operators should be available for contact as required

Operators Use group alias to notify more than one individual to respond to notification Test each notification method to ensure that the operator is able to receive messages Should specify a work schedule for each operator to be notified by pager Use NET SEND command to send messages to network operators and servers running Windows 2000 or Windows NT.

Operator Notification Ensure operator is available to receive notifications Ensure messenger service is running on computer of the operator to be notified by NET SEND command Review most recent notification steps to determine date and time of last notification Test individual notification methods outside of SQL Server by verifying that you can send e- mail messages, page an operator or successfully execute a NET SEND command.

Job History  Job history can be viewed from Enterprise Manager and directly in the msdb..sysjobhistory system table  Sysjobhistory table records: Date and time each job step occurred Success or failure of job step The operator notified and notification method The duration of job step Errors or messages from job step

Job History Size By default, msdb database file properties are set to auto growth, and the Truncate log on checkpoint database option is turned on. By default, maximum job history size is set at 1,000 rows By default, maximum job history size for each job is set at 100 rows Rows are removed from sysjobhistory system table in a first-in, first-out (FIFO) manner when size limit is reached

Execution Permissions  For T-SQL Jobs: context of job owner or a specific user  Operating System and ActiveX Script jobs: Members of Sysadmin role use the SQL Server Agent login account Job owners that are not members of the sysadmin role use defined domain user account called a proxy account