how should i shrink the second log file

  • Hi you guys, i got a db containing two log file: log1 and log2, log1 is 50G with 20G free and log2 is 10G with 5G free, now i want to shrink log2 by moving file to log1, then delete log2, and you can see, the free space in log1 is definitely big enough to take the used data in log2, then i go to shrink log2 in the shrink panel with the shrink operation set as " Empty file by migrating the data to other files in the same filegroup", but after that the log2 was smaller but still not empty, so i can delete it.

    Is there any way i can delete the log2 file, my database is sqlserver 2008 running in windows 2008, thanks in advances.

  • Read the article in my signature on Managing Transaction Logs. You cannot move data in the log files the way you are trying to, you have to perform transaction log backups (full/bulk-logged recovery) or checkpoint (simple recovery) to move the active VLF's to the first files.

    When the second log file no longer has any active VLF's - then you can drop the second log file.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • fairyuseless (10/8/2010)


    Hi you guys, i got a db containing two log file: log1 and log2, log1 is 50G with 20G free and log2 is 10G with 5G free, now i want to shrink log2 by moving file to log1, then delete log2, and you can see, the free space in log1 is definitely big enough to take the used data in log2, then i go to shrink log2 in the shrink panel with the shrink operation set as " Empty file by migrating the data to other files in the same filegroup", but after that the log2 was smaller but still not empty, so i can delete it.

    Is there any way i can delete the log2 file, my database is sqlserver 2008 running in windows 2008, thanks in advances.

    May I inquire as to the reason the second log file exists to begin with? Transaction log files are written to sequentially, so there is no performance benefit from having multiple.

  • yes, there supposed to be only one log file, one day the log file increased so fast that blow up the disk and i had no idea to shrink it, so the only way i knew then was to add another log file in another disk

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

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