Error while restoring a Database : ‘Exclusive access could not be obtained because the database is in use’


Solution :
When we restore the database system should have Exclusive lock.

The error means that some process is using this database,we should kill those process which are using database,

Otherwise use this command :

Use Master
ALTER DATABASE <> SET MULTI_USER WITH ROLLBACK IMMEDIATE;

RESTORE DATABASE <> FROM DISK = ‘C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\YOURDB.bak’

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s