Now, right-click on "Databases" and Select "Restore Database"įrom the new pop-up, select "Device"-> "Browse" -> "Add" ( From new pop-up)Ĭlick on "Add"-> Navigate to "E:\AdventureWorks.bak" and Select it, Click "Ok" and the again click "Ok" Once you have downloaded the above file, open your local SQL server Management Studio, using which we will be restoring the above downloaded. Step 2: Open your SQL server Management Studio and Restore. Once you have downloaded it, open the "Downloads" Folders (Where file is downloaded) and copy/paste it in root folder of D: or E: Drive, basically we are doing this, so we don't get any error related to protection rights. It is around 46.7Mb in Size.ĪdventureWorks2016_EXT.bak (883MB) This is an extended version of AdventureWorks, designed to showcase SQL Server 2016 features I will be downloading AdventureWorks2016.bak for this tutorial.
So, this is our first step to download complete sample database of AdventureWorks, there are many SQL server versions of the sample database. Basically, we will be restoring the AdventureWorks sample database in our local SQL server. Step 3: Click OK to exit the SQL Server Configuration Manager.In this article, I have explained from where you can download AdventureWorks sample database and congifure it to use in local SQL server database. And in the right pane, right-click SQL Server service, and Stop and Start it. Step 2: In the left pane of SQL Server Configuration Manager window, click SQL Server Services.
SQL Server 2012 C:\Windows\SysWOW64\SQLServerManager11.msc SQL Server 2014 C:\Windows\SysWOW64\SQLServerManager12.msc SQL Server 2016 C:\Windows\SysWOW64\SQLServerManager13.msc SQL Server 2017 C:\Windows\SysWOW64\SQLServerManager14.msc SQL Server 2019 C:\Windows\SysWOW64\SQLServerManager15.msc Step 1: Browse SQL Server Configuration Manager using any of the following path: Steps to restart the service from SQL Server Configuration Manager are as follows: That’s because, you may only need to restore a single db, but restarting the server will kill connections to all databases. You can restart the service by using SQL Server Configuration Manager, SSMS, services console, or the command line. You can also disconnect the users by restarting the SQL service. Method 3 – Restart the SQL Server Service
Step 3: In Object Explorer panel, right-click Databases, and then select Restore Database.Įxecuting the above code will change the database to single-user mode. Step 2: After connecting to the database, Object Explorer panel will appear on the left side of the SSMS window. To close existing connections to SQL db, follow these steps: Method 1 – Close the existing connections to the database If you don’t want to notify users, skip to method 2. For detailed information on sp_who, refer to this link. If you find users performing some important tasks, notify those users before disconnecting them. NOTE: Before disconnecting the users, use SQL stored procedure ‘sp_who’ to check all users currently using the db. You can do so, by following any of these methods: To resolve the issue, you will need to disconnect the active users. If someone is using the database, the restore operation will fail. When attempting to restore SQL Server db, make sure there are no active connections.
How to Fix ‘can’t restore SQL database because it is in use’ Problem? You will need SQL Server Management Studio (SSMS) installed on your computer.SQL Server, of any version, must be installed on your system.
The software supports SQL Server 2019, 2017, 2016, 2014, 2012, & older versions.īefore proceeding with resolving the error – exclusive access could not be obtained because the database is in use, make sure to meet the following prerequisites: Use Stellar Toolkit for MS SQL software that comes with an efficient SQL backup extractor tool designed to help database administrators recover SQL database from corrupted backup (.BAK) file. But, the database restore operation may fail if the. Tip: SQL Server database can be restored from the backup (.bak) file. Now, we will discuss solutions to fix the error.
You are connected to the database you are trying to restore.Restored failed for Server ‘xxx’ ()Īdditional Information: : Exclusive access could not be obtained because the database is in use.įigure 1: SQL Database Restore Failed Error Message Reasons behind ‘SQL Database Restore Failed, Database in Use’ Errorīelow are some reasons that could interfere with the restore process and throw the ‘ restore of database failed because the database is in use’ error: When trying to restore SQL Server database from backup, it is common to receive an error message that reads as follows: