Solved

Restore SQL database 2012

Posted on 2014-03-09
6
93 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
Comment Utility
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
Comment Utility
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
Comment Utility
Tks. After killing the connection, how can I restore the database for normal operation ?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
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
Comment Utility
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
Comment Utility
yes, you'll need to do:

ALTER DATABASE dbName
SET MULTI_USER;
GO
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

743 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

8 Experts available now in Live!

Get 1:1 Help Now