Solved

Restore SQL database 2012

Posted on 2014-03-09
6
96 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 32

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 32

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 32

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now