Error while attaching database

  • After successfully detaching the database, I tried to reattach the same database to the same instance that it was detached from and I received this error.

    Cannot attach a database that was being restored. (Microsoft SQL Server, Error: 1824)

    Can someone please help?

  • Hi,

    Check the following post http://www.sqlservercentral.com/Forums/Topic358239-146-1.aspx

    Regards,

    Ahmed

  • are you trying to attach with the same name or different?

    Cheers,
    Sugeshkumar Rajendran
    SQL Server MVP
    http://sugeshkr.blogspot.com

  • Same name. Actually it was for practice. I detached the database and immediately tried to reattach to the same SQL Server instance. I don't know what I did wrong. I read the solution from the last reply. That didn't seem related to what I was experiencing.

    Any help would be appreciated.

  • Does the database appear in SSMS?

  • No.

  • The database is in a read only state. Did you restore the database and use the norecovery or standby options, or you backup the tail of the transaction log prior to detaching the database? If so, the database will be placed in a restoring state. This will cause a problem when you try to attach the database because SQL cannot take it out of a read only state.

    Try restoring the database from a backup then detach and reattach.

  • Thanks.

  • I've had problems before in 2k5 where using the GUI to attach the DB wasn't working properly and while the database showed as attached, the sys.databases table didn't know it existed.

    I ended up having to use the Create Database...For Attach command to get it to attach properly. You might try this with the REBUILD_Log option to see if you can get the DB attached without restoring from a backup.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

Viewing 9 posts - 1 through 8 (of 8 total)

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