SQL DBA Blog: Home

  • DBA Scripts: Get Audit Specifications, DDL Triggers, and Proxy Credentials

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Security Three Kinds of Infrastructure Most Servers Never Had in the First Place A schema change or a new login fails on an inherited server and nothing in your own code explains it, an auditor asks what this instance records, or a SQL…

    Read More


  • DBA Scripts: Get Certificates, Keys, and TDE Status

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Security Check Certificate Expiry and TDE State A certificate is about to expire, a TDE restore has failed with Msg 33111, or someone needs to know which databases are encrypted. These scripts give you every certificate with its days left, the certificate behind…

    Read More


  • DBA Scripts: Get Login Security Audit

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Security What’s Actually Happening at the Login Level, Not Just Who’s Allowed Permissions and Role Membership covers who can do what. These three scripts cover something different: what’s actually happening at the login layer right now. Get-FailedLoginSummary surfaces brute-force patterns and locked accounts…

    Read More


  • DBA Scripts: Get Permissions and Role Membership

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Security Who Can Actually Do What, at Every Level Sysadmin Members answers the single highest-stakes question: who has unrestricted access. These 4 scripts answer everything underneath that: explicit object and schema grants inside a database, explicit server-level grants and denies on logins, database…

    Read More


  • DBA Scripts: Get Top CPU Queries

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Performance & Troubleshooting › Query & Performance Tuning Which Query Is the Problem CPU is pinned and you need the statement behind it. Get-TopCpuQueries ranks the plan cache by total CPU. The two scripts beside it rank the same cache by logical reads…

    Read More


  • DBA Scripts: Query and Performance Tuning

    🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Performance & Troubleshooting “The database is slow” almost never means the whole database, it means one query, one plan, one statistic that went stale at the wrong moment. The scripts on this site cover the full path from “something feels slow” to a…

    Read More


  • Understanding SQL Server AG Latency (AAG Latency Explained)

    As a production SQL Server DBA, one of the fastest health checks I run on an Always On Availability Group is a latency check. AG latency is the delay between a transaction committing on the primary replica and that same transaction being hardened and redone on a secondary replica. If the secondary is behind, it…

    Read More


  • SQL Server Transaction Log Full

    🚨Part of the SQL Server Errors series, the exact messages and what actually causes them.In: Storage & Capacity Msg 9002  ·  Level 17  ·  State 2 The transaction log for database ‘YourDb’ is full due to ‘LOG_BACKUP’ and the holdup lsn is (44:264:1). ⚡Check log_reuse_wait_desc first: it names the actual blocker out of about a…

    Read More


  • SQL Server: The Database Is in Single User Mode (Fix)

    🚨Part of the SQL Server Errors series, the exact messages and what actually causes them.Related pillar: Backups and Recovery You try to connect to a database and get: Msg 924  ·  Level 14  ·  State 1 Database ‘YourDatabase’ is already open and can only have one user at a time. Single-user mode allows one connection,…

    Read More


  • SQL Server Recovery Models Explained

    ⚡If the log will not truncate, the database is almost certainly in Full recovery with no log backup running. Check log_reuse_wait_desc: LOG_BACKUP means back up the log, not shrink the file. Choosing a model is the same question from the other side (the comparison table): Full plus log backups for anything you would restore to…

    Read More