Solved

Restore SQL database 2012

Posted on 2014-03-09
6
108 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 33

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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 33

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 33

Accepted Solution

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

ALTER DATABASE dbName
SET MULTI_USER;
GO
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

691 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