From: PSULionRP on
I am trying to run a SQL Server Restore of a Test Database and am getting a
message saying...

Exclusive access could not be obtained because the database in use.

I have seen this before when I have an open thread to the database. I
checked with my fellow programmers and they are telling me they have nothing
opened.

Is there anyway I can see who or what is hosing this up???

Thanks in advance for your help.

PSULionRP
From: Eric Russell on
You can use SP_WHO2 to see what SPIDs (process IDs) are active and KILL
<SPID> to abort any active processes.

It is possible to set a database to RESTRICTED_USER mode while
simultaneously disconnecting all connections and aborting any active
transactions. The following will disconnect all connections without active
transactions and allow 2 minutes for any currently active transactions to
complete. Once done, the database will be in RESTRICTED_USER mode, meaning
that only the sysadmin or members of the DBO group can access it. Once the
maintenace operation has completed, restore the database to MULTI_USER mode.

ALTER DATABASE <DATABASENAME> SET RESTRICTED_USER WITH ROLLBACK AFTER 120
SECONDS



"PSULionRP" wrote:

> I am trying to run a SQL Server Restore of a Test Database and am getting a
> message saying...
>
> Exclusive access could not be obtained because the database in use.
>
> I have seen this before when I have an open thread to the database. I
> checked with my fellow programmers and they are telling me they have nothing
> opened.
>
> Is there anyway I can see who or what is hosing this up???
>
> Thanks in advance for your help.
>
> PSULionRP
 | 
Pages: 1
Prev: Copy data
Next: Arithmetic overflow