How to shrink a MSSQL log file

No more disc space on your SQL server? There's a change that the log files are too big. This guide will show you how to stop using the log files and errase them. Pay attention, you cannot restore these files and must make a backup before you begin!!!!

Medium 891 views

What You'll Need

  • SQL
  • shrink db
  • ldf
  • log file shrink
  • database

Tips

לשים לב לשמות הקבצים מפקודות ה- select

Warning

לא לבצע בלי גיבויי !!!

Steps

  1. 1

    Step 1

    יש להעביר את בסיס הנתונים למצב גיבויי "simple" - ניתן לעשות זאת דרך הממשק, או דרך פקודת ה- SQL use dbname select name,recovery_model_desc from sys.databases - יחזיר את שמות הקבצים לכווץ ומצבם lter database dbname SET Recovery simple -ישנה את בסיס הנתונים הנבחר.
  2. 2

    Step 2

    הכווץ עצמו - dbcc shrinkfile ('dbname_log)
  3. 3

    Step 3

    עכשיו אפשר לבדוק את הגודל - select name,size from sys.database_files

Related Guides

How to choose and buy your website domain name

How to choose and buy your website domain name

The name of the site says everything, it must be catchy, short, concise and yet tell what is behind the business. These few easy steps will explain how to choose and buy a domain name for your website.

Easy 1K views
How to get your email from Gmail on Outlook

How to get your email from Gmail on Outlook

This guide we will explain how have your email from your Gmail account delivered to Outlook. You can do it in a few simple steps.

Easy 2K views
How to use different programs at the same time with Windows

How to use different programs at the same time with Windows

With windows you can have several programs open on your desktop and go from one to another without closing them. This guide will explain how you can quickly move from one to the next using icons on your desktop and shortcut keys on your keyboard.

Easy 901 views
Programming in PERL (Part One)

Programming in PERL (Part One)

The purpose of the guide (s) is to give you basic knowledge so you can continue to explore the language in depth. This guide will cover the following topics: 1. Introduction - Why PERL? 2. Who needs this guide? 3. What you need to start programming? 4. Hello World!

Medium 995 views
How to Change Your Google Chrome Theme & Background

How to Change Your Google Chrome Theme & Background

Personalize your Chrome browser! Learn easy steps to change themes, customize backgrounds, and make your browsing experience uniquely yours.

Easy 25K views
How to Fix the OpenSSL Heartbleed Bug: A Comprehensive Guide

How to Fix the OpenSSL Heartbleed Bug: A Comprehensive Guide

Learn to identify, patch, and verify fixes for the critical OpenSSL Heartbleed vulnerability. This guide covers steps for Linux, Apache, Tomcat, and other systems.

Medium 14K views