Solved

Restore SQL database 2012

Posted on 2014-03-09
6
101 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 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

830 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