`

恢复数据库时出现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...

    如何加密ACCESS数据库

    在IT领域,数据库的安全性是至关重要的,尤其是对于存储敏感信息的Access数据库。Access是由微软开发的一款关系型数据库管理系统,广泛应用于小型企业及个人用户,用于管理数据和创建应用程序。在处理诸如康明斯公司...

    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 ...

    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. ...

    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 ...

    access数据库加密码源代码

    在IT行业中,数据库的安全性是至关重要的,尤其是对于个人或小型企业使用的关系型数据库管理系统(RDBMS)如Microsoft Access。Access数据库加密码是确保数据安全的重要步骤,它能防止未经授权的用户访问或修改敏感...

    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 ...

    delphi xe3 下自动建立Access数据库连接串函数

    在软件开发过程中,特别是使用Delphi XE3进行Windows应用程序开发时,经常需要与Microsoft Access数据库进行交互。为了简化这一过程,本篇文章将介绍一个实用的函数——`CreateODBC`,该函数用于自动创建ODBC数据源...

    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 ...

Global site tag (gtag.js) - Google Analytics