[Error] - Msg 3101, Level 16, State 1, Line 2 Exclusive access could not be obtained because the database is in use. Msg 3013, Level 16, State 1, Line 2 RESTORE DATABASE is terminating abnormally.

Hi Folks,

Today, in this article we will talk about below error which generally cause when database is in use and you want to perform an operation on DB like DB restoration.

Error:

Msg 3101, Level 16, State 1, Line 2
Exclusive access could not be obtained because the database is in use.
Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.

Solution:

1. Login to your SQL Server Management Studio (SSMS) using run as administrator.
2. Select the DB on which you want to perform the operation.
3. Click on 'New Query' button or press CTRL + N, a new window will open.
4. Copy the below script and run it.

use master
go
alter database Your_DB_Name
set single_user with rollback immediate
go
alter database Your_DB_Name
set multi_user
go

5. Now, try to perform the operation again. You should be able to perform it.

Comment below if this article helped you...

Author:
Chirag Gupta
Microsoft Dynamics 365 AX Technical Consultant at IBM Bangalore

Date:
14-Sep-2019

Happy Learning !!

Comments

Popular posts from this blog

[Solved] : Error: String or binary data would be truncated. Cannot execute a data definition language command on Vendor (VendLedgerReconciliationTmp)

AX 2012 - Command prompt compilation / AxBuild.exe for Parallel Compile on AOS of X++ to P-code / Parallel Compilation

AX 2012 - How to send SSRS report in email as an attachment using X++

AX 2012 - How to stop AOS when services got stuck at stopping status

AX 2012 - How to make a form field mandatory

Error: There was no endpoint listening at net.tcp://your_server_name:8201/Dynamics AX/Services…

Fetch vendor address using X++ in AX 2012

AX 2012 - How to print current date and time on SSRS Report

[Solved] : AX 2012 - No connection could be made because the target machine actively refused it 192.168.10.249:8201

[Error] - Error in unit of amount in currency KES. Must be rounded to 0.01 | The unit of 37.563.5343100000000000 KES being posted to account 32710001-- is outside the current penny rounding threshold | Posting has been canceled