When I run this statement in a query window as my own user account, the restore completes in 40 minutes. When I run it as a step in an agent job it runs in over 60 minutes. In the agent job, the step executes as NT SERVICE\SQLSERVERAGENT. What could cause the time difference?
ALTER DATABASE [Example] SET SINGLE_USER WITH ROLLBACK IMMEDIATE RESTORE DATABASE [Example] FROM DISK = N'D:\Example.bak' WITH FILE = 1, MOVE N'Example' TO N'D:\Example.MDF', MOVE N'Example_log' TO N'D:\Example_log.LDF', REPLACE, STATS = 10 ALTER DATABASE [Example] SET MULTI_USER GO