Print ''
Print '-------------------------------------------------------------------------'
Print ' Script for JobMgr:'
Print ' Autor........: J.Feuerstein'
Print ' Description..: Restores JobMgr DB'
Print ' New........: 19.08.2021/J.Fes'
Print '-------------------------------------------------------------------------'
GO

USE [master]
Go

DECLARE @DBName nvarchar(max),
        @DBBackup_DPNE nvarchar(max)
-- #Doc: ToDo: define Names
set @DBName = N'JobManagerV3_#Custom#_WorkInst_DefaultSystem'
-- #Doc: ToDo: define DB file to restore
set @DBBackup_DPNE = N'C:\JobManagerV3.DatabaseFiles.Backup\JobManagerV3_#Custom#_WorkInst_DefaultSystem_#TimeStamp#.DbBackup'

ALTER DATABASE [@DBName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE [@DBName] FROM  DISK = @DBBackup_DPNE WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 5
ALTER DATABASE [@DBName] SET MULTI_USER

GO

Print ''
Print '-------------------------------------------------------------------------'
Print ' Script executed'
Print '-------------------------------------------------------------------------'
GO
