Creating a new transaction log smaller than original

  • Hi,

    I have a database which has been created with a huge transaction log, most of which is not being used. 

    I want to make it smaller, to free up the disk. 

    I am thinking of detaching the database, then renaming the .LDF.  Then I will attach the .MDF & .NDF only, which should case SQL to create a new .LDF.

    Are there any issues with doing this?  The database is not being used at the moment, and I will do a full backup prior to this.  Is this enough to ensure that my database remains stable?

    Can anyone offer any advise, please?  I need to do this urgently, as the database wil be going live soon, and we have little disk space.

    Many thanks

     

     

     

     

  • this can be don without unavailability :

    check dbcc shrinkfile / shrinkdb in BOL

    take special notice at Shrinking the Transaction Log.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • I would just add that you should be sure that the space is truly not needed before you shrink your log file.  We have many databases which at any given point in time the log files are mostly unused, however if your database tends to get "spikey" use or has any periodic large operations perfromed against it (including reindexing as part of a maintenance plan etc...) your log file will just be forced to grow again, potentially having a large impact on performance in the process.

    You shouldn't waste disk space if it isn't needed, but just make sure the space truly is not needed before you get rid of it.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/

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

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