Author: Peter Whyte
-
Using PowerShell to Get Last SQL Failover Time
When reviewing availability events on SQL Server, one of the first questions is often: Did the cluster move, and when? This post shows how to use PowerShell to retrieve the last Windows Failover Cluster role movement for a SQL Server instance by querying cluster event logs. It’s a fast, reliable way to confirm node-level failovers…
-
Enabling TCP Connections in SQL Server
TCP/IP must be enabled in SQL Server for remote connections to work. If it’s disabled, applications can’t connect; even if authentication, ports, and firewall rules are all correct. This post shows two reliable ways to enable TCP connections in SQL Server: Both approaches require a service restart before changes take effect. When You Need to…
-
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.…
-
How to Show Line Numbers in SSMS
In modern versions of SQL Server Management Studio, line numbers are enabled by default. If you are running SSMS 21 or newer, you will already see line numbers in query windows without changing anything. Older versions of SSMS did not enable them by default, which is why many guides still focus on “turning them on”.…
-
How to Add Columns to Tables in SQL Server
Adding columns to tables in SQL Server is a routine task, but it is not always a harmless one. On small tables it is trivial. On large or business-critical tables — especially those involved in replication or heavy write workloads — it can introduce blocking, transaction log growth, or downstream latency if handled carelessly. This…
-
How to Restore a Database in SQL Server
Restoring a database in SQL Server is a core DBA task. Whether you’re responding to an incident, performing disaster recovery testing, migrating data, or rebuilding an environment, restores need to be predictable, repeatable, and verifiable. This post walks through restoring a database using both T-SQL and SQL Server Management Studio, along with the checks that…
-
Why Is the Database in “In Recovery” Mode?
Seeing a database stuck in Recovery mode usually happens at the worst possible time. It often appears after a restart, a restore, or an unexpected shutdown, and the immediate question is always the same: Is this normal, or do I need to intervene? This post explains what recovery mode actually means, how to tell whether…
-
Database Cannot Be Opened – It Is in the Middle of a Restore
You may see the following error when attempting to access a database during or after a restore operation: Database “[DatabaseName]” cannot be opened. It is in the middle of a restore. This message is easy to misinterpret, especially during incidents or maintenance windows.It does not indicate corruption or failure by itself. This error means the…
Blog Categories
Latest Posts
- Troubleshooting Database Mirroring Issues in SQL Server
- Get Current Date & Time in SQL Server
- Creating SQL Logins on an Availability Group (AG) Environment
- Grant VIEW SERVER STATE in SQL Server
- How to Get the SQL Server IP Address
- SQL Server Error Severities Explained
Blog Tags
Always On Availability Groups (4) Database Backups & Recovery (10) Database Maintenance (7) DBA Tools (29) Performance Troubleshooting (9) PowerShell (4) Query Behaviour (4) Schema Changes (1) SQL Agent (1) SQL Interview Questions (1) SQL Scripts (25) SQL Server Administration (9) SQL Server Configuration (7) SQL Server Errors (5) SQL Server High Availability (4) SQL Server Internals (4) SQL Server Management Studio (SSMS) (7) SQL Server Monitoring (10) SQL Server Networking (9) SQL Server Replication (1) SQL Server Security (8) SQL Server Versions (2) Storage and Capacity (14) T-SQL (9) Transaction Logs (8) Troubleshooting (14) Windows Server (4)