Cari Blog Ini

20 Juli 2012

Msg 3102 - RESTORE Cannot Process Database Because It Is In Use By This Session

Apply To :
Microsoft SQL Server 2008 R2



* * * * * 




When want to restore a database
----------------------------------------------------------------------------
-----code:start-----
----------------------------------------------------------------------------
RESTORE DATABASE [DB_Simulasi]
FROM  DISK = N'D:\DB_Simulasi.bak'
    WITH REPLACE
GO
----------------------------------------------------------------------------
-----code:end-----
----------------------------------------------------------------------------

Result Messages:

Msg 3102, Level 16, State 1, Line 1 

RESTORE cannot process database 'DB_Simulasi' 

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.









Causes:
This error cause because when run RESTORE Statement, still active on Database "DB_Simulasi".

Solution:
* Change active Database to "Master" when running RESTORE Statement.


Results After Fix: