Transaction log file size 5+ GB

  • Hi all

    I created a database 6 months ago with unlimited file growth option

    The primary file size is 500 MB but the transaction file size is more than 5 GB

    Shrink database / DBCC shrinkdatabase works but it does not frees much space

    How can I make it around 1 GB

    Thanks

    AB

  • AB

    Once you have shrunk the database you will need to shink the file to free up the space

    dbcc shrinkfile (<t-log>, 500) -- shinks the t-log to 500Meg in sise

     

     

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • 1. detach database

    2. attach database without log file

    3. change database recovery option to simple

  • Or simpler. Change the recovery model to Simple. Backup the database and shrink the file!

  • If you need to be able to recover your database you shouldn't change the recovery model to Simple. Just do the following:

    1. Make full backup of your database

    2. Make transaction log backup. This will reduce your transaction log

    Generally it is very good sometimes to look through Books Online

  • Hi Guys

    Thanks for your advice.

    The problem has been solved now.

    I actually did this ...

    • Shrunk the db
    • Detached the db
    • Renamed transaction log
    • Again attached the db
    • The EM created a new log file
    • And i got rid of the HUGE log

    Thanks

     

     

  • Another simple way without having to detach/attach

    1.  BACKUP LOG dbname WITH NO_LOG

    2.  DBCC SHRINKFILE (log_name, size in MB, truncateonly)

    3.  Take a full backup immeditely and setup trans log backups on schedule.

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

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