Author: Peter Whyte
-
Get SQL Server CPU Topology and Core Counts
This script provides a quick view of how SQL Server interprets the CPU layout of a server or VM. It returns CPU counts, socket and core layout, NUMA node configuration, scheduler visibility, and key configuration values such as MAXDOP and cost threshold for parallelism. I typically use this when validating a new SQL Server build,…
Written by
-
Script: Generate Test Databases
When you’re validating migrations, failover, or automation at scale, you need realistic volume: hundreds or thousands of databases to stress-test backups, restores, log shipping, and copy operations. This helper automates that setup, it creates batches of small, randomized databases with configurable sizes and naming, so you can reproduce large-scale scenarios quickly and repeatably.
Written by
-
Troubleshooting Database Mirroring Issues in SQL Server
Database Mirroring is deprecated, but you will still see it in many production environments. It was officially marked deprecated in SQL Server 2012 and has remained in that state for well over a decade. In my own career as a DBA, it has been “deprecated” the entire time, yet still widely deployed and fully supported.…
Written by
-
Get Current Date & Time in SQL Server
Getting the current date and time in SQL Server is straightforward. Choosing the correct function for your workload is what matters. Whether you’re stamping audit rows, logging ETL runs, or investigating production issues, SQL Server exposes several built-in functions with different precision and return types. All of these functions use the Windows OS clock of…
Written by
-
Creating SQL Logins on an Availability Group (AG) Environment
In an Availability Group, the databases fail over. Your SQL logins do not. For Windows domain logins, the SID is owned by AD, so you just create the login on each replica and it syncs up. For SQL logins, the SID is generated inside SQL Server. If the SID differs between replicas, the database user…
Written by
-
Grant VIEW SERVER STATE in SQL Server
VIEW SERVER STATE is the permission that unlocks most server-level DMVs and DMFs. If someone can’t run basic instance health checks and keeps hitting permission errors, this is usually why. It gives visibility into what is happening on the box right now: active sessions, running requests, waits, connection details, and plan cache level query stats.…
Written by
-
How to Get the SQL Server IP Address
When troubleshooting connectivity, firewall rules, or unexpected routing, you often need one simple answer: which IP address and port did my session actually connect to? SQL Server can listen on multiple IPs (and listeners can resolve to multiple addresses), so the hostname in your connection string does not always tell you what you really hit.…
Written by
-
SQL Server Error Severities Explained
When SQL Server raises an error, it includes more than just a message. Every Database Engine error contains the following: Out of all of these, severity is the fastest way to understand how serious the issue is and who is likely responsible for fixing it. Severity levels range from 0 to 24 and indicate whether…
Written by
-
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…
Written by
-
SQL Server: ALTER DATABASE SET ENABLE_BROKER Taking a Long Time (Fix)
After a recent Availability Group failover, Database Mail stopped sending emails. On investigation, the underlying cause was Service Broker not being enabled on the system database required by Database Mail. To confirm the status, I ran: The is_broker_enabled column was returning 0, indicating that Service Broker was disabled for that database. I then attempted to…
Written by
Blog Categories
Latest Posts
- Get SQL Server CPU Topology and Core Counts
- Script: Generate Test Databases
- 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
Blog Tags
Always On Availability Groups (4) Database Backups & Recovery (10) Database Maintenance (6) DBA Tools (29) Performance Troubleshooting (9) PowerShell (4) Query Behaviour (4) Schema Changes (1) SQL Agent (1) SQL Interview Questions (1) SQL Scripts (23) SQL Server Administration (11) 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)