How to restore the master backup n OFFLINE mode with LiteSpeed . (setting it to single user mode)
RESOLUTION:
Prior running the restore, open SQL Server Query Analyzer | run the command ALTER DATABASE <db name here> SET OFFLINE with ROLLBACK IMMEDIATE
ALTER DATABASE testdb SET OFFLINE with ROLLBACK IMMEDIATE
GO
---Restore the database, overwrite existing copy and recover.---
exec master.dbo.xp_restore_database @database = N'testdb' ,
@filename = N'D:Backuptestdb.bak',
@with = N'REPLACE',
@with = N'STATS = 10',
@with = N'MOVE N''master'' TO N''C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\testdb_1.mdf''',
@with = N'MOVE N''mastlog'' TO N''C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\testdb_log_1.ldf'''
USE master
GO
---Set Database ONLINE
ALTER DATABASE testdb SET ONLINE
GO
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy