Results 1 to 13 of 13
  1. #1
    Join Date
    Apr 2008
    Posts
    7

    Unanswered: Problem with ldf

    Hello, I have a problem with the log file of a database. I'm trying to attach a dababase in ms sql 2000. I miss de ldf, but when I try this command:

    sp_attach_single_file_db 'test', 'C:\...\databasefile.MDF'

    I have this error:

    Server: Msg 1813, Level 16, State 2, Line 1
    Could not open new database 'test'. CREATE DATABASE is aborted.
    Device activation error. The physical file name 'I:\LogsBases\databasefile_Log.LDF' may be incorrect.

    Anyone know a solution for this??? Help!

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Does that directory exist on the SQL Server? Is there a file already there? If the file already exists just rename it, do not delete it, until you are sure the database is back up and running.

  3. #3
    Join Date
    Apr 2008
    Posts
    7
    No, the directory doesn't exist. This directory exists in the original server where the database was created. This is another server with a different directory.
    There isn't a file ldf in the new server.

  4. #4
    Join Date
    Jun 2007
    Location
    Ohio, USA
    Posts
    142
    Was this DB detached with sp_detach_db? Or was the MDF file just copied from somewhere while SQL wasn't running?
    Quote Originally Posted by BOL:
    Use sp_attach_single_file_db only on databases that were previously detached from the server using an explicit sp_detach_db operation.
    David Maxwell
    Data Integrity? Yeah, I've heard of that...

  5. #5
    Join Date
    Apr 2008
    Posts
    7
    Yes, first we detached the database with that command and then we did a backup of the file mdf.

  6. #6
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Quote Originally Posted by cvz70
    No, the directory doesn't exist.
    Then create the directory.

  7. #7
    Join Date
    Apr 2008
    Posts
    7
    Unfortunatelly, it doesn't work. I also try to re-attach the database in the original server, in the same directory but I had the same message error! I could be that the mdf is corrupt?? Or samething like that??

  8. #8
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    I would suspect that the original server has the original .LDF file. Two servers two different problems. Same error message.

  9. #9
    Join Date
    Apr 2008
    Posts
    7
    But there's another problem: I miss de original .ldf in the original server!!!

  10. #10
    Join Date
    Jun 2007
    Location
    Ohio, USA
    Posts
    142
    Morbid curiosity impels me...

    Try this:
    1. Create the 'test' database.
    2. Detach it.
    3. Replace the new MDF file with the old MDF you are trying to attach.
    4. Attach the old MDF and the new LDF in their current locations, using sp_attach_db. Specify the location of both the MDF and LDF files.

    Let me know what you get from that.
    David Maxwell
    Data Integrity? Yeah, I've heard of that...

  11. #11
    Join Date
    Apr 2008
    Posts
    7
    It doesn't work. The message is that the log file not correspond with de mdf file.

  12. #12
    Join Date
    Oct 2006
    Location
    CA
    Posts
    210
    Just to clarify - the original server had the log file on the I: drive - and that's a local drive, correct?

  13. #13
    Join Date
    Apr 2008
    Posts
    7
    Yes, that's correct...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •