Today’s Agenda Chapter 12 Admin Tasks Chapter 13 Automating Admin Tasks
Configure SQL Server Service SQL Server Service is the service that runs the database engine Options that can be changed are –Connections –Database –Memory –Processor –Server Use Enterprise Manager or sp_configure to change the options
General properties - EM
Connections properties - Table 12-1
Database Settings - Table 12-2
Memory properties - Table 12-3
Processor properties - Table 12-4
Server Settings properties Table 12-5
Sp_configure Displays or changes settings for the current server. Syntax is sp_configure =] 'name'] =] 'value'] e.g. USE master EXEC sp_configure 'recovery interval', '3'
SQL Server Agent This is the agent that runs scheduled jobs and tasks in SQL Server Can use either local system account or domain user account (preferred) Additional permissions are required as listed in Table 12-6 In Enterprise Manager, located under Management container Typically the same account running SQL Server should also run the agent
SQL Server Agent
Event log - Right click on Agent
Mail options in SQL Server SQL Server can send s!! You need to create a mail profile You need to use a domain user account for SQL Server login Two types of mail services in SQL SQL Mail is the mail service of SQL Server service SQLAgent Mail is the mail service of SQL Server Agent xp_sendmail is used to send
SQL Mail configuration
SQL Mail stored procedures xp_startmail xp_stopmail sp_processmail xp_findnextmessage xp_readmail xp_delet xp_sendmail
Linked Servers Linked Server let you run distributed queries from different databases on different servers This is different than registering servers in EM which can only be another SQL Server Any OLE DB datasource can be linked e.g. Oracle, Access, Sybase etc Use the stored procedure sp_addlinkedserver to add a server
Supported OLE DB providers MS OLE DB Provider for SQL Server –Connection to SQL Server MS OLE DB Provider for Oracle –Connection to Oracle servers MS OLE DB Provider for Jet –Connection to Microsoft Access, Excel spreadsheet, and Jet-format databases MS OLE DB Provider for ODBC –Connection to ODBC data sources MS OLE DB Provider for Indexing Service –Connection to operating system file source
Linked Server properties General properties –Server name –Server type –Product name –Provider string –Location –Catalog
Syntax for Linked Server SQL Server –LinkedServerName.Database.Owner.Ta ble Oracle –LinkedServerName…Owner.Table Access –LinkedServerName...Table
Misc. Topics ODBC DSN let you access data from other sources We can use Access as an example SQL Server does support XML which lets you export data in a different format SQL Server works with IIS Server to achieve this
In Class Exercises Configure SQL Mail and SQL Agent Mail on your SQL Servers Pages Pages Create an ODBC datasource that points to Northwind database on your SQL Server. Page 226 has info Create a blank db in Access and link data from the ODBC source Review the work with me to get credit
Events, Alerts and Jobs Events are when something typically an error occurs on the SQL Server e.g. Pubs database log fills up Alerts would be a message sent to an Operator that an event has occurred e.g. Pubs db log is full Jobs would be the steps taken by the SQL Server to remedy the problem e.g. Truncating the pubs db log Here is the process
Operators The Operator is the person or group notified about the status of a job The methods of notification include – –Pager –Net Send Fail-Safe Operator is notified as a last resort Operator can be created using EM or T-SQL stored procedures
Operator properties - EM
Notifications properties
What is a Job? Jobs are the steps that automate admin tasks like backing up database Jobs can be created using –Enterprise Manager –Create Job Wizard –T-SQL statements Jobs are owned by the creator Jobs either succeed or fail Jobs can be run manually but are often scheduled to run on their own
Job General properties - EM
Job steps
Job schedule
Notifications properties
In Class Exercises Page Instead of SelfPaced CPU use your machine name Page 458 Page 463 Page 469 Review the results with me Take a break
Alerts Alerts are defined to provide event notification Alerts can be existing or user defined User defined messages are numbered 50,000 or higher Performance counters can be used to define an alert With an alert, you execute a job and notify an operator Can be created using EM or T-SQL
Event Alert - By Error
Event Alert - By Severity
Performance condition Alert
Alert Response
Database Maintenance Plan Wizard Select databases Data optimization Database integrity check Backup plan Backup disk directory Transaction log backups Reporting Maintenance plan history Maintenance plan name
MSXOperator - Master Server
TSX servers - Target Server
More Exercises Pages Pages Pages (optional) –For this work with someone else and use their machine as Target Review the results before you leave Next week Chapter 14 Final Project also due next week