Error reported when restoring MDF

  • Hey,

    sp_attach_single_file_db @dbname = 'HA_DB',

    @physname = 'E:\Program Files\Microsoft SQL Server\MSSQL\Data\HA_DB_DATA.mdf'

    This script worked great for me for 9 of my 10 DB, however this database returned the following error:

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

    Could not open new database 'HA_DB'. CREATE DATABASE is aborted.

    Device activation error. The physical file name 'C:\Program Files\Microsoft SQL Server\MSSQL\data\HA_DB_Log.LDF' may be incorrect.

    What does this mean?

    It seems to mean "Cannot create database" But I dont understand.  It worked fine up until this database, and there is not nor has there ever been a database with the same name on this server.  Same situation as with all others, so whats the deal?  Thanks for the help!

  • This was removed by the editor as SPAM

  • as obvious as I know, SQL Server 2005 has a different directory from your script. The directory should be as C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\

  • with sql server 2000, the log file would be created if not found.

    This does not seem to be the case with 2005, you must provide one I believe

  • <script type=text/javascript>loadTOCNode(1, 'symptoms');</script>

    Hi,
     
    The following scenario produces the error:

    1.A database is set up with more than one log file (.ldf).
    2.That database is detached successfully from the server through the use of sp_detach_db.
    3.The log files for that database are deleted, moved, or renamed.
    4.The sp_attach_single_file_db command is run, specifying the primary data file.

    Please check the following KB:

    http://support.microsoft.com/kb/271223/en-us

     

    Thanks and Best of Regards,
    Minaz Amin
    Phno:9341735900

     

    "More Green More Oxygen !! Plant a tree today"

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

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