Friday, March 08, 2013 11:54 AM
Hello I am trying to restore the differential backup and this is my code:
RESTORE DATABASE ECA296Training
FROM DISK = 'c:\test\ECA296Training_1.dif'
WITH STANDBY ='c:\test\ECA296Training.stn'
But I am getting this error:
Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database 'ECA296Training' because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
I am not understanding why I am getting this error. Why is it saying that the ECA296Training is use by this session and this is the only query that is up. I am afraid if I switch over to master that I will not be able to finish off what is ask.
Friday, March 08, 2013 12:31 PMUSE master
Incase if you are restoring with your Login then check what is the default database set for that and change it to other one, then perform the operations
Also check any window if you have opened it or selected on that database then please close all.
Check sp_who2 verify no sessions connected to that database & ask the user to comeout or if ok to kill you can kill(but ensure before killing what the activity performing by the users).
If any application IDs configured to use that database then required to change to other then perform it.
Also use like below-
<Then yout Restore T-SQL here>
Hope you are restoring in approrpiate way
Thanks, Rama Udaya.K (http://rama38udaya.wordpress.com) ---------------------------------------- Please remember to mark the replies as answers if they help and UN-mark them if they provide no help,Vote if they gives you information.