Use Caution

Microsoft SQL Server Transaction Log Files (.ldf)

Quick Answer: SQL Server database transaction logs (.ldf) grow infinitely if full recovery mode backups are not managed. Shrinking LDF logs requires caution.

Bottom Line: DO NOT delete .ldf files directly while SQL Server is running. Shrink transaction logs safely using SQL Server Management Studio (SSMS) or T-SQL statements after taking a database backup.


How to Shrink LDF Logs Safely

ALTER DATABASE [YourDatabase] SET RECOVERY SIMPLE;
DBCC SHRINKFILE (N'YourDatabase_Log' , 1000);
ALTER DATABASE [YourDatabase] SET RECOVERY FULL;

Discussion

Loading authentication...

Related in developer

The AI Engineer's Model Disk Cleanup Guide: Hugging Face, Ollama & PyTorch

The ultimate 1,200-word field guide for AI developers and local LLM hobbyists to reclaim 200GB+ from Ollama, Hugging Face, PyTorch, and vLLM model weights.

Safe to Delete

Android Studio System Index Cache (AndroidStudio Cache)

Android Studio caches Gradle project indexes, VFS caches, and compiler artifacts. Invalidate and clear is safe.

Safe to Delete

Ansible Automation Temp & Fact Cache (~/.ansible/tmp)

Ansible stores temporary playbook execution modules and target host fact JSON caches in ~/.ansible/tmp. Clearing Ansible tmp is safe.

Safe to Delete
Back to all files