Tag: SQL Server Monitoring

  • How to Right-Size SQL Server Database Files

    Auto-growth is not the problem. Unplanned, reactive growth is. When database files are undersized, SQL Server is forced to extend them repeatedly under load. Each growth event introduces a pause. If those pauses occur during peak workload, they can cause noticeable latency, increased I/O pressure, and in some cases application timeouts. Right-sizing database files is…

  • How to Check Blocking SPIDs in SQL Server

    Blocking is one of the most common causes of performance issues in SQL Server. When one session holds a lock on a resource and another session needs that same resource, the second session waits. If that wait persists, users experience slowness. Understanding how to quickly identify blocking SPIDs is a core DBA skill. This guide…

  • Check When SQL Server Was Last Restarted

    Knowing when SQL Server last restarted is one of the simplest checks a DBA can perform, and one of the most useful. It immediately answers questions around patching, failovers, configuration changes, and unexplained behaviour. Before assuming anything else, confirming uptime is always worth doing first. This post shows the most reliable way to check SQL…

  • Track Database Growth Events Over Time in SQL Server

    SQL Server’s default trace captures database and log file growth events, but it’s short-lived. Once the trace rolls over or the instance restarts, that history is gone. If you want to understand growth patterns over time, react less to disk alerts, and stop guessing which databases are mis-sized, you need to store those events somewhere.…

  • Script: Check AG Replica Role and Synchronization State

    This script returns the current role, synchronization state, health status, and failover configuration for replicas participating in an Always On Availability Group. It is commonly used during failover validation, replica troubleshooting, and general high availability health checks. The Script Example Output The result set shows one row per replica in each Availability Group. Important columns…

  • Script: Check Always On Availability Group Latency

    This script returns replication latency information for databases participating in an Always On Availability Group (AG). It shows how far each secondary database is behind the primary, the redo queue size, redo rate, and an estimated recovery completion time. It helps identify AG latency, redo backlog, and data movement delays between primary and secondary replicas.…

  • Estimate Backup and Restore Completion Time in SQL Server

    When a database backup or restore is running, one of the first questions is simple: How long does it have left? SQL Server exposes estimated completion information for active backup and restore operations. You can query it directly to see progress, elapsed time, and an approximate finish time without guessing or relying on external tooling.…

  • Get Last Database Backup Times in SQL Server

    Checking the last backup times is one of the first things to do when reviewing a SQL Server instance. Before making changes, running maintenance, or troubleshooting issues, you need to know whether reliable recovery points actually exist. This post shows a fast, reliable way to check the most recent full, differential, and transaction log backups…

  • Get Last Database Restore Date and Time in SQL Server

    Knowing when a database was last restored is useful during incident response, audits, and general environment validation. This is not about backup schedules or restore progress.It is a simple historical check that answers one question: When was this database last restored? This post shows a reliable way to retrieve the most recent restore date and…

  • How to Check Transaction Log Space Usage in SQL Server

    Monitoring transaction log space usage is a fundamental DBA task. If a log file runs out of space, transactions can fail, applications can stop, and in the worst cases databases can be taken offline. This post shows two practical ways to check log space usage in SQL Server, starting with a built-in command and then…