Daily Archives: March 17, 2014

T-SQL Stored Procedure to Kill all Connections to a DB

I’ve encountered the below error message many times when I was trying to do an adhoc restore operation on a DB server: Msg 3101, Level 16, State 1, Line 2 Exclusive access could not be obtained because the database is … Continue reading

Posted in T-SQL Script | Tagged , | Leave a comment

Powershell Function to Get SQL Server’s Network Protocols

The output of the above function usually looks like this: ProtocolName ProtocolDisplayName ProtocolOrder sm Shared Memory 1 tcp TCP/IP 2 np Named Pipes 3 via VIA 0 Number ‘0’ means corresponding protocol is ‘disabled’, while the NO. ‘1’ has the … Continue reading

Posted in Database Connection, Powershell | Leave a comment