Please can someone help.
A client server, with several user DB's has a large MSDB data file (~40GB) which is consuming space.
I have attempted some troubleshooting already by following these articles:
http://www.aspdeveloper.net/tiki-index.php?page=SqlCleanupLargeMSDB
http://www.mssqltips.com/sqlservertip/1461/analyze-and-correct-a-large-sql-server-msdb-database/
http://johnsterrett.com/tag/sysmaintplan_logdetail/
http://dbfriend.blogspot.co.uk/2011/04/removing-history-of-database-mail-log.html
The top tables are dbo.sysmail_mailitems with 4282 records, 138592 KB reserved and 138080 used, dbo.sysmaintplan_logdetail with 335 record, 6560 KB reserved and 5672 KB used. Available free space if I want to shrink the PRIMARY filegroup is 1563.38 MB (Currently allocated is 40774.00 MB)
I have run tasks to delete the backup history, and I have run a script to remove old database mail logs:
DECLARE @dt DATE = DATEADD(d,-28,GETDATE())
USE msdb
EXEC sysmail_delete_log_sp @logged_before = @dt
Please can someone help me reduce this database, as it is consuming a lot of disk space?