sql-server-maintenance-solution
sql-server-maintenance-solution copied to clipboard
CleanupTime is not applied to backup jobs when running on a Linux server
Description of the issue CleanupTime is not applied to the backup jobs when running on a Linux server
SQL Server version and edition Microsoft SQL Server 2019 (RTM-CU9) (KB5000642) - 15.0.4102.2 (X64) Jan 25 2021 20:16:12 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Linux (Red Hat Enterprise Linux 8.3 (Ootpa)) <X64>
Version of the script Version: 2022-01-02 13:58:13
What command are you executing? When running MaintenanceSolution.sql
What output are you getting? The backup jobs are set up as:
EXECUTE [dbo].[DatabaseBackup]
@Databases = 'USER_DATABASES',
@Directory = N'/home/MSSQLSERVER/BACKUP',
@BackupType = 'FULL',
@Verify = 'Y',
@CleanupTime = NULL,
@CheckSum = 'Y',
@LogToTable = 'Y'
instead of using the CleanupTime defined as:
DECLARE @CleanupTime int = 336
It occurs because the CleanupTime is only used for Windows servers:
IF @HostPlatform = 'Windows'
BEGIN
SELECT @CleanupTime = Value
FROM #Config
WHERE [Name] = 'CleanupTime'
END