At work, I use SQL Server 2008 Express running on Windows XP Professional Service Pack 3.
At home, I also use SQL Server 2008 Express running on Windows XP Professional Service Pack 3.
Whenever I do work on the database at work, I usually restore the database at home (or vice versa)
I have been using the following SQL scripts to back up the database and to restore the same database (at work or at home).
BACKUP DATABASE [RealEstate] TO DISK = N'F:\My Documents\My Database\RealEstate.bak' WITH NOFORMAT, INIT, NAME = N'RealEstate-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
RESTORE DATABASE [RealEstate] FROM DISK = N'F:\My Documents\My Database\RealEstate.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
Everything worked fine until I replaced my 8yo home computer with a newer and faster one.
My new home computer is running Windows 7 Home Premium and I use the latest SQL Server 2008 R2 Express.
When I tried to run the above restore SQL script, I got the following error message:
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.
There was no other application/process using this database.
Can someone please help me?
View Complete Post