restoring problem

  • when restoring the database exclusive lock exists restoring dont successfully ?

    how to resolve this .

    thanks

  • Please clearify it further. What problem are u facing while restoration of db ?

  • Exclusive access could not be obtained because the database is in use.

    and the restore is not able to occur.

    Any ideas on how I can prevent this from happening?

  • You need to ensure that all connections are clear with the database you're attempting to restore, even your own. Once all the connections are clear, you can restore.

    If it's an emergency situation, you can kick out most of the logins by using setting the database to restricted user or single user like this:

    ALTER DATABASE AdventureWorks

    SET SINGLE_USER

    WITH ROLLBACK IMMEDIATE;

    GO

    --or

    ALTER DATABASE AdventureWorks

    SET RESTRICTED_USER

    WITH ROLLBACK IMMEDIATE;

    GO

    Understand though, that using the option ROLLBACK IMMEDIATE will cause any outstanding transactions to be stopped and rolled back, but it will clear out the connections so that you can restore the database.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • appreciated for ur reply .

    Thanks

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply