Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Restore SQL database 2012

Posted on 2014-03-09
6
Medium Priority
?
113 Views
Last Modified: 2014-03-17
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
0
Comment
Question by:AXISHK
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:Anoo S Pillai
ID: 39916719
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
 
LVL 34

Expert Comment

by:Big Monty
ID: 39917669
if you want to kill ALL connections to your database, you could do:

alter database YourDb set single_user with rollback immediate
0
 

Author Comment

by:AXISHK
ID: 39919713
Tks. After killing the connection, how can I restore the database for normal operation ?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 34

Expert Comment

by:Big Monty
ID: 39920424
you would restore it using the normal method. do you need instructions or a tutorial on how to do that?
0
 

Author Comment

by:AXISHK
ID: 39934334
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
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 39934341
yes, you'll need to do:

ALTER DATABASE dbName
SET MULTI_USER;
GO
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question