Sometimes it is necessary to restore a database that has users currently active inside it. Use the following SQL in order to achieve this...
USE [master]
GO
ALTER DATABASE [myDatabaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
RESTORE DATABASE [myDatabaseName] FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\myDatabaseName.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
GO
USE [master]
GO
ALTER DATABASE [myDatabaseName] SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO
Thanks for sharing the nice video. Here is the tool would be the the user in SQL Database Recovery and restore Process. No technical skill required.
ReplyDeletehttp://www.recoverfilesdata.com/sql-database-mdf-recovery.html
Thanks