Problem detaching ,says in use

  • I am trying to detach, but it comes back a in use. I then run sp2_who, comes back as 'sa' only. I have also selected dbo only, this has not helped.I can drop the pubs.Not sure why this DB will not.

  • Try setting the database to 'single user' mode before detaching. More info can be found here:

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=169084

  • Hi,

    You can Bring the Database in SIngle User Mode by:

    USE masterEXEC sp_dboption 'pubs', 'single user', 'TRUE'
    Then After this stored Procedure you can detach the Database.
    Hope so this Helps you....

    Kindest Regards,

    Jeetendra

  • 1. you have jobs running - stop SQLServerAgent then try the detach

    or

    2. you have more than one applicationo open. If you have Enterprise Manager and Query Analyzer open, that's two connections. Close one of those applications.

    -SQLBill

  • Thanks Guys tried all of the above, WORK like CHARM!!!!!!!

  • Also, the utility you're using has a connection open with SQL Server to a specific database (your default database if not otherwise specified). This can be enough to block SQL Server from perfoming some actions, such as detaching the database.

    In Enterprise Manager, you may have to close the folder for a database and select another database. Then right-click on the database you want to detach (or restore or whatever).

    The same thing happens in Query Analyzer when you're trying to do things via T-SQL to the database you're connnected to.

    David Lathrop
    DBA
    WA Dept of Health

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

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