But another SPID already has the only available connection to that database. Running the alter database command from master even logged in as a sysadmin would not work.
Msg 5064, Level 16, State 1, Line 1
Changes to the state or options of database 'test' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.