Question on CDC enabled DB

  • Hi All,

    I had an issue of log space running out of space. So as master Gail as suggested, I have added a new log file on a different mount point. Now how do I delete the log file.

    Do I have to did back up and restore with old database configuration? If I do that I guess I will loose the CT Table lsn chain? or will I not?

    Please suggest..

  • Provided the log file is empty you can delete it. Ensure you have regulare log backups, do a shrink file and empty it.

    DBCC SHRINKFILE (N'Scratch_log' , EMPTYFILE)

    Then you should be able to delete the file.

    Cheers

    Leo

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

  • Strange I did not do any shrinkfile I just went to DB properties and removed the log file from there and the log file just vanished as if nothing was there at all...

    The log file has 20mb consumed data in it.. Do you know what might be the reason for this?

  • If a log file back up had marked all the records in the file as no longer needed then a delete will also work. I tend to do the shrink and empty as a precaution.

    Leo

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

  • As Books Online clearly says, shrinkfile with the emptyfile option is for data files. It is used to migrate data pages to other data files in the same filegroup.

    Log records cannot be moved by anything. You need to wait until the entire active portion of the log is in the file you want to keep (use DBCC LOGINFO) and then you can simply drop the other file (via alter database or the SSMS GUI), no other commands necessary.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks Master Gail..

    As you said the transactions might have already been committed and VLFs have been marked as reusable thats why I was able to delete the newly added log file.

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

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