Exclusive access to the database is not available because the database is in use---workaround for restoring or deleting a database (the ultimate solution)

Source: Internet
Author: User

Title, online find some polite way, if do not want to toss, please see my method:

1, the first offline database, the purpose is to stop all links

2, choose to restore the database, if the tip of the log is incomplete, select the Database Properties option, overwrite the existing data.

On-line courtesy method:

Problem One solution:

Right-click Database--Properties-----restricted access, state---Select multiple-OK.

Problem Two solutions:

Method one (most convenient): Right-click the database--Properties----state-----Select single-> OK. and then restore.

Method two (most direct): Disconnecting database connections

Method three (most violent): Log off/Restart the database server

method Four (the most troublesome): Write code to modify the database related properties, although the trouble, sometimes still need to use, then use the time to study.

When you restore or delete a SQL Server 2008 database, the frequently-stewed occurrences are:

"Because the database is in use, you cannot gain exclusive access to the database", the Final solution is as follows


Key SQL statements:

ALTER DATABASE [datebase] SET OFFLINE with ROLLBACK IMMEDIATE


Run out and then


ALTER database [ datebase] Set online

Exclusive access to the database is not available because the database is in use---workaround for restoring or deleting a database (the ultimate solution)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.