views:

24

answers:

1

We have some databases in a single SQL Server 2000 instance, one of them being a sandbox. My boss needs to be able to restore fresh data over the sandbox using a utility I don't have the source to. Such restores fail if anyone is connected to the sandbox.

Another app I have accessing it uses connection pooling, and also there might be people using other apps to access the sandbox that I can't control.

How can I boot everyone off the sandbox, including the pooled connections, without touching any of the other databases running on the same instance?

(I've seen solutions out there that use Management Studio 2008 (from 2008 Express), but a) I need to be able to do it from the command line or a script somehow so my boss can run it without installing Management Studio, and b) the context menu options they talked about didn't seem to be there anyway.)

+1  A: 

I've found it on the web:

ALTER DATABASE db SET SINGLE_USER WITH ROLLBACK IMMEDIATE

create a sp that run this restores, and then restore it to regular.

(ALTER DATABASE foo SET MULTI_USER;)

Dani
I don't have control over the restore part itself (there might be vendor-specific stuff that happens in the backup/restore process...otherwise I'm not sure why they'd create a proprietary utility), but I'll try those two in succession to see if it boots everyone. Thanks!
Kev