sqlserver

Why You (usually) Want a Clustered Index

Andy Levy

Note: I originally wrote this a few years ago but never posted it. It resurfaced when I migrated the blog so it’s being posted now.

After watching Kevin Kline’s (blog | twitter) webinar Essential Tasks to a Successful Cloud Migration, I downloaded the T-SQL scripts to run them against some of my databases. One of the included queries identifies tables with forwarded fetches and right on top of the list was a table with over 1.6 billion forwarded fetches in the roughly 3 weeks since the instance was last restarted.

Lesson Learned From Multi-Threading with dbatools

Andy Levy

Over the summer, I spent some (a lot of) time working on updates to a script at work which runs multiple processes in parallel. Everything seemed to work OK for a while, but then everything broke. It broke right around the time dbatools 1.1 dropped, so I started thinking that something must have changed there. As it turns out, it was entirely my fault and I hope this post will help you avoid the same trap.

Troubleshooting Backup Compression for Encrypted Databases

Andy Levy

For years, I thought that native backups of databases using Transparent Data Encryption (TDE) couldn’t be compressed. Between TDE being limited to Enterprise Edition until SQL Server 2019 and my own lack of experience with TDE in prior positions, I hadn’t really experimented with this myself. Some people have even gone so far as to skip compression in their backup jobs for TDE-enabled databases because there’s no need to burn those CPU cycles if you won’t get any compression, right?

T-SQL Tuesday #136: Your Favorite (or Least Favorite) Data Type

Andy Levy
T-SQL Tuesday is a monthly blog party hosted by a different community member each month, and this month Brent Ozar (blog | twitter) asks us to talk about data types. Your mission: write a blog post about your favorite data type, and schedule it for next Tuesday, March 9. Mad about money? Feverish about float? Tell us what you use your favorite data type for, and what people need to know before they get started using it.

Upgrading Ola Hallengren's Maintenance Solution with dbatools

Andy Levy
While presenting Backup Basics with Powershell and dbatools at ONDT, I mentioned a caveat with the -ReplaceExisting switch for Install-DbaMaintenanceSolution. This switch drops all of the objects installed by the Maintenance Solution, including the CommandLog table. If you use that table to produce evidence that the various maintenance tasks are being performed on a regular basis or use it to track performance of those tasks over time, dropping that table presents a problem.

A Non-Technical Reason to Not Use SELECT *

Andy Levy
I got a merge a while back that included a change I wasn’t expecting from one of my developers. All they were doing was renaming a column on a table. We had names settled a while ago. What’s up with that? Turns out, when I created the table, I named one of the fields BrithYear. This merge request corrected it to BirthYear. The misspelling slipped past me, past everyone else, it was only discovered because when this developer was building the a new query into their code, they spelled the field as one would expect, and the query threw an error.

Slides & Demos for Backup Basics with PowerShell & dbatools

Andy Levy
I had the honor of presenting a new session, Backup Basics with Powershell and dbatools, at the first Ohio North Database Training meeting this evening. Thank you to the group leaders for the opportunity and to everyone who attended. Because this was both a brand new session and an attempt at a new way of delivering the presentation, I had a couple tech glitches but things went pretty well once they were understood and ironed out.

Restoring Database Users After Copying the Database

Andy Levy
A former colleague emailed me with a question about retaining/fixing database users and permissions after restoring a database. They were copying a database from one instance to another, with different logins, users, and permissions between the two instances. Backup & restore to copy the database is easy enough, but because users & permissions are kept inside the database itself, the destination environment loses all its permissions settings in the process. What to do?