[Last Call] Learn how to a build a cloud-first strategyRegister Now


MSDB Log File Very Large - In Simple Recovery Mode

Posted on 2012-08-21
Medium Priority
Last Modified: 2012-08-21
results from T-SQL scriptI have a SQL Server instance running 2008R2. For some reason the MSDB database is set to Simple Recovery model (as per default), but the Transaction Log file is >7GB.

The transaction log file (MSDBLog)'s default size is set to 7626MB.

I have run the following T-SQL to ascertain disk usage:
SELECT object_name(i.object_id) as objectName,
i.[name] as indexName,
sum(a.total_pages) as totalPages,
sum(a.used_pages) as usedPages,
sum(a.data_pages) as dataPages,
(sum(a.total_pages) * 8) / 1024 as totalSpaceMB,
(sum(a.used_pages) * 8) / 1024 as usedSpaceMB, 
(sum(a.data_pages) * 8) / 1024 as dataSpaceMB
FROM sys.indexes i
INNER JOIN sys.partitions p
ON i.object_id = p.object_id
AND i.index_id = p.index_id
INNER JOIN sys.allocation_units a
ON p.partition_id = a.container_id
GROUP BY i.object_id, i.index_id, i.[name]
ORDER BY sum(a.total_pages) DESC, object_name(i.object_id)

Open in new window

This returns the following results (Top 15):
results from T-SQL script
There doesn't seem to be any reason for the log file being that large (I dont really understand why it is in use at all given that the DB is in SIMPLE RECOVERY)?

I have tried performing SHRINK DATABASE and SHRINK FILE commands, however these will not allow me to shrink the file below 7GB.

What can I do to identify what the 7GB is being used for and also what actions can I take to reduce the size of the log file?

Thanks in advance.

Question by:insuremce
LVL 10

Accepted Solution

gavsmith earned 2000 total points
ID: 38315542

Author Closing Comment

ID: 38315551
Fantatic - thanks very much!

Worked a treat!

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question