TITLE: Microsoft SQL Server Management Studio
------------------------------
Restore failed for Server ‘sacsql204‘. (Microsoft.SqlServer.SmoExtended)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=12.0.2000.8+((SQL14_RTM).140220-1752)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Exclusive access could not be obtained because the database is in use.
RESTORE DATABASE is terminating abnormally. (Microsoft SQL Server, Error: 3101)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=12.00.2480&EvtSrc=MSSQLServer&EvtID=3101&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
解决方案:
disconnect other users by scripts belowe:
USE master
GO
ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE YourDatabaseName SET OFFLINE WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE YourDatabaseName SET MULTI_USER
GO
ALTER DATABASE YourDatabaseName SET ONLINE WITH ROLLBACK IMMEDIATE
GO