How do I delete excess transaction logs.

  • I have 2 live database.

    One of the database mdf size is 8 GB but its ldf size 76 GB.

    As ldf is acquiring as much as space of hard disk.

    My disk size 100 GB.

    How do I remove this. How I can remove this excess logs.

    Can any one suggest me..

    Regards

    Jafar

  • Is your database in full recovery mode?

    Do you have transaction log backups occuring regularly?

    Do you need to be able to resore this database to the moment of failure if something happens to it?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Yes My database is in full recovery mode.

    Transaction log backup is going on.

    Yes I want to recover it from the point of failure..

  • Check that the tran log backups are running. How often do they run?

    Run this query for the DB with the problem. Please post what it returns.

    select name, recovery_model_desc, log_reuse_wait_desc from sys.databases where name = ...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Query u have given is not working...

    and backup of transaction log is going on twice in a day..

    anything else u want.

  • mjafar (1/3/2008)


    Query u have given is not working...

    In what way is it not working?

    select name, recovery_model_desc, log_reuse_wait_desc from sys.databases where name = 'myDBName'

    (replace mydbname with the real name of that DB)

    You are using SQL 2005? (I assume so, since this is posted in the SQL 2005 forum)

    and backup of transaction log is going on twice in a day..

    anything else u want.

    You might consider making the log backups more frequent. If you're doing a lot of transactions, twice a day is not much.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Yes sir,

    I m not using SQL server 2005.

    And about transaction log backup, No not huge transaction is going on it.

    So i think it's not necessary to take frequent tranx backup.

    Current mdf size is 8 GB & ldf is 61 GB.

    How I can optimize my space.?

  • How old is your db and from when are you taking log backups.

    Are you sure that no huge transactions are going on.

    Have any triggers or jobs that modify data ? Since these 2 happen automatically you may missed these (just a guess).

    "Keep Trying"

  • mjafar (1/3/2008)


    Yes sir,

    I m not using SQL server 2005.

    The please post in the SQL 2000 forum so people don't waste their time and yours giving suggestions that don't work on the version you're using.

    And about transaction log backup, No not huge transaction is going on it.

    So i think it's not necessary to take frequent tranx backup.

    Current mdf size is 8 GB & ldf is 61 GB.

    How I can optimize my space.?

    The log must have grown to that size because it needed that much space for transactions. You can shrink it, but the chances are it will grow again.

    Check just before one of your log backups and see how much of the log is in use (taskpad in Enterprise manager)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Ok Sir sorry for posting data in other forum.

    My database is 2 years old.

    But still no one has taken any type of backup of that database.

    So its size became huge.

    Now I have started taking backup.

    But log size has become very huge...

    Regards

    Majid Jafar

  • thats the reason

    take a full backup and log backup

    truncate the log file

    check out BOL for more details on this

    "Keep Trying"

  • I have taken full database & tranx log backup.

    But using truncate it will just remove out inactive transaction logs.

    I have to reduce physical size captured by .ldf file.

  • If you have log backups occuring you don't need or want to truncate the log. An explicit truncate will break the log chain and prevent restores to a point in time anywhere after the truncate, until another full DB backup is taken

    Use DBCC Shrinkfile to reduce the size of the file. However, if you haven't resolved the root cause of the growth, it will end up growing again.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks a lot sir,

    And be guided every time..

  • use DBCC Updateusage, DBCC PROCCACHE, DBCC SHRINKDATABASE command along with DBCC Shrinkfile get better performance as well as good for backup also. Just try it.

Viewing 15 posts - 1 through 15 (of 19 total)

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