automating common dba tasks jonathan kehayias mcitp database administrator sql server mvp ...
Post on 19-Dec-2015
226 views
TRANSCRIPT
![Page 1: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/1.jpg)
Automating Common
DBA TasksJonathan Kehayias
MCITP Database AdministratorSQL Server MVP
http://sqlblog.com/blogs/jonathan_kehayias
code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title
=AutomatedDBA
![Page 2: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/2.jpg)
Agenda
Why Automate?What can we Automate?How can we Automate?Putting it all together (Demonstrations)Monitoring your Monitoring?Additional Tools AvailableQuestions
![Page 3: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/3.jpg)
Who am I? SQL Database Administrator OSI Restaurant PartnersSQL Server MVPMSDN Forums ModeratorFounder SQLCLR.netMember Tampa SQL Users GroupPASS Member
![Page 4: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/4.jpg)
Predictable ResultsReduce workload - do more in less timeDemonstration of Value
Why Automate?
![Page 5: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/5.jpg)
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
![Page 6: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/6.jpg)
SQL Server AgentDTS/SSIS packagesStored ProceduresVBscript/ActiveXCmdExec Operating System processes
Windows Task SchedulerVBScripts.NET ApplicationsPowershell
Dos Batch FilesMultistep processes
How can we Automate?
![Page 7: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/7.jpg)
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
![Page 8: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/8.jpg)
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
![Page 9: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/9.jpg)
What to Automate (Backups and Maintenance)
Database Maintenance PlansCustom ScriptsCustom Schedules
DEMO BACKUPS AND MAINTENANCE AUTOMATION
![Page 10: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/10.jpg)
What to Automate (SQL Server and Windows Logs)
Log Rollover and RetentionException based AlertingAggregation of Events (Multi-Server)
DEMO SQL ERROR LOG AUTOMATION
![Page 11: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/11.jpg)
What to Automate (Drive Free Space)
DTS/SSIS PackageWMI with VBScriptCOM with TSQL
DEMO DRIVE FREE SPACE AUTOMATION
![Page 12: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/12.jpg)
What to Automate (Database Free Space)
TSQLVBScript with WMI or DMOSMO with PowerShell
DEMO DATABASE FREE SPACE AUTOMATION
![Page 13: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/13.jpg)
What to Automate (SQL Agent Job History)
TSQLAdhoc QueriesTrigger on sysjobhistory
VBScript with WMI or DMOSMO with PowerShell
DEMO SQL AGENT JOB HISTORY AUTOMATION
![Page 14: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/14.jpg)
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
![Page 15: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/15.jpg)
What to Automate (Monitoring Performance)
SQL Agent AlertsWMI AlertsSQLH2 Performance CollectorTSQL DMV Queries
DEMO DATABASE FREE SPACE AUTOMATION
![Page 16: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/16.jpg)
Monitoring your Monitoring?
How do you know your monitoring is working?Can you trust your monitoring?
![Page 17: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/17.jpg)
Additional Tools
Free Tools AvailableSQL Server PowerShell Extensions SQL Server Health & History (SQLH2)
Recently Released Open SourceSqlMonitoring Tool
Non-Free ToolsQuestRed-GateIderaSQL Server 2008
![Page 18: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/18.jpg)
Questions
![Page 19: Automating Common DBA Tasks Jonathan Kehayias MCITP Database Administrator SQL Server MVP jmkehayias@sqlclr.net](https://reader036.vdocuments.site/reader036/viewer/2022062421/56649d2c5503460f94a01b3e/html5/thumbnails/19.jpg)
Resources
The DBA Checklist (Buck Woody)Microsoft Internal Database Operation Team ScriptsAutomating DBA Processes (TechEd 2008)Automating Common SQL Server Tasks using DMO