Download presentation
Presentation is loading. Please wait.
Published byMaximilian Beasley Modified over 6 years ago
1
Database Tricks And Treats on Managing SQL Server
Jonathan Fite Oakwood Systems Group
2
Jonathan Fite Oakwood Systems Group
Database Administrator for 10 years MCSE Enjoys scripting out just about everything Jack of all trades – System Administration, Developer, Copier Repair, Help Desk, Database Administrator, Air Conditioner Cooler
3
Overview Favorite Tools Other People’s Work SQL Server Tips
Rules of Thumb Scripting Troubleshooting Thoughts
4
NotePad++ Free, open source (GPL)
Text and script editor Multiple language syntax highlighting support (PowerShell, SQL) Thriving plug-in community Compare Combine Poor Man’s TSQL Formatter (more on this later)
5
Poor Man’s TSQL Formatter Free, Open source
Basic TSQL Formatter Available as web formatting, Notepad++ plug-in, SSMS (2014?) plug- in, command line version
6
Other People’s Work Standing on the shoulders of giants
Adam Machanic – sp_WhoIsActive Brent Ozar – Blitz Scripts (sp_Blitz, sp_BlitzIndex, sp_AskBrent, etc.) Ola Hallengren – Maintenance Solution Kendal Van Dyke – SQL PowerDoc
7
Indexes Clustered indexes don’t need to be the primary key, but they should be narrow and ever increasing/Decreasing. Use the column most commonly used for lookups (joins, ranges, etc.) May have to decide where you want to pay the piper Heaps are lazy (for the most part) Deletes on Heaps are odd… Foreign Key columns should have a non-clustered index on them Defragment as often as the SLA can stand it.
8
Backups What are you backing up?
Databases – FULL, DIFF, LOG, FILEGROUP LOGINS – with SID? Agent Jobs Database Mail Configuration Encryption Keys Service Master Key SSISDB Key SSRS Keys Server Configuration – HINT: dump sys.configurations Linked Servers, Proxy Accounts, Replication, Cluster, Always On Availability Groups Watch out for SAN or VM based backup solutions…
9
Other Tips Cross Domain Authentication – “Runas /netonly /user:<domain>\<username> <program>” SSMS, PowerShell, Notepad++, SSMS – ALT+SHIFT+ARROW(up/down) Running a UHD screen and Remote Desktop sucks? – Say hello to External Manifest
10
Rules of Thumb Change the model database to what you want the default Recovery model to be. Get in the habit of terminating SQL with a semi-colon. Use two part naming. (<schema>.<object>) Backup your Server Master Key, SSISDB key and SSRS keys. Always Use at least 4 disks for data in Azure (stripe). Linked Servers Suck. Assume that documentation starts out being only 80% correct… and doesn’t improve with age.
11
Scripting Anything you do more than once
Powershell.exe –ExecutionPolicy Bypass –File “<PathtoFile>” -Argument1 “value1” PowerShell Step in SQL Agent works… but kind of sucks, missing many new features of Powershell Interact with SQL Server through SSMS Call the Scripter engine
12
Troubleshooting Define problem, avoiding subjective measurements
How much slower (and measure)? Did it ever work correctly? How was the problem originally noticed? Identify components involved Check Versions and patch level What Changed? Isolate components and test individually Try the obvious first, or at least make sure it was done correctly.
13
Thoughts Read – Blogs, Stack Exchange Questions, Forums, etc.
SQL Skills, Brent Ozar, SQL Blog Automate – Automate/Script one task a month Learn your infrastructure stack Test your restores regularly
14
References – In No particular Order
Notepad++ - Poor Man’s TSQL Formatter - Adam Machanic aspx Brent Ozar - Ola Hallengren - Kendal Van Dyke - Dale Hayter (Remote Desktop) - surface-book Learn PowerShell In A Month Of Lunches by Don Jones and Jeffrey Hicks DBA Reactions -
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.