Skip to content
  • There are no suggestions because the search field is empty.

Error: Exclusive Access Could Not Be Obtained Because the Database is in Use. Restore Database is Terminating Abnormally

This article explains the cause and resolution of the error message “Exclusive Access Could Not Be Obtained Because the Database is in Use. Restore Database is Terminating Abnormally” that may occur in Webgility Desktop. The issue arises when the database restore process fails because the database is currently in use or locked by another process. The article provides users with the correct approach to perform a successful database restoration using SQL Server Management Studio (SSMS) instead of the built-in restore feature. It also highlights the importance of maintaining an up-to-date database backup and ensuring that the backup file is stored under the Webgility folder on the C drive for proper restoration. By following the outlined steps, users can safely restore their Webgility Desktop database and ensure that data integrity is maintained during migration or recovery.

Error Message:

Exclusive Access Could Not Be Obtained Because the Database is in Use. Restore Database is Terminating Abnormally

 


Cause of the issue:

This error usually occurs when the database restore through the classical method is not working, i.e, through Webgility Desktop’s database restore feature. So it is recommended to perform the database restore directly through the SQL Server Management Studo tool.


Steps to fix:

1). In case if you are migrating the database to a new machine, then make sure to perform a latest backup of Webgility Desktop. Follow the steps in this helpful article on how to perform database backup

2). Download and install the latest version of SQL Server Management Studio from Microsoft website.

3). Once done then launch SQL Server Management Studio (SSMS).

 

4). Connect to the SQL Server instance where you want to restore the database.

5). In the Object Explorer, go to the required database instance on which the restore needs to happen. Then right-click on it and navigate to Task> Restore> Database.

6). In the "General" page of the Restore Database window:

  • Select "Device" as the source.

  • Click the ellipsis (...) button to navigate to the location of your database backup file (.bak).

7). Select Backup File:

  • In the "Select backup devices" window:
    • Click "Add."
    • Navigate to and select your database backup file (.bak).
    • Click "OK."

8). Set Options:

  • Back in the "General" page of the Restore Database window:
    • Ensure that the correct backup file is listed under the "To database" field.
    • You can change the destination database name if needed.
    • Check the "Restore" options, such as "Overwrite the existing database" if you are replacing an existing database.

9). Specify a New Location for Data and Log Files (Optional):

  • In the "Files" page, you can specify new file locations for the database data and log files if needed. This step is optional.

10). Review and Start Restore:

  • Click on the "Options" page to review additional restore options.
  • Click "OK" to start the database restore process.

11). Monitor the Restore Process:

  • SSMS will display the progress of the restore operation. You can monitor the progress in the Messages tab.

12). Complete the Restore:

  • Once the restore process is complete, you will see a message indicating the success or failure of the operation.

13). Verify the Restored Database:

  • In the Object Explorer, refresh the "Databases" node to see the newly restored database.

That's it! You have successfully restored a database backup through SQL Server Management Studio. Make sure to test the restored database to ensure data integrity and functionality.

NOTE: When restoring, the database backup file should be in the C drive under the Webgility folder.