Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net.

Post on 19-Dec-2015

218 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

Transcript

Agenda

Why Automate?What can we Automate?How can we Automate?Putting it all together (Demonstrations)Monitoring your Monitoring?Additional Tools AvailableQuestions

Who am I? SQL Database Administrator OSI Restaurant PartnersSQL Server MVPMSDN Forums ModeratorFounder SQLCLR.netMember Tampa SQL Users GroupPASS Member

Predictable ResultsReduce workload - do more in less timeDemonstration of Value

Why Automate?

What can we Automate?

Installation and Configuration SQL Server SoftwareBackups and Database MaintenanceLog Checking

SQL Server Error LogServer Event Logs

Check Drive/Database Free SpaceCheck Job Success/Failure HistoryMonitor PerformanceMulti-step operations

SQL Server AgentDTS/SSIS packagesStored ProceduresVBscript/ActiveXCmdExec Operating System processes

Windows Task SchedulerVBScripts.NET ApplicationsPowershell

Dos Batch FilesMultistep processes

How can we Automate?

SQL Server Agent

ProsAdvanced SchedulingBuilt in AlertingBuilt in LoggingDetailed Execution HistoryEasily scripted against

ConsDependency on SQL ServicesNon-SQL Admins require SQL Access to view schedulesTasks Execute under the Service Account unless setup with a proxy

Windows Task Scheduler

ProsDoes not depend on SQL ServicesNon-SQL Admins can see schedulesReduced Security through use of Run-As

ConsLacks Detailed History of SQL AgentLogging must be done by operation being runRequires additional steps to connect with SQLNot easily scriptable

What to Automate (Backups and Maintenance)

Database Maintenance PlansCustom ScriptsCustom Schedules

DEMO BACKUPS AND MAINTENANCE AUTOMATION

What to Automate (SQL Server and Windows Logs)

Log Rollover and RetentionException based AlertingAggregation of Events (Multi-Server)

DEMO SQL ERROR LOG AUTOMATION

What to Automate (Drive Free Space)

DTS/SSIS PackageWMI with VBScriptCOM with TSQL

DEMO DRIVE FREE SPACE AUTOMATION

What to Automate (Database Free Space)

TSQLVBScript with WMI or DMOSMO with PowerShell

DEMO DATABASE FREE SPACE AUTOMATION

What to Automate (SQL Agent Job History)

TSQLAdhoc QueriesTrigger on sysjobhistory

VBScript with WMI or DMOSMO with PowerShell

DEMO SQL AGENT JOB HISTORY AUTOMATION

What to Automate (Multi-Step Operations)

TSQLVBScript with WMI or DMO or TSQLSMO with PowerShell/.NETDOS Batch with osql and sqlcmd

DEMO MULTI-STEP OPERATIONS AUTOMATION

What to Automate (Monitoring Performance)

SQL Agent AlertsWMI AlertsSQLH2 Performance CollectorTSQL DMV Queries

DEMO DATABASE FREE SPACE AUTOMATION

Monitoring your Monitoring?

How do you know your monitoring is working?Can you trust your monitoring?

Additional Tools

Free Tools AvailableSQL Server PowerShell Extensions SQL Server Health & History (SQLH2)

Recently Released Open SourceSqlMonitoring Tool

Non-Free ToolsQuestRed-GateIderaSQL Server 2008

Questions

top related