`

恢复数据库时出现Exclusive access could not be obtained because the databa is in use

 
阅读更多

由于恢复数据库时需要对数据库进行独占的访问,在恢复之前你必须中止其他用户与数据库的连接。

网上的解决方法:
在恢复数据库前:
方法一.打开Management Studio.
    a). 右键点击你的数据库,Task ->Take Offline.
    b). 右键点击你的数据库,Task ->Bring Online.

方法二.执行如下的Query:

    Use Master

    Alter Database [YOURDB]

        SET SINGLE_USER With ROLLBACK IMMEDIATE


    在恢复数据库后如果需要恢复会普通多用户模式:

    Use master;
    Go

    Alter Database [YOURDB]

        SET MULTI_USER

    Go

 

说下自己的总结:

直接执行:Alter Database [YOURDB]

        SET SINGLE_USER With ROLLBACK IMMEDIATE

在还原bak文件即可

分享到:
评论

相关推荐

    polycom宝利通视频会议软件3.9 2018

    1.1You may use the SOFTWARE PRODUCT pursuant to the license grant above and subject to the following terms and the proprietary notices in the SOFTWARE PRODUCT or on the media upon which the SOFTWARE ...

    微软内部资料-SQL性能优化5

    For example, if the clustered index is on (lastname, firstname) and a nonclustered index is on firstname, the firstname value will not be duplicated in the nonclustered index leaf rows. Note The ...

    微软内部资料-SQL性能优化3

    In our example, if one transaction (T1) holds an exclusive lock at the table level, and another transaction (T2) holds an exclusive lock at the row level, each of the transactions believe they have ...

    An Introduction to Statistical Learning with Applications in R

    Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be...

    Recover4all Professional

    1.9 "Authorized End User" means every individual who is not registered by Licensor but who is allowed to use the Registered Software in accordance with the terms and conditions set forth in this ...

    Genetic Algorithm in Java Basics

    Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be...

    AVG 破解版

    1. The Licensee shall be granted a single, non-exclusive right of use of the software freeware version unlimited in time, as well as, after complete and unconditional payment of the license fee, a ...

    Computer Mathematics

    Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the ...

    Mathematical Optimization of Water Networks

    Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be...

    Python for Signal Processing

    Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. ...

    Multivariate Calculus and Geometry Third Edition

    Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be...

    Pro Multithreading and Memory Management for iOS and OS X

    exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher's location, in its current ...

    TeeChart2013_130818_SourceCode

    not install or use the SOFTWARE on a computer that is a network server or a computer at which the SOFTWARE is used by more than one Developer. You may not network the SOFTWARE or any component part ...

    TeeChart2013_131216_SourceCode

    not install or use the SOFTWARE on a computer that is a network server or a computer at which the SOFTWARE is used by more than one Developer. You may not network the SOFTWARE or any component part ...

    Pro JavaFX8

    of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the ...

    Direct Oracle Access 413 Delphi XE6 Version

    Allround Automations warrants that it is the owner of the software product, and that it has the right and authority to convey and grant the license(s) herein and to perform this LA, and that the use ...

    Diskeeper 2008 v12.0.759.0

    A Diskeeper exclusive, the Terabyte Volume Engine (TVE) is designed to efficiently defragment extremely large (larger than 60 GB) volumes. This feature is available in selected Diskeeper editions. ...

    nvxdsync.exe

    The SOFTWARE is not sold, and instead is only licensed for use, strictly in accordance with this document. The hardware is protected by various patents, and is sold, but this LICENSE does not cover ...

    BlueToolInstall

    If and to the extent that the Software is designed to be compliant with any published communications standard (including, without limitation, DOCSIS, HomePNA, IEEE, and ITU standards), Licensee may ...

    WinRAR_3.71_英文破解版

    The RAR/WinRAR unlicensed trial version may be freely distributed, with exceptions noted below, provided the distribution package is not modified in any way. No person or company may distribute ...

Global site tag (gtag.js) - Google Analytics