September 23, 2013

SharePoint config database is full (Event ID 6398)

Today in our production server I saw below error in event viewer multiple times, Though site was browsing well , event viewer was getting full with this error (generating every minute)

Problem:

The Execute method of job definition Microsoft.Office.Server.Search.Monitoring.HealthStatUpdateJobDefinition (ID 955cc661-dc70-4083-a855-aa7509708ee9) threw an exception. More information is included below.

The transaction log for database 'SharePoint_Config' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases


Troubleshoot

First I took backup of Config DB along with its LOG file.

So, when i checked config DB size, it was only 250 MB, however log file for config DB was 75GB!!!.
So tried to shrink the log file. But received error (Available free space was 0 Mb, so it was not going to help anyways.)

The transaction log for database 'SharePoint_Config' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

Even shrinking through T-SQL did not help.

So, as a next step, I restarted the SQL service from services.msc (Remember, your sharepoint site will be down during SQL service restart process, max 1 min.) Now when I reopened SQL management studio, config DB was in recovery stage, after 5 min, it came out of recovery stage.

Now, when i checked available free space, it was 74GB (almost 99%).

Now, I tried shrinking it, but still nothing haappened. 

Tried below mentioned command, in the context of config DB, still did not make any difference in DB size

dbcc shrinkfile(2,1024)

SOLUTION :

As a next step, I decided to convert the recovery model to SIMPLE from FULL. This should truncate some logs.

so I executed below command, (Remember to replace with your config DB name)

ALTER DATABASE Sharepoint_Config SET RECOVERY SIMPLE;
once this executes successfully, check the log file size, at first it was showing same as 75GB, but when i checked after 5 mins, log file size was reduced to 506KB !!!!
As a last step, I changed recovery model back to FULL. 

When I checked event viewer, all errors were gone.

Please write to me, if you have any question.