Sunday, June 8, 2014

How to reduce SQL Server transaction Log

Well, the transaction log is a headache when it comes to the space requirements. That however, is necessary if you want to restore your database to a given previous time. Personally, I've never used this.

If you try to shrink the file by going into SQL Server Management Studio - > Right Click the database - > Go to tasks - > Shink - > Files -> Select Log from the drop down
            this will reduce some amount of the file, but if it is really big and you don't want it and you want it all removed try the following.


  1. Backup the current transaction log.
    Right Click the Database -> Tasks -> Backup -> Select 'Transaction_Log' from the backup type drop down -> OK
  2. Now try to shrink the Log file.
     Right Click the database - > Go to tasks - > Shrink - > Files -> Select Log from the drop down
  3. See now that your file size is reduced for your relief.

Remember, Never detach the db and reattach without the log file or delete the log file just to get rid of it!!!