SQL SERVER – master Database Log File Grew Too Big

Couple of the days ago, I received following email and I find this email very interesting and I feel like sharing with all of you.

Note: Please read the whole email before providing your suggestions.

“Hi Pinal,

If you can share these details on your blog, it will help many.

We understand the value of the master database and we take its regular back up (everyday midnight). Yesterday we noticed that our master database log file has grown very large. This is very first time that we have encountered such an issue. The master database is in simple recovery mode; so we assumed that it will never grow big; however, we now have a big log file.

masterlog1 SQL SERVER   master Database Log File Grew Too Big

We ran the following command

USE [master]

We know this command will break the chains of LSN but as per our understanding; it should not matter as we are in simple recovery model.

masterlog2 SQL SERVER   master Database Log File Grew Too Big



After running this, the log file becomes very small.

Just to be cautious, we took full backup of the master database right away.

We totally understand that this is not the normal practice; so if you are going to tell us the same, we are aware of it.

However, here is the question for you? What operation in master database would have caused our log file to grow too large?


[name and company name removed as per request]”

Here was my response to them:

“Hi [name removed],

It is great that you are aware of all the right steps and method. Taking full backup when you are not sure is always a good practice.

Regarding your question what could have caused your master database log to grow larger, let me try to guess what could have happened.

Do you have any user table in the master database? If yes, this is not recommended and also NOT a good practice. If have user tables in master database and you are doing any long operation (may be lots of insert, update, delete or rebuilding them), then it can cause this situation.

You have made me curious about your scenario; do revert back.

Kind Regards,


Within few minutes I received reply:

“That was it Pinal. We had one of the maintenance task log tables created in the master table, which had many long transactions during the night. We moved it to newly created database named ‘maintenance’, and we will keep you updated.”

I was very glad to receive the email. I do not suggest that any user table should be created in the master database. It should be left alone from user objects. Now here is the question for you – can you think of any other reason for master log file growth?

Reference: Pinal Dave (http://blog.SQLAuthority.com)

18 thoughts on “SQL SERVER – master Database Log File Grew Too Big

  1. Very useful tip, there are times where such things like creating user objects (tables) are done on the master database. Needs to be part of best practices – not to create user defined tables in master database.
    BTW i have seen cases where UDF’s are created in the master database, is that a good practice.



  2. good one, accepted we should never create user defined tables in the master db, although we can create a few stored procs and not so big tables if they are being used to perform some audit operation when the sql server/ system starts. And to you question, i having large number of sql server objects, creating and droping large number of objects might increase the master db log file size.


  3. can you give a detail about benefit of taking backup of log or any database. can i get detail of transaction from log file data.if yes how it is possible if not then what is the benefit to take backup of it.


    • The ldf file logs all the transactions with the corresponding system change number and is therefore important for instance recovery. All the DML in an instance is logged in here.

      So I say it wouldnt be a good idea to delete the log.


      • will i get the information that which query,procedure or something else were executed? if yes can you give me any link or query or method to get that.


  4. Pingback: SQL SERVER – Log File Growing for Model Database – model Database Log File Grew Too Big Journey to SQLAuthority

  5. Hi Pinal

    I have been using bulk insert commands to insert data from text files to my DB. As a result of which(as I feel), the log file of my DB grows enormously (In GBs) and I run out of space in my system. To continue with normal operation I use the command
    Backup log with no log
    and then use DB->Task->Shrink->File to shrink the log file, which reduces the log file size to 1024 KBs in most cases.
    As I have come to know through your blogs that this is not a good practice. I would like to know that what other options do we have to :
    1. Prevent the log file to such huge sizes in first case;
    2. reduce the size in case it has grown.


    • Hi Yogesh,
      A simple solution can be changing the recovery model of your DB from full to bulk recovery model. And before doing this, it is highly recommended that you take a backup (Log and if possible full as well). After performing the bulk operation, do take a log and full backup. For better know how of the recovery models, refer the following link


  6. Pingback: SQL SERVER – Database Worst Practices – New Town and New Job and New Disasters Journey to SQLAuthority

  7. Pingback: SQL SERVER – A Quick Look at Logging and Ideas around Logging « SQL Server Journey with SQL Authority

  8. Please I need your help.We have two very big Db’s in one instance and other small DB’s.We have a job runnig which takes a full backup every midnight and everyother day the job fails because of disk space issue. Also we have transaction log backup. Now we are thinking to implement differential back.What do you think can it help us?
    Thank you.


  9. Pingback: SQL SERVER – Weekly Series – Memory Lane – #011 « SQL Server Journey with SQL Authority

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s