title: .ldf File Shrink or Reduce Size - Recommended Solution
body: <p>I am confused about SQL Server t-Log file size growth (.ldf file). I analyzed various blogs/topics by DBA's some recommending Log file Shrink while some advised not to do so. Here is what I used to follow:</p>
  
  <blockquote>
    <ol>
    <li><p>Take Database in Full mode if its not already in it.  </p></li>
    <li><p>Shrink Log
        files if not enough memory freed then move to next step.</p></li>
    <li>De-Attach Database. (sometimes it went in Single Mode and no matter what
        deadlock process I kill , it will never come in multi-user mode
        again. BIG PROBLEM!!! )</li>
    <li>move .ldf file to other location and Restore mdf file only.</li>
    </ol>
  </blockquote>
  
  <p><strong>This was not a recommended technique so I surfed to following script i.e. reducing Virtual Log File (VLF) to free unused space:</strong></p>
  
  <pre><code>USE dbname
  BACKUP LOG dbname TO DISK = 'C:\x\dbname.trn'
  --First param below is fileno for log file, often 2. Check with sys.database_files
  --Second is desired size, in MB.
    DBCC SHRINKFILE(2, 500)
    DBCC SQLPERF(LOGSPACE) --Optional
    DBCC LOGINFO --Optional 
    Now repeate above commands as many times as needed!
  </code></pre>
  
  <p>I am not sure if is the VLF script professionally recommended to try at Production Environment where Down time cannot be afforded. Please advise how should I move forward.</p>