BizTalk Shrink Log Script

Sample script to get a dev/test env going again if you logs chew up the disk. Set recovery mode to simple of each db to cleanup and then shrink the log and set the reco very mode back to full.

USE master
ALTER DATABASE BizTalkDTADb SET RECOVERY SIMPLE WITH NO_WAIT
ALTER DATABASE BizTalkMsgBoxDb SET RECOVERY SIMPLE WITH NO_WAIT
Use BizTalkDTADb
DBCC SHRINKFILE (N'BizTalkDTADb_log' , 0, TRUNCATEONLY)
GO
Use BizTalkMsgBoxDb
DBCC SHRINKFILE (N'BizTalkMsgBoxDb_log' , 0, TRUNCATEONLY)
GO
USE master
ALTER DATABASE BizTalkDTADb SET RECOVERY FULL WITH NO_WAIT
ALTER DATABASE BizTalkMsgBoxDb SET RECOVERY FULL WITH NO_WAIT
GO
Advertisements
This entry was posted in BizTalk Server. Bookmark the permalink.

One Response to BizTalk Shrink Log Script

  1. Good practice to trigger a full backup after this using
    USE [BizTalkMgmtDb]
    GO
    exec BizTalkMgmtDb.dbo.sp_ForceFullBackup

    Then run the backup job named Backup BizTalk Server (BizTalkMgmtDb)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s