" system.data.sqlclient.sqlerror:exclusive access could not be obtained because the database is in use. "
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlEidT6hEkmbqWa4r6NqdvhUVjkwGBa3mr8MA6BmIqRV0Q2WFrIEKBpDKTOcpFKAz5S7rawGWQWL_skeBx9Xpd2CLQHwQE041Fi7YFGh_y4YwmC5Ysp8dABgBZyRQy6tK2fk2Ujt-yp6M/s320/1.gif)
from message above i sure , you have been restoring the database while that have the application is in use so i have script for find out the problem .
1. Log in to sql server -> create new query -> key in the script
use Database name
exec sp_who -- if you need to check who have been using the database.
From a picture . Sured, the database is in use.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUUzJwQbuKrXsdWvdNm9ZKg42Zq9DjSAZAr3i0w-nZOemmLZRRyKkokmasr8kAr1-QKd5Uz99fZHw6A5_dPkcBUQW_5Jpuiuc9fnZBRQFnGBW4drzdlTOT9gJ0T5bBjsvCcaBIpRt6hd0/s320/2.gif)
2. Stop Service of Application to use the MS SQL server 2005 | Express | 2008
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihEAFTifjnu4veXoV6eo7bu0xBw529Q1QdGfI9cGzSvTSvk6MlcLdyTIwKuuU7oaW18uZzu53rMSpG5ZSazNI9R-DsvZEeHtl60x64VXHk52ELxGQXyMDSQRHB-gMylyCRAO0KDNNttRY/s320/3.gif)
3. Run Restore against . I have sured , you can restore the database MS SQL 2005 ,Express , 2008
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlYZX4PrYaCjkMMSCUp8tW9QFAoPw3JKcTq1QzM3Vclie0DZa1Wqw5XqEHE53C1-xFW48cO7wU8gQ3lFDUDOsbzExCnEqoAG23g70TmCIUvTnbp825fpouGx2aRV2gZpWV3MZmA5L9xQc/s320/4.gif)
No comments:
Post a Comment