Ellen Heijmans wrote:
I would like an option that it will not try to backup the log when there is no full. But I can't find it.
I think Ola Hallengren's Maitenance Solution will do this for you. You can also check for databases in Pseudo Full Recovery and force a full or differential backup:
SET NOCOUNT, XACT_ABORT ON;
DECLARE @Databases nvarchar(4000);
-- Databases in Pseudo Full Recovery
SELECT D.[name] AS DBName
FROM sys.databases D
JOIN sys.database_recovery_status R
ON D.database_id = R.database_id
WHERE D.recovery_model = 1
AND R.last_log_backup_lsn IS NULL;
IF EXISTS (SELECT 1 FROM #t)
SELECT @Databases =
(SELECT ',' + DBName FROM #t FOR XML PATH(''))
, 1, 1, ''
PRINT 'Differential/Full Backups being done for ' + @Databases
@Databases = @Databases
,@Directory = NULL
,@BackupType = 'DIFF'
,@ChangeBackupType = 'Y'
,@ModificationLevel = 50
,@CleanupTime = NULL
,@CheckSum = 'Y'
,@LogToTable = 'Y'
,@Encrypt = 'Y'
,@EncryptionAlgorithm = 'AES_256'
,@ServerCertificate = 'asdfgasfasdfa';
PRINT 'No Differential/Full Backups Required.';