Find-and-Replace for SQL Server Agent Jobs

Once in a while you might need to make common changes to a lot of SQL Server Agent Jobs. For example, if you change the path where you store SQL Server backup files, you might…

Detect Databases with High VLF Count

Introduction Broadly speaking, the recovery process for SQL Server consists of reading the transaction log, rolling forward committed transactions, and rolling back uncommitted transactions, since the last checkpoint. The SQL Server Transaction Log is segmented…

How to Fix Databases with High VLF Count

In our earlier posts on recovery, we’ve covered the importance of properly managing SQL Server Transaction Log file growth. This includes how to detect databases with a high VLF count. It can be time-consuming to…

Generate Restore Database Commands

Restoring a database backup from one server to another, or from one database to another on the same machine, often requires MOVE … TO … commands. For databases with a lot of files, this can…

Build a CREATE TABLE statement from the output of a Stored Procedure with dm_exec_describe_first_result_set

Day-to-day database administration and development on SQL Server will often require creating a temporary table to hold the output of some stored procedure. The code below uses the dm_exec_describe_first_result_set 1 system dynamic management function, or…

Error Log Analysis Script

SQL Server Error Logs show various aspects regarding the state of the SQL Server Instance. Error log analysis helps ensure nothing unexpected happens, and is useful for diagnosing existing problems. The error log is stored…