SQL Server Backup Compression: Enable and Verify
Apr 17, 2026 / · 7 min read · sql server backup recovery backup compression sp_configure msdb sql scripts database administration maintenance scripts sys.configurations ·Backup compression reduces the on-disk size of SQL Server backup files and can significantly shorten backup duration by reducing the amount of data written to disk. This post shows how to enable compression at the server level, verify the setting is active, and confirm compression ratios from backup history using the …
Read MoreSQL Server CPU Utilization History Report
When a CPU alarm fires on a SQL Server host, the first question is whether the database engine caused it or something else on the machine did. The scheduler monitor ring buffer keeps a short history of exactly that split, and a single query turns it into one row per sample: SQL Server CPU, everything-else CPU and total …
Read MoreSQL Server DBCC CHECKDB Last Run Date Report
Apr 17, 2026 / · 8 min read · sql server dbcc commands database maintenance database integrity DBCC CHECKDB DBCC DBINFO dba scripts database administration sql server monitoring integrity check sys.databases ·In busy SQL Server environments it is easy to lose track of which databases have had a recent DBCC CHECKDB and which have not. This script loops through all user databases, reads the last known good DBCC CHECKDB date from each one, and presents the results sorted from oldest to newest so you can spot gaps fast. Purpose …
Read MoreSQL Server Find Orphan Users Script
Apr 17, 2026 / · 8 min read · sql server security orphan users sys.database_principals sys.server_principals sp_change_users_login database administration sql scripts security audit login management ·Orphaned database users are a common problem after database restores, server migrations, or login deletions. A database user becomes orphaned when its SID does not match any server-level login SID. This script queries sys.database_principals and sys.server_principals to find every orphaned user in a database, and shows …
Read MoreSQL Server MAXDOP Recommendation Script
Apr 17, 2026 / · 8 min read · sql server maxdop performance sp_configure numa sql scripts database administration cpu configuration sys.configurations sys.dm_os_schedulers sys.dm_os_sys_info ·MAXDOP (max degree of parallelism) caps how many processors SQL Server uses for a single parallel query plan. The default value of 0 lets SQL Server use all available processors, up to 64, which Microsoft says is not the recommended value for most cases. This script reads the CPU and NUMA layout from system DMVs, …
Read MoreSQL Server TempDB Usage and Contention Report
Apr 17, 2026 / · 7 min read · sql server tempdb dm db session space usage dm exec sessions dm exec requests dm exec sql text monitoring dba scripts space usage contention performance ·TempDB is a shared system database used by every session in SQL Server. When TempDB space grows or performance slows, it can be difficult to know which sessions are responsible. This script queries sys.dm_db_session_space_usage to show a clear breakdown of TempDB consumption per session, including the current SQL …
Read MoreSQL Server: Find Tables Without Primary Keys
Apr 16, 2026 / · 7 min read · sql server primary keys database structure heap tables sql scripts schema audit performance sys.tables sys.dm_db_index_physical_stats sys.indexes sys.key_constraints sys.partitions ·Tables without primary keys are heap structures with no guaranteed row ordering and no unique row identifier. They cause full table scans in queries that could use seeks, slow down DELETE and UPDATE operations, and are incompatible with SQL Server replication and Change Data Capture. This script finds every user table …
Read MoreSQL Server Backup History: Duration and Size Report
Apr 13, 2026 / · 6 min read · sql server backup recovery msdb sql scripts database administration backup monitoring maintenance scripts reporting sys.databases backupset ·Query Backup Duration and File Size from SQL Server History This script queries SQL Server's msdb backup history to report the backup type, start and finish time, duration in minutes, and file size in both megabytes and gigabytes for every backup across all user databases on the server. Purpose and Overview Knowing …
Read MoreSQL Server Long-Running Queries: Find Active Sessions
This script queries sys.dm_exec_requests and sys.dm_exec_sql_text to show all currently executing queries on the SQL Server instance, sorted by how long they have been running, along with CPU time, I/O activity, blocking status, and wait type information. Purpose and Overview A query that normally completes in seconds …
Read MoreSQL Server Agent Job Failure History Report
Apr 11, 2026 / · 8 min read · sql server sql server agent msdb sql scripts database administration job monitoring maintenance scripts reporting sysjobs sysjobhistory sys.server_principals ·Report SQL Server Agent Job Status and Failure History This script queries the SQL Server Agent job history stored in msdb to produce a detailed report of each job's most recent run for each status (failed, succeeded, and so on), failure and success counts over the last 60 days, total lifetime run counts, and job step …
Read More