Backup and truncate LDF with xp_sqlmaint A job is backing up an LDF with the following command:

EXECUTE master.dbo.xp_sqlmaint N'-PlanID &lt;the id&gt; -WriteHistory  -VrfyBackup -BkUpMedia DISK -BkUpLog "\\server\sqlbak$" -DelBkUps 6HOURS -BkExt "TRN"'


I would like the job to truncate the LDF after backing it up.

I have looked at the xp_sqlmaint documentation and it seems that the flag -RmUnusedSpace may do the trick, but I'm not sure as it seems to only remove unused space rather than truncating.

I read that using dbcc shrinkfile('logfile' , destination size) can break the backup chain, as you cannot then backup to a specific point in time.

How can I go about truncating the LDF after the backup?
How can I go about truncating the LDF after the backup?


Don't. A maintenance plan has no business truncating files, LDF nor MDF. There is no point to shrink something only to have it grown back overnite, at (huge) runtime cost. If the file is large, it means it has to be large. Truncating files is just another way of asking for downtime because it gives a false impressions of free disk, where the disk is reclaimed back during normal operations, but potentially can fail (grinding everything to a halt) because the needed space was meanwhile taken by other files. 

So just don't.

On special occasions after the file has grown due to a one-time incident, a manual one-time truncation of LDF is OK. But not as part of regular maintenance, that is absolutely not OK.