I have issues with transaction logs on SQL Server 2012. I set up a job that does an automatic cleanup of logs, I used the following the plans below.
Job name: Cleanup DB Logs
Step 1: Do transaction log backup using Management wizard & go to "Step 2"
GO
BACKUP LOG [XXXX_Database] TO DISK = N'I:\XXX_Database.Trn' WITH NOFORMAT, NOINIT, NAME = N'XXX_Database-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
Step 2: Perform shrink log & transaction log backup and exit upon success e.g. here is the step 2 script below:
DBCC SHRINKFILE (N'CAR2_Analysis_Database_log' , 20)
GO
BACKUP LOG [XXXX_Database] TO DISK = N'I:\XXX_Database.Trn' WITH NOFORMAT, NOINIT, NAME = N'XXX_Database-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
DBCC SHRINKFILE (N'XXX_Database_log' , 20)
GO
Then I schedule the job to run every 3 hours daily. The idea of the above script is to force truncation. It works fine, however, after 2 days I see that the STEP 2 disappears from the Job. My question why does this happen? Any pointer would be highly appreciated.