即使没有使用它,我也无法分离数据库,因为它正在使用.
Cannot detach the database 'DEMO' because it is currently in use.
我尝试重新启动并获得相同的消息.
解决方法
--Kick all users off of the database NOW ALTER DATABASE YourDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE --Kick all but after 60 seconds ALTER DATABASE YourDatabase SET SINGLE_USER WITH ROLLBACK AFTER 60 SECONDS --restore connection to users ALTER DATABASE YourDatabase SET MULTI_USER