Tag: DBA Tools

  • Open SSMS as a Different Domain User

    When working in corporate SQL Server environments, you will often need to connect using a different Active Directory domain account. Common reasons include: SQL Server Management Studio (SSMS) does not allow switching users inside the connection dialog. To connect as another user, you must launch SSMS itself using that account. This post covers the two…

  • sqlcmd Examples for SQL Server

    sqlcmd is a command line utility for connecting to SQL Server and executing Transact-SQL without a GUI. It is commonly used for automation, scripting, remote administration, and incident response, especially in environments where SSMS is unavailable, inappropriate, or too heavy. This post covers sqlcmd usage from a DBA perspective, how to find or install it,…

  • Install and Update SQL Server Management Studio (SSMS)

    SQL Server Management Studio (SSMS) is the primary management tool for SQL Server and Azure SQL platforms. It is also the official download location and update path for SQL Server Management Studio going forward. In recent releases, SSMS has changed significantly, not in how it looks, but in how it installs, updates, and enforces connection…

  • 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”.…

  • Script: List Sysadmin Role Members

    This script returns all logins that are members of the sysadmin fixed server role. It includes login type, whether the login is disabled, and default database information. This is commonly used during security reviews, onboarding and offboarding checks, and when validating privileged access in production environments. The Script Example Output The result set shows one…

  • Script: Check xp_cmdshell, CLR & Database Mail Configuration

    This script checks whether xp_cmdshell, CLR integration (including CLR strict security), and Database Mail are enabled on the instance. These features expand SQL Server’s capabilities beyond pure database operations. While commonly used, they increase surface area and should be intentionally configured. This script is useful during security reviews, environment validation, or when inheriting a server.…

  • 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.…

  • Script: Transaction Log Size and Usage by Database

    This script returns transaction log size and usage information for all databases on the instance. It shows total log size, used log space, percentage used, and recovery model. This is commonly used during log growth incidents, backup troubleshooting, or when validating log management across an environment. The Script Example Output The result set shows one…

  • Script: Check Disk Space on SQL Server

    This script returns disk space information for volumes that host SQL Server database data or log files. It shows total size, available free space, and percentage free space per drive or mount point. This is commonly used during storage pressure incidents, failed backups, restore troubleshooting, or proactive capacity reviews. The Script Example Output The result…