Open stuartpa opened 1 year ago
Can we have 'sqlcmd status' command which attempts to establish connection and returns if sql server is ready to accept connection or not? That way even applications can use this command to check sql server status and then decide accordingly whether to execute their workload or not.
the answer to the question "is sql server available" is only valid at the point in time you ask it. It could go down a second later.
I'd expect the connection timeout to be a value of the config entry for a connection with our typical default of 30 seconds.
Right now
sqlcmd start
does not block waiting for SQL Server to be running and ready for client connections.So if
sqlcmd query
is immediately run, it will fail with:We either need to make
sqlcmd start
have a blocking option so it doesn't return until SQL is ready for connections, orsqlcmd query
andsqlcmd open ads
etc. all block waiting for connection to succeed (up to timeout)As part of testing, I have tried blocking
sqlcmd start
until the errorlog prints "recovery complete" which is the last entry in a normal successful start up, andsqlcmd query
still fails with the above error message for a few seconds.