SQL 2000 LDF File Too Big

  • Hi,

    I have a database contain 3G LDF and 1G MDF file. May i know wether can i shrink the LDF to the smallest file ? How to do it ? and Any impact to the MDF if i shrink it ? Thank you very much!

  • How to reduce the log file size:

    1. Open Query Analyzer

    2. sp_detach_db 'database-name'

    3. Delete the log file

    4. sp_detach_db 'database-name'

    5. Open Enterprise Manager

    to make sure the database works

  • Any impact to my MDF if i follow the below method ?

    quote:


    How to reduce the log file size:

    1. Open Query Analyzer

    2. sp_detach_db 'database-name'

    3. Delete the log file

    4. sp_detach_db 'database-name'

    5. Open Enterprise Manager

    to make sure the database works


  • No, everything should be OK.

    Please do the following if you get a "database currently in use" message when doing step #2

    2b. Open Enterprise Manager

    2c. Management

    2d. Locks/Objects

    2e. Kill any processes that

    are making the db "in-use"

    Please let me know if you need anything.

    I will check back in about 7 hours.

  • Here are the "full" directions.

    1. Open Query Analyzer

    2. sp_detach_db ‘database-name'

    · Open Enterprise Manager

    · Management

    · Locks/Objects

    · Kill any processes that are making the db "in-use"

    · Repeat step #2

    3. Delete the log file

    4. Open Enterprise Manager

    5. Right Click “Databases”

    6. Left Click”All Tasks” --> “Attach Database”

    7. C:\Program Files\Microsoft SQL Server\MSSQL\Data\database-name_Data.mdf

    8. Hit “Refresh” if needed to see the database

  • Thank you for ur helps. I will try in later.

    By the way, how to prevent the transaction log grow?

    Full backup will reduce the LDF file size ?

    Thank You!

  • Thank you for ur helps. I will try in later.

    By the way, how to prevent the transaction log grow?

    Full backup will reduce the LDF file size ?

    Thank You!

    quote:


    Here are the "full" directions.

    1. Open Query Analyzer

    2. sp_detach_db ‘database-name'

    · Open Enterprise Manager

    · Management

    · Locks/Objects

    · Kill any processes that are making the db "in-use"

    · Repeat step #2

    3. Delete the log file

    4. Open Enterprise Manager

    5. Right Click “Databases”

    6. Left Click”All Tasks” --> “Attach Database”

    7. C:\Program Files\Microsoft SQL Server\MSSQL\Data\database-name_Data.mdf

    8. Hit “Refresh” if needed to see the database


  • A full backup does not decrease the logfile.

    A log backup creates empty room in the logfile, which it fills first before growing again.

    If you make no log backups set the database to simple recovery model. The logfile will not grow anymore (unless you have very long transactions)

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

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