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
איך ליצור פרויקט  C חדש בVisual studio 2008

איך ליצור פרויקט C חדש בVisual studio 2008

במדריך זה נסביר כיצד להתחיל פרויקט חדש בסי בעזרת ויז'ואל סטודיו 2008 - אחת מסביבות הפיתוח הנפוצות כיום בשוק. הפרויקט החדש שניצור הינו אפליקציית קונסול (דרך עבודה סטנדרטית למפתחים מתחילים בסי).

Easy 2K views
מורה נבוכים למחשוב ענן

מורה נבוכים למחשוב ענן

מדריך זה ינסה לשפוך מעט אור על הנושא "מחשוב עננים" אמאזון, גוגל, מיקרוסופט, go-grid, salesforce.com ועוד.... התבלבלתם ? אנסה להסביר את ההבדלים בין השרותים המוצעים, איך לבחור את השרות הנכון, ואיך לבחור את הספק הנכון.

Hard 3K 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