Category: DBA Scripts

  • DBA Scripts: Index Maintenance

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation Index problems rarely announce themselves. A missing index shows up as a slow query someone eventually complains about; a duplicate or unused one just sits there costing write overhead and storage with nothing to show for it; fragmentation quietly degrades…

  • DBA Scripts: Blocking and Locking

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Performance & Troubleshooting “The database is slow” and “the database is blocked” look identical from the outside, timeouts, a frozen application, users complaining, and the fix is completely different depending on which one it actually is. Four scripts on this site cover the…

  • DBA Scripts: Generate Backup and Restore Scripts

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Backup & Recovery Stop Hand-Typing Database Names Into Backup Commands Writing a one-off BACKUP DATABASE or RESTORE DATABASE command for a single database is trivial. Doing it correctly for every database on an instance, with a consistent naming convention, the right options, and…

  • DBA Scripts: Backups and Recovery

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks. Backup and recovery is the one area of SQL Server administration where “probably fine” isn’t good enough, a backup you haven’t verified restores is a belief, not a backup. Nine scripts across this site cover the whole lifecycle: what recovery model each database…

  • DBA Scripts: Get Open Transactions

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Performance & Troubleshooting › Blocking & Locking The Transaction Nobody Remembered to Close An open transaction that never commits or rolls back is one of the quietest ways SQL Server gets into trouble: it holds locks other sessions wait on, it stops the…

  • DBA Scripts: Get Recovery Model Audit

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Backup & Recovery The Mismatch That Fills a Disk A database’s recovery model is a promise about what kind of restore is possible, FULL and BULK_LOGGED promise point-in-time recovery, backed by log backups; SIMPLE promises none, and truncates the log on its own.…

  • DBA Scripts: Get Login Migration Parity

    Counting logins passes a broken migration. Compare SIDs, disabled state, default database and password policy between two SQL Servers.

  • DBA Scripts: Get Log Reuse Waits

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Storage & Capacity The One Question That Actually Matters A transaction log that won’t stop growing, or a log backup job that suddenly can’t keep up, always comes back to the same underlying question: what is this database’s log actually waiting on before…

  • DBA Scripts: Get Blocking Sessions

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Performance & Troubleshooting › Blocking & Locking When Everything Looks Busy But Nothing Is Moving Blocking is one of the most common causes of a SQL Server that suddenly looks frozen. Applications start timing out, users report that everything has stopped responding, and…

  • DBA Scripts: Get TempDB Configuration

    ,

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Storage & Capacity TempDB is shared by every database on the instance, and it’s usually the first thing to show contention under load, long before any user database does. Unlike a user database’s files, TempDB’s default configuration out of the box (a single…