Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Restoring from script
Message
From
10/06/2010 15:06:55
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Backups
Title:
Restoring from script
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01468358
Message ID:
01468358
Views:
106
Instead of always using the interface, I thought I would script the restore procedure. So, I tried this:
RESTORE DATABASE [LevelExtreme] FROM  DISK = N'D:\Data\Level Extreme\LevelExtreme.bak'
 WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
GO
But, I obtain this:

Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database 'LevelExtreme' because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

What else is missing in this script so I can execute it?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform