Large SharePoint Database LDF File and 14 Hive Logs



.ldf files


Some Times we find that the .ldf files (log files) of our SharePoint Database are bigger in size than that of the .mdf(Data files) file.
Now in this case if the logs are not required it can be easily shrinked.
It depends if the server is running smooth and we may not require the logs or if its a development environment and you are sure you can remove unwanted logs.

Generally its a good practise if we take a backup of the ldf to some other system and then shrink the file.


For SQL Server 2008, the command is:
ALTER DATABASE WSSContent SET RECOVERY SIMPLE
DBCC SHRINKFILE('WSSContent', 0, TRUNCATEONLY)

14 Hive Logs

Now same goes for the 14 hive logs of SharePoint they turn out to be of huge size in a span of time and many a times consume huge space which can be recovered.
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS
You can safely delete the old files which are not required.
The Above two methods can give you huge amount of space if on the server.




Comments

  1. Hi Saga
    My developement environment is running out of space
    For sql server 2005 i used below script

    USE ["Database Name"]
    GO
    ALTER DATABASE ["Database Name"] SET RECOVERY SIMPLE
    GO
    backup log ["Database Name"] with truncate_only
    GO
    DBCC SHRINKFILE (["Log File Name"],1)
    GO
    ALTER DATABASE ["Database Name"] SET RECOVERY FULL
    GO

    It resolved my issue

    Thanks for the help

    ReplyDelete
    Replies
    1. Hey Vishal,
      Thanks for your update on SQL Server 2005.
      Its always better to specify the database name and reset the recovery mode to full.
      Hope this will be helpful to many.

      Delete
  2. Hi Saga,

    please let me know if this can be used for production server.
    Successfully done on UAT environment.

    Thanks for your Help.

    ReplyDelete

Post a Comment

Popular posts from this blog

Install Node.js without admin rights

Create a lean React Solution using Typescript

Replace all occurence of String in JavaScript