RESTORE DATABASE PROBLEM

  • Hi,

    Whilst trying to restore a database, I get the following error :-

    Server: Msg 3101, Level 16, State 2, Line 1

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

    Server: Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally

    How do I stop the database being in use?

    Thanks,

  • Set it to single user mode.

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • ... and if necessary, kill any current connections.

     

    --------------------
    Colt 45 - the original point and click interface

  • Hi,

    When processes are using the database you cannot restore a backup of it, it is not the same as the backup functionality where you can create backups during working times.

    Best thing is to ask everything to exit the application.

    Philippe

  • Use SP_WHO2 to identify the connections. If someone opened the DB via Enterprise Manager (including you), that can often leave an open connection.

  • firts : ALTER DATABASE yourDB  Set [RESTRICTED_USER , ]

                    READ_only  WITH ROLLBACK IMMEDIATE

    then perform your restore.

    After restore, the db will be in the same state as it was when the backup was made.

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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