I need to keep track of the MSSQL database log backups. The number of databases may vary. The database log is backed up every 15 minutes, if there is no backup for more than 30 minutes, a trigger must be created. The problem is that during the database backup, the database log cannot be backed up, and the backup system can only run one job. When you run multiple backup jobs, other jobs are queued. Databases have different sizes, and backups of some databases can take more than 4 hours. I added an item that shows the backup status and added it to the trigger.
But this only works for one database. Database triggers do not take into account backups of other databases.
I want to use an aggregate function for a trigger. But it doesn't work.
There is a plan B. Creating an aggregate item and use it in the trigger calculation.
Is it possible to use aggregate functions for a trigger?
Code:
now()-last(/SQLSERVER/db.logUtcBackup[MSSQLSERVER,DBNAME])>{$LOGBACKUPPERIOD}
and
last(/SQLSERVER/db.CurrentDbBackupStatus[MSSQLSERVER,DBNAME])<>1
I want to use an aggregate function for a trigger. But it doesn't work.
Code:
now()-last(/SQLSERVER/db.logUtcBackup[MSSQLSERVER,DBNAME])>{$LOGBACKUPPERIOD}
and
count(last_foreach(/SQLSERVER/db.CurrentDbBackupStatus[*]),"ne",1))>0
Code:
count(last_foreach(/SQLSERVER/db.CurrentDbBackupStatus[*]),"ne",1)