myLittleTools Community Forum

Welcome Guest Search | Active Topics | Members | Log In | Register

Restore Database Options · View
elian
Posted: Tuesday, September 12, 2006 6:00:35 AM

Rank: Administration
Groups: Administration

Joined: 9/11/2006
Posts: 605
Points: 649
Location: Enghien Les Bains, France
Message from Mani :

Quote:

I want to restore a database from .bak file the file is in hosting server where database resides. i get error you do not have exclusive access on server. when i try to restore from query analyser of MyLittleAdmin.
elian
Posted: Tuesday, September 12, 2006 6:01:34 AM

Rank: Administration
Groups: Administration

Joined: 9/11/2006
Posts: 605
Points: 649
Location: Enghien Les Bains, France
Hi

In order to restore a database, you need to have an exclusive access to this database. Which means that you cannot restore a database which is currently in use by other users.

There is a few solutions to avoid this problem :

Perform restore when nobody is using the database...
Kill all spids that are using the database (KILL spid) before restoring
Alter you database to single user mode, perform the restore then reset your database to multi-user mode

Code:

USE master;
GO

ALTER DATABASE yourDb
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE
GO

RESTORE ...
GO

ALTER DATABASE yourDb
SET MULTI_USER
GO


Hope this helps
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Theme created by myLittleTools
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.