--// Remove the Users Connections and detach the database
Exec DBA..sp_DBA_KillDB DB
restore filelistonly from disk = '\\backupServer\DB_20181019.BAK'
go
restore database DB from disk = '\\backupServer\DB_20181019.BAK'
with
move 'DB' to 'E:\SQL\Data\DB.mdf',
move 'DB_log' to 'F:\SQL\LOG\DB_log.ldf',
replace,
stats = 1
GO
ALTER DATABASE DB SET READ_WRITE
alter database DB set compatibility_level = 130
exec DB..sp_changedbowner 'sa'