SQL restore
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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。