Shrink msdb database SQL Server

Steps to shrink msdb database in SQL Server 2005:

  1. T-SQL: truncate table msdb.dbo.log_shipping_monitor_history_detail
  2. T-SQL: exec msdb.dbo.sp_purge_jobhistory @oldest_date='2013-02-07T13:55:10'
    (change date above as required)
  3. T-SQL: alter index all on msdb.dbo.sysjobhistory reorganize
  4. Management Studio: system databases > msdb > tasks > shrink > database
    OR, same thing in T-SQL: dbcc shrinkdatabase('msdb')

To see disk usage for a database:

  1. Management Studio: system databases > msdb > Reports > Standard Reports > Disk Usage
May 18, 2013

  • I tried this and the MSDB (.mdf) is still the same size, I wonder do I need to Alter database file in order to reduce the size?

  • Leave a Reply

    Your email address will not be published. Required fields are marked *