Unable to attach the database

  • I had to detach the database to delete the transaction log as it took the hole disk space.

    No I am trying to attach database, however I am not able to do so.

    The engine is asking me whether I want to continue and create new log file. I agree to it, however then I am receiving an error:

    Error 1813: Could not open new database 'db_name'. CREATE DATABASE aborted. Device activation error. The physical file name 'E:\SQL Databases\MSSQL\Data\db_name.ldf' may be incorrect.

    Then after I have message than attaching database failed.

    In event viewer I have:

    17204 :

    FCB::Open failed: Could not open device E:\SQL Databases\MSSQL\Data\db_name.MDF for virtual device number (VDN) 0.

    In the error log I have:

    2008-01-23 10:28:59.00 spid52 Starting up database 'db_name'.

    Do you have any ideas where the problem is?

    I have never had this problem before, only now. And I didn't have this problem with other databases for which I have deleted the log file.

  • Check the following link

    http://support.microsoft.com/kb/836873

  • Actually, you can use the command,

    BACKUP LOG databaseName WITH TRUNCATE_ONLY

    before detaching it.

    Or after detaching it, do not include log file wihile re-attaching it. Let the system to create a new log file for this database.

  • While the TRUNCATE_ONLY idea was a nice touch, the truncation itself doesn't make the transaction log any smaller. You need to also shrink the log file after that....

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

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

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