0% found this document useful (0 votes)
18 views23 pages

6 Sqlserver 2012ic m6 Maintenance Slides

Uploaded by

etest2272
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views23 pages

6 Sqlserver 2012ic m6 Maintenance Slides

Uploaded by

etest2272
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

SQL Server 2012:

Installation and Configuration

Module 6: Automating Common


Maintenance Tasks for SQL Server 2012
Glenn Berry
[email protected]
Introduction

 Confirming network connectivity


 Confirming SQL Server connectivity
 Enabling Database Mail
 Creating a New SQL operator
 Creating SQL Server Agent Alerts
 Ola Hallengren’s Maintenance Solution
 Adding Schedules and Notifications to SQL Agent Jobs
Confirming Network Connectivity

 You need to confirm that other machines can connect to your SQL
Server instance over the network
 Use SQL Server Configuration Manager
 Select SQL Server Network Configuration
 Protocols for MSSQLSERVER (or your instance name)
 Ensure that the appropriate network protocols are enabled
 Usually you will want TCP/IP to be enabled
 It may already be enabled (depending on what SQL Server Edition)
 You should always double-check whether it is enabled
 Any change to the status of these protocols will require a restart of that instance
of SQL Server
 There will be a warning prompt to remind you of this
 You can use Ping (from a command prompt) on another machine to confirm
basic network connectivity
 You may have to open ports in your Windows firewalls
 Ports 1433 and 1434 are the default ports for a default instance of SQL Server
SQL Server Configuration Manager
Confirming SQL Server Connectivity

 Use a Microsoft Data Link to check SQL Server connectivity


 This does not require any special tools on the remote machine
 Use these steps to create and use a data link file
 Create a blank text file on the desktop of the machine
 Change the file extension from .txt to .udl
 You may have to unhide file extensions in Windows Explorer
 Double-click on the .udl file to open a Data Link Properties dialog
 Enter the appropriate server name and logon information
 Click on the “Test Connection” button
 This test will confirm several items
 The SQL Server Service is running and a network protocol is enabled
 The appropriate ports are open between the two machines
 Your logon credentials can connect to the instance
 Your logon credentials can connect to a particular database
Microsoft Data Link Properties
Enabling Database Mail

 This is required so that SQL Server can send mail


 It is used for notifications and alerts about errors and failed Agent jobs
 Follow these steps to enable Database Mail
 Enable the Database Mail XPs
 Then use the Database Mail Configuration Wizard to set properties
 Create a Database Mail account and profile
 You must have access to an e-mail server that supports SMTP
 You will need to know your outgoing mail server (SMTP) information
 You may need assistance from a network administrator
 BOL Topic: http://bit.ly/SEZbKj
Enable Database Mail XPs with T-SQL
Database Mail Configuration Wizard
Creating a New SQL Operator

 You need to create at least one SQL operator


 Operators are aliases for people or groups that can receive electronic
notification when jobs have completed or alerts have been raised
 The SQL Server Agent service supports the notification of administrators
through operators
 Operators enable the notification and monitoring capabilities of SQL Server
Agent
New Operator Dialog
Create a New Operator with T-SQL
Creating SQL Server Agent Alerts

 You need to create SQL Server Agent alerts for certain critical errors
 Severity 19 through Severity 25 errors
 Error 825 – Read-retry required
 Read this Paul Randal blog post
 http://bit.ly/XuxbMA
 You want to know about these errors as soon as possible!
 Make sure to configure a response for each alert
 A SQL Server Agent alert can trigger an e-mail, a net send, or a page
 An e-mail to a distribution group is the preferred method
 Net send and paging are deprecated in SQL Server 2012
SQL Agent Alert General Properties
SQL Agent Alert Response Options
Checking SQL Server Service Properties
SQL Server Agent Start Mode Property
Ola Hallengren’s Maintenance Solution

 Ola Hallengren has developed and maintains an excellent script


 Handles database backups
 Full, differential, and log backups for user databases
 Full backups for system databases
 Index maintenance
 Intelligently reorganizes or rebuilds as necessary
 It also does statistics maintenance
 Database integrity checks with DBCC CHECKDB
 User databases
 System databases
 Very flexible and configurable
 In Production use with many organizations around the world
 It is a free download available at this link
 http://bit.ly/W528k
Implementing the Maintenance Solution Scripts

 Download the MaintenanceSolution.sql file


 Open the MaintenanceSolution.sql script in SSMS
 Change this line in the script to point to your backup directory, by replacing
“C:\Backup” with the path to your directory:
SET @BackupDirectory = N‘M:\Backup‘
 Execute the MaintenanceSolution.sql script in SSMS
 This will create eleven new SQL Agent jobs
 Run each job manually to verify that it is working correctly
 Create a job schedule for each new SQL Agent job
 This will depend on your RTO/RPO objectives and infrastructure
 Add a notification to each new SQL Agent job
 This will let you know when a job fails
Adding a Job Schedule to an Agent Job
Adding a Notification to an Agent Job
Suggested Default Maintenance Job Schedule

Job Name Run Schedule


CommandLog Cleanup Every Sunday at 12:00AM
DatabaseBackup - SYSTEM_DATABASES – FULL Every day at 11:55PM
DatabaseBackup - USER_DATABASES – DIFF Every day at 12:00PM
DatabaseBackup - USER_DATABASES – FULL Every day at 12:00AM
DatabaseBackup - USER_DATABASES – LOG Every 30 minutes
DatabaseIntegrityCheck - SYSTEM_DATABASES Every Saturday at 9:00AM
DatabaseIntegrityCheck - USER_DATABASES Every Saturday at 9:00AM
IndexOptimize - USER_DATABASES Every Monday at 3:00AM
Output File Cleanup Every Sunday at 12:01AM
sp_delete_backuphistory Every Sunday at 12:02AM
sp_purge_jobhistory Every Sunday at 12:03AM
Course Summary

 There are many steps to a complete SQL Server 2012 installation


 Hardware configuration
 Operating system configuration
 Proper SQL Server installation
 There are a number of post-installation configuration tasks
 Installing the latest Service Pack and Cumulative Update
 Setting instance properties
 Configuring tempdb
 There are important alerting and maintenance tasks
 Enabling Database Mail
 Creating SQL Agent Alerts
 Using Ola Hallengren’s Maintenance Solution

 Thanks for watching!

You might also like