Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find who is using database 3

Status
Not open for further replies.

KWade

MIS
Jul 14, 2003
14
US
I am new to SQL Server. I am trying to restore a database but I get the message "Exclusive access could not be obtained because the database is in use. RESTORE DATABASE is terminating abnormally"

Is there a way to display who is using the database? or to force everyone off?
Thanks, Keith.
 
In SQL Query Analyzer,

type in.... sp_who

then execute it,

this will show you who is currently connected.

I hope that this helps,

-di
 
dont use the db you are going to restore.Do the restoration from master.
One more thing,before killing all the users in that db ,try to prompt them msg to inform they are going to be disconnected.
If you are going to restore master db,you should go to command line to set up single user mode.
 
Thanks,

I was able to find the process assocociated with the database that I wanted to restore but I was not able to KILL all the processes. There are 4 processes attached to my database. This is a test database that only I was using Friday. The 4 processes all say "awaiting command".
I would like to understand what these processes are, how come they stayed around, and how to kill, or get rid of them.
I need to get this database restored so that I can finish some testing. Thanks, Keith
 
FROM SP_WHO.YOU WILL GET A TABLE WITH SPID,ECID,STATUS....
THE KILLING SYNTAX IS

KILL SPID
 
Thanks,
I've tried to kill these tasks but they either aren't going away or else they are coming back. The login name is the the same as used to login into the server not a normal user. Thanks, Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top