Files
claudetools/.claude/memory/feedback_sql_instance_role_by_connection.md
Howard Enos f8c6b4b9ca sync: auto-sync from HOWARD-HOME at 2026-05-06 13:46:20
Author: Howard Enos
Machine: HOWARD-HOME
Timestamp: 2026-05-06 13:46:20
2026-05-06 13:46:23 -07:00

2.6 KiB

name, description, type
name description type
SQL instance role — verify by active connections, never by name Before recommending stop/uninstall of any SQL Server instance, prove its role with sys.dm_exec_sessions + Get-NetTCPConnection. Instance names lie when Standard is installed under the default Express name. feedback

When investigating a multi-instance SQL Server box, identify each instance's actual role by querying active connections — never trust the instance name alone.

Why: On 2026-05-05 at IMC1, the named instance MSSQL$AIMSQL was assumed to be the production AIM database, with MSSQL$SQLEXPRESS flagged as a leftover for shutdown. Re-enumeration on 2026-05-06 reversed both: SQLEXPRESS is the live production AIM instance (SQL 2019 Standard installed under the default SQLEXPRESS instance name and never renamed — SERVERPROPERTY('Edition') proved Standard, not Express). AIMSQL is the actual orphan with only 2023-era conversion-test DBs. The "shut down SQLEXPRESS" recommendation in the Note for Mike, if acted on, would have killed the entire store (every register, repair workstation, lessons workstation, and the C2B credit module). A scheduled Restart-Service MSSQL$AIMSQL ran the wrong instance and did nothing for the user-facing error, which then recurred 9 hours later.

How to apply: Before recommending any change to a SQL instance — stop, uninstall, cap memory, restart cadence, anything — run this minimum enumeration on each instance you're considering:

  1. sqlcmd -S .\<instance> -E -d master -Q "SELECT SERVERPROPERTY('Edition'), SERVERPROPERTY('ProductVersion'), SERVERPROPERTY('InstanceName')" — proves edition vs name
  2. Get-NetTCPConnection -OwningProcess <pid> -State Established — shows every IP currently talking to it
  3. SELECT login_name, host_name, program_name, client_net_address, DB_NAME(database_id) FROM sys.dm_exec_sessions WHERE is_user_process = 1 — names the apps and machines
  4. SELECT name, create_date FROM sys.databases — distinguishes live DBs from legacy/test artifacts
  5. Tail the ERRORLOG — recent login traces confirm who connects when no one is connected at the moment you check

If Established connection count is zero AND is_user_process=1 sessions are zero AND ERRORLOG has no recent login activity, the instance is a real orphan. Anything else: leave it alone or get explicit confirmation from the customer's app owner before touching it. Especially watch for the Standard-installed-as-SQLEXPRESS pattern — common when an MSP migrates from Express to Standard in place and keeps the original instance name.