When performing a full restore over an existing database, SQL Backup sometimes reports that the database cannot be restored because it is currently in use.
This error shows not only during restore backup, but also for drop database or alter database as well.

In this situation:

  1. Run Delete Activity against DYNAMICS to disconnect all the connected users
  2. If you still getting the same error to get exclusive access of the Database, the other solution to this problem is to take the database offline prior to running the restore: this is the easiest way to kill all connections to the database.
  1. Before restore attempt
    To get a Single User access to a database. SINGLE_USER WITH ROLLBACK IMMEDIATE command is used only one user can connect to the database at a time.

use master
alter database DB_NAME set offline with rollback immediate;

  1. After restore
    To give Multiple User access to a database. MULTI_USER command is used any number of users who have rights to connect to the database will be able to connect to the database.

use master
alter database DB_NAME set online with rollback immediate;

Need help with Microsoft Dynamics GP? We can help! Learn more about our Microsoft Dynamics GP services, schedule a free consultation, or call us at (212) 869-9300.