MSDB Log File Very Large - In Simple Recovery Mode

Posted on 2012-08-21
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

    LVL 1

    Author Closing Comment

    Fantatic - thanks very much!

    Worked a treat!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.
    Viewers will learn how the fundamental information of how to create a table.

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now