View Single Post

   
  #6 (permalink)  
Old 02-28-2008, 08:10 PM
Dan Guzman
 
Posts: n/a
Default Re: Restore database via automated order

To add to the other responses, check to ensure the database context for your
restore job is set to a database other than the one your are trying to
restore. It may be that the restore job itself is the culprit.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"FoxRunner" <claus.rauchschindel@dds.de> wrote in message
news:b7c717fb.0312090728.1b374ba1@posting.google.c om...
> Hi folks,
>
> I got a script which restores a database. It works fine
> if it is running in my Query Analyzer.
>
> It fails when I put this script in an automated schedule using the
> SQL agent.
>
> This is my script
>
> RESTORE DATABASE [RestoreTest]
> FROM DISK = N'E:\sqlbak\RestoreTest.BAK'
> WITH FILE = 1, NOUNLOAD , STATS = 10, RECOVERY
>
> and this is the error message from the scheduler (Sorry its in German)
>
> Executing as User dbo. Exclusiv access to database not possible
> because
> it is in use (which is not).. Rest may be clear ;-))
>
> Ausführt als Benutzer: dbo. Exklusiver Zugriff auf die Datenbank ist
> nicht möglich, da die Datenbank gerade verwendet wird. [SQLSTATE
> 42000] (Fehler 3101) RESTORE DATABASE wird fehlerbedingt beendet.
> [SQLSTATE 42000] (Fehler 3013). Fehler bei Schritt
>
> Do you have any suggestion to me ?



Reply With Quote