SQL Server switches the database to single-user and multi-user mode

Source: Internet
Author: User
Tags switches

Sometimes the database is occupied, want to do some operations, unable to operate. You can try to switch the database to single-user mode to operate. Switch back to multi-user mode after the operation is complete.

The command is as follows:

ALTER DATABASE name set Single_user--Single user
ALTER DATABASE name set Multi_user-Multi-user

Or

sp_dboption database name, "Single user", True--

sp_dboption database name, "Single user", false--multi-user

If you use alter DATABAS or if you are using sp_dboption, there is no way to change to multiuser or single-user mode
The solution is
In the activity and monitor process, kill the destination database and then refresh it.
Use
Alter DATABASE Db_tyz and modify it.

Related Article

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.