Question

I am trying to run a LOG backup on the primary node of an Always ON SQL Server 2012 environment. The secondary server is only used for replication. no read or other access permitted. (licensing of microsoft EE).

When I do a full backup using Ola Hallengren scripts, all goes well. A full backup is placed in the location I need. But when I run the LOG backup, it does not carry out the backup at all. Testing a Differential backup also went fine. Doing a LOG backup manually, without Ola's script it does work too.

The backup I try is


USE [master]
GO

DECLARE @return_value int

EXEC    @return_value = [dbo].[DatabaseBackup]
        @Databases = N'TESTAlwayON',
        @Directory = N'c:\backup',
        @BackupType = N'LOG'

SELECT  'Return Value' = @return_value

GO

The return value is 0, and the message shows all (default) values back, but not the actual backup statement, like it does when doing a FULL backup.

Any thoughts, what I do wrong?

Jimmy

UPDATE : Fixed. I ran the command

ALTER AVAILABILITY GROUP AG1 SET (AUTOMATED_BACKUP_PREFERENCE = PRIMARY)

And now it keeps the setting on primary and my log backups are running fine.

Thanks for the push in the correct direction.

Was it helpful?

Solution

Your availability group is set to prefer backups on the secondary, and by default Ola's script is going to only run log backups on the node that is preferred.

Use the @OverrideBackupPreference='Y' parameter in the backup command to override that setting so that it will take the log backup on the node where the script runs regardless of the backup preference setting of the availability group.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top