Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Query for auto restore db

$
0
0

Hi Guys,

I've already managed to do an scheduled dowload from a ftp server and to auto unpack it when it arrives. The next step i want to do is a automated restore from this db.

I found a query but i'm not quite sure if it is the correct command query to copy into the job i want to schedule in the SSMS.

I hope you can help me..

USE master
GO

ALTER DATABASE YourDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO



RESTORE DATABASE YourDB FROM DISK=N'D:\Backup\Pristine.BAK' WITH  FILE = 1,  
NOUNLOAD,  REPLACE,  STATS = 10
GO

ALTER DATABASE YourDB SET MULTI_USER
GO


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>