Intro
Like many SQL Server DBAs I run into a problem at work or get an idea in my head then scour the internet to see if someone else had the same thing so I don’t have to reinvent the wheel. Some DBAs stop...
View ArticleDatabase Assessment
This script looks much more intimidating than the results it produces, so I recommend running it before reading through it. I’ll run this when I first get on a unfamiliar server as a basic assessment...
View ArticleCopy / Paste Code
Copy / Paste formatted text is a nightmare in WordPress. I’m singling out WordPress because I use it, and, from what I can see, every blog site has this issue. If you have a SQL Script (again,...
View ArticleFile Sizes
There are two scripts I like to use to look at the file sizes on servers. The first one is everything I could hope for on servers where there is only a single file per filegroup. All of the vital...
View ArticleCluster Info
This script is so simple you’ll start off by asking why you’d ever use it. Then you’ll use it and wonder why no one gave this to you as part of your new-hire orientation at your first DBA job. The...
View ArticleBackup History
Can you tell me the drive we were backing up server #58 to exactly 8 months ago, and, if possible, it would really help if you could give me the exact file name for me to pull the backup from tape for...
View ArticleRunning Processes
Sp_who2 is not used by this DBA. That info is amazingly good to have, but I want more. Don’t get me wrong, sp_who2 is kinda hidden in this one as it’s really just a proc that does little more than...
View ArticleIndex Columns and Names
Don’t trust the name of an index to tell you what it is. The name is wrong, or at least that’s what you have to assume. I’m a huge fan of index naming conventions, with my favorite being starting out...
View ArticleTable Sizes
Although this isn’t guaranteed to be 100% accurate, it’s fast and usually extremely close if it’s not perfect. You can find this code all over the internet, mine is just a slight variation where I...
View ArticleRoll Logs – Backup Recovery
Rolling log files for a day, especially with 15 or even 5 minute log backups is a pain at best. Here’s a slightly better way to do it. Set the two variables at the top to the directory where the log...
View ArticleJob Schedules – SQL Agent
This info should be easier to get than it is. Keep in mind that for something to run the subscription and schedule both have to be enabled. To be fair, the majority of this code was grabbed from the...
View ArticleIndexes – Unused and Duplicates
Indexes aren’t free, and many databases end up with unused indexes. Every time you make any update to a table you will be updating the clustered index (I assume no heaps, because I hate heaps), and...
View ArticleIndexes – Understanding basic types and their components
The biggest problem developers and newer DBAs have with understanding indexes is that you don’t realize when you’re using the exact same thing away from your computer. Pick up any reference style book...
View ArticleWait Stats – sys.dm_os_wait_stats – Monitoring and Using
sys.dm_os_wait_stats is one of the most important DMVs out there, and one that you should know the historical values of for every server you care about. This DMV will tell you the cumulative amount of...
View ArticleBlocking – Capturing and Monitoring
If a query is taking longer to run than normal, there’s a good chance it’s being blocked by something else. This is especially true when you’re doing something rediculously simple and SQL Server just...
View ArticleWhite papers, DMVs and Monitoring Concepts
According to Jason Strate (SQL Server MVP) there are 5 white papers ever SQL Server DBA should read. Considering my blogging is focused on how to monitor and tune previously installed servers, we’ll...
View ArticleTracing Introduction
SQL Server tracing is essential for troubleshooting performance issues, yet it can put loads on your server that would cause noticeable slowness, capture so much information that it fills the drive,...
View ArticleReading Traces
Capturing information is useless unless you know how to use it. Here’s what I use to get the most out of my basic trace of anything taking over so many seconds. This is also my template for more...
View ArticleRecently Recompiled Resource Hogs
It’s not too uncommon for a query to get a new execution plan that performs a lot worse than it could, and sometimes it’s bad enough to drag the whole server down to a halt. When it’s something...
View ArticleSQL Server Running Slow
A user calls to say the app or server is slow today. Here’s a quick summary of how I get started. It depends on monitoring where you can compare baselines to recent activity, and I include links to...
View Article