While preparing a demo for coaching session i was working to move the system databases from one location to other on disk. As first step I started SQL Server by adding parameters -c -m -T3608. Moving forward with the task i restarted the SQL Server service.
Now it was required to dettach the database. I choose to start with the model database with following command.
USE MASTER GO sp_detach_db 'model' GO
But surprisingly i got following error message
Cannot detach an opened database when the server is in minimally configured mode.
I rechecked any opened connection to model database. And also stopped other running services for that SQL Server instance. But it did not work and message was still same with failure.
REASON AND SOLUTION:
With search and trial i found the reason. While restarting the SQL Server instance with newly added parameters, a connection was already there to that instance in SSMS. Closing the connection does not work once instance is restarted with new parameter. Only solution is to confirm that no connection exists with that instance and then restart the instance once again. Once instance is online, open new query and login to the instance for database detachment.