Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2004
    Posts
    12

    Question Unanswered: Cleaning out Log file

    Can someone give me some advise on how to clean out my log file?

    Thanks

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    1. Don't
    2. Stop SQL Server, delete the files in the log-dir, start SQL Server.
    3. erhm...

  3. #3
    Join Date
    Oct 2004
    Posts
    12

    Do I just delete...

    So do I just want to delete the ldf file attached to the database? If so will it just create a new ldf file?

  4. #4
    Join Date
    Feb 2004
    Posts
    492
    oh no! I misunderstood! please [bold]don't[/bold] delete the ldf file!
    Last edited by Kaiowas; 10-27-04 at 12:23.

  5. #5
    Join Date
    Feb 2004
    Posts
    492
    Sometimes I execute the following:

    USE MONKEY

    DBCC OPENTRAN ('MONKEY')

    BACKUP LOG MONKEY WITH TRUNCATE_ONLY
    CHECKPOINT
    BACKUP LOG MONKEY WITH TRUNCATE_ONLY
    CHECKPOINT
    BACKUP LOG MONKEY WITH TRUNCATE_ONLY
    CHECKPOINT
    BACKUP LOG MONKEY WITH TRUNCATE_ONLY
    CHECKPOINT

    DBCC SHRINKDATABASE (MONKEY)
    DBCC SHRINKDATABASE (MONKEY, TRUNCATEONLY)

    Works for me, I'm sure there's a saver or better way to have a log file shrunk. Make sure though there are no transactions open on that database, also, I'd like to pick a time when there's no user activity on that db. The DBCC SHINK can take a while though.

Posting Permissions

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