Restore SQL database 2012

I need to restore a db but someone is logging in it. However to check which user is logging to the database and kill their session. Tks
AXISHKAsked:
Who is Participating?
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
yes, you'll need to do:

ALTER DATABASE dbName
SET MULTI_USER;
GO
0
 
Anoo S PillaiCommented:
try the command sp_who2  from query window, and then identify the entries against the database name.

You can kill the session by a simple kill command from sql server management studio
Parameter would be spid ( this can be taken from output of sp_who2 )

sample :-  kill 53 , this kills spid 53.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
if you want to kill ALL connections to your database, you could do:

alter database YourDb set single_user with rollback immediate
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
AXISHKAuthor Commented:
Tks. After killing the connection, how can I restore the database for normal operation ?
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you would restore it using the normal method. do you need instructions or a tutorial on how to do that?
0
 
AXISHKAuthor Commented:
No need. I mean after restoring the SQL server, do I need to issue any command to enable the database to support multi-user as we have changed the database to single mode.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.