Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Unanswered: Attach db failure cause log not primary

    Hi Everybody,

    I need URGENT help with this. Because of space problem my collegue create a second log file on another drive. I wanted to clean the thing, made a detach, renamed the ldf into old, but now it won't attach anymore, I get the following messages:

    EXEC sp_attach_db @dbname='TARIFINFO_GEN',
    @filename1 = 'F:\Data\TARIFINFO_GEN_Data.mdf'

    Server: Msg 5171 F:\Data\TARIFINFO_GEN_log.ldf is not a primary database file
    Server: Msg 1813 Device activation error the physical file name 'F:\Data\TARIFINFO_GEN_log.ldf' may be incorrect

    Do someone know what to do or where to look for a solution. Many thanks in advance, Isabelle.

  2. #2
    Join Date
    Feb 2004
    Posts
    78
    Try
    Code:
    sp_attach_single_file_db 'TARIFINFO_GEN',
     'F:\Data\TARIFINFO_GEN_Data.mdf'
    Also, in many instances to clean logs you should be able to run something like:

    backup log TARIFINFO_GEN with truncate_only

    and then a dbcc shrinkfile.

    Instead of detaching and re-attaching.

    Eric
    Last edited by Dilyias; 12-21-04 at 18:27.

Posting Permissions

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