# Samples / Threshold / Oracle backup with status "FAILED"

**URL:** <https://community.dynatrace.com/t/samples-threshold-oracle-backup-with-status-failed/48124>\
**Category:** Alerting\
**Tags:** problem-detection, oracle, problems-classic\
**Created:** [October 3, 2024, 2:34pm UTC](https://community.dynatrace.com/t/samples-threshold-oracle-backup-with-status-failed/48124 "2024-10-03T14:34:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mn\_24](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mn\_24](https://community.dynatrace.com/u/mn_24)\
**Post date:** [October 3, 2024, 2:34pm UTC](https://community.dynatrace.com/t/samples-threshold-oracle-backup-with-status-failed/48124/1 "2024-10-03T14:34:44Z")

</div>

Hi,

I want to receive a problem when there is a FAILED Oracle database backup and to be closed **only** if the next one is **successfully COMPLETED** otherwise I want to investigate further why it is failing.

This is the metric/SQL statement behind/ which is used:

SELECT

backup\_job.SESSION\_RECID,

backup\_job.SESSION\_STAMP,

backup\_job.START\_TIME,

backup\_job.END\_TIME,

backup\_job.STATUS,

backup\_job.INPUT\_TYPE,

backup\_job.ELAPSED\_SECONDS,

(backup\_job.COMPRESSION\_RATIO \* 100) COMPRESSION\_RATIO,

backup\_job.INPUT\_BYTES,

backup\_job.OUTPUT\_BYTES,

backup\_job.INPUT\_BYTES\_PER\_SEC,

backup\_job.OUTPUT\_BYTES\_PER\_SEC,

backup\_job.AUTOBACKUP\_DONE,

backup\_job.OPTIMIZED,

backup\_job.AUTOBACKUP\_COUNT,

backup\_set.DISTINCT\_BACKUP\_TYPES AS BACKUP\_TYPES,

CASE

WHEN (

backup\_job.INPUT\_TYPE = ‘ARCHIVELOG’

) THEN ‘NO’

WHEN (

INSTR(backup\_set.DISTINCT\_BACKUP\_TYPES, ‘D’) \> 0 AND

COALESCE(MAX(backup\_set.INCREMENTAL\_LEVEL), 0) = 0

) THEN ‘FULL’

WHEN (

INSTR(backup\_set.DISTINCT\_BACKUP\_TYPES, ‘D’) \> 0 AND

MAX(backup\_set.INCREMENTAL\_LEVEL) = 1

) THEN ‘INCREMENTAL’

ELSE ‘NO’

END AS DATAFILES\_INCLUDED,

CASE

WHEN INSTR(backup\_set.DISTINCT\_BACKUP\_TYPES, ‘L’) \> 0 THEN ‘YES’

ELSE ‘NO’

END AS logs\_included,

CASE

WHEN MAX(CASE WHEN backup\_set.CONTROLFILE\_INCLUDED = ‘YES’ THEN 1 ELSE 0 END) \> 0 THEN ‘YES’

ELSE ‘NO’

END AS CONTROLFILE\_INCLUDED,

CASE

WHEN MAX(CASE WHEN backup\_set.INCREMENTAL\_LEVEL = 0 THEN 1 WHEN backup\_set.INCREMENTAL\_LEVEL = 1 THEN 2 ELSE 0 END) = 1 THEN ‘0’

WHEN MAX(CASE WHEN backup\_set.INCREMENTAL\_LEVEL = 0 THEN 1 WHEN backup\_set.INCREMENTAL\_LEVEL = 1 THEN 2 ELSE 0 END) = 2 THEN ‘1’

ELSE ‘N/A’

END AS INCREMENTAL\_LEVEL

FROM V$RMAN\_BACKUP\_JOB\_DETAILS backup\_job

LEFT JOIN

(

SELECT

distinct\_backup\_set.DISTINCT\_BACKUP\_TYPES,

V$BACKUP\_SET\_DETAILS.SESSION\_STAMP,

V$BACKUP\_SET\_DETAILS.SESSION\_RECID,

V$BACKUP\_SET\_DETAILS.CONTROLFILE\_INCLUDED,

V$BACKUP\_SET\_DETAILS.INCREMENTAL\_LEVEL

FROM

(

SELECT

LISTAGG(BACKUP\_TYPE, ‘+’) WITHIN GROUP(ORDER BY BACKUP\_TYPE) as DISTINCT\_BACKUP\_TYPES,

SESSION\_STAMP,

SESSION\_RECID

FROM

(

SELECT

DISTINCT BACKUP\_TYPE,

SESSION\_STAMP,

SESSION\_RECID

FROM V$BACKUP\_SET\_DETAILS

)

GROUP BY

SESSION\_STAMP,

SESSION\_RECID

) distinct\_backup\_set

JOIN

V$BACKUP\_SET\_DETAILS

ON V$BACKUP\_SET\_DETAILS.SESSION\_RECID = distinct\_backup\_set.SESSION\_RECID AND V$BACKUP\_SET\_DETAILS.SESSION\_STAMP = distinct\_backup\_set.SESSION\_STAMP

) backup\_set  
ON backup\_job.SESSION\_RECID = backup\_set.SESSION\_RECID AND backup\_job.SESSION\_STAMP = backup\_set.SESSION\_STAMP  
WHERE (  
(  
backup\_job.END\_TIME \>= CURRENT\_TIMESTAMP - NUMTODSINTERVAL(5, ‘MINUTE’)  
OR  
(backup\_job.END\_TIME IS NULL AND backup\_job.START\_TIME \>= CURRENT\_TIMESTAMP - NUMTODSINTERVAL(60, ‘MINUTE’))  
)  
AND backup\_job.STATUS NOT LIKE ‘RUNNING%’  
)  
GROUP BY

backup\_job.SESSION\_RECID,

backup\_job.SESSION\_STAMP,

backup\_job.START\_TIME,

backup\_job.END\_TIME,

backup\_job.STATUS,

backup\_job.INPUT\_TYPE,

backup\_job.ELAPSED\_SECONDS,

backup\_job.COMPRESSION\_RATIO,

backup\_job.INPUT\_BYTES,

backup\_job.OUTPUT\_BYTES,

backup\_job.INPUT\_BYTES\_PER\_SEC,

backup\_job.OUTPUT\_BYTES\_PER\_SEC,

backup\_job.AUTOBACKUP\_DONE,

backup\_job.OPTIMIZED,

backup\_job.AUTOBACKUP\_COUNT,

backup\_set.DISTINCT\_BACKUP\_TYPES

ORDER BY backup\_job.SESSION\_STAMP DESC;

The archive log backups of this database are scheduled to run on every 3 hours as I saw **an auto-closed** problem for FAILED backup , start digging and saw also that the problem was opened and closed in 2min - couldn’t believe!

Why Davis has closed the problem before there is a real successfully completed backup or at least leave the problem open?

Is it because of the configuration with the samples, what about the threshold - should it be 0 or 1? OR it is because of the SQL statement which is fetching the data with this WHERE clause:

"…

WHERE (  
(  
backup\_job.END\_TIME \>= CURRENT\_TIMESTAMP - NUMTODSINTERVAL(5, ‘MINUTE’)  
OR  
(backup\_job.END\_TIME IS NULL AND backup\_job.START\_TIME \>= CURRENT\_TIMESTAMP - NUMTODSINTERVAL(60, ‘MINUTE’))  
)  
AND backup\_job.STATUS NOT LIKE ‘RUNNING%’  
)

…"

 ![mn_24_0-1727964780346.png](https://global.discourse-cdn.com/dynatrace/original/2X/6/6beec529b9fcdef4adeb15421215862094e7795e.png)

 ![mn_24_1-1727965355960.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/6/06311b45bffcab0688de803d32a1fc82cda9bf1b.png)

Here I am checking from the database the last two backups now and you can see that the LAST one is FAILED - a problem was generated for that but auto-closed after only 2min - WHY?!:

![mn_24_3-1727965437320.png](https://global.discourse-cdn.com/dynatrace/original/2X/d/d274d6d5a92257dc5330b1e69c9905da9dd520a8.png)

 ![mn_24_2-1727965420569.png](https://global.discourse-cdn.com/dynatrace/original/2X/1/1d4c38116d50bf33f98fd1c0230d180947f590c1.png)

---

<div class="post-metadata">

**Author:** ![kalle\_lahtinen](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kalle\_lahtinen](https://community.dynatrace.com/u/kalle_lahtinen)\
**Post date:** [October 21, 2024, 12:05pm UTC](https://community.dynatrace.com/t/samples-threshold-oracle-backup-with-status-failed/48124/2 "2024-10-21T12:05:13Z")

</div>

I was just now struggling with a similar issue. I think the “dealerting samples” includes any 1-minute sample where the condition is **not** breached - even including times when there is no data at all.

So let’s take a dummy example:

10:00&nbsp;Condition breach

10:01 \<no data\>

10:02 \<no data\>

10:03 \<no data\>

10:04 \<no data\>

10:05 Condition breach

If your “dealerting samples” is 3, it means you have 10:01, 10:02 and 10:03 as 1-minute slots where the alert condition is **not** breached, and the alert is then closed (too early). The data is not indicating success either, which makes this a bit counter-intuitive for me at least. I guess the solution is simply to add a gigantic number in the “dealerting samples”, to ensure that you’ll likely get some further input by that time, to know if the issue is still ongoing.

---

<div class="post-metadata">

**Author:** ![Gosia\_Murawska](https://avatars.discourse-cdn.com/v4/letter/g/2bfe46/32.png) [@Gosia\_Murawska](https://community.dynatrace.com/u/Gosia_Murawska)\
**Post date:** [January 8, 2025, 4:15pm UTC](https://community.dynatrace.com/t/samples-threshold-oracle-backup-with-status-failed/48124/3 "2025-01-08T16:15:44Z")

</div>

Hi&nbsp;[@mn\_24](https://community.dynatrace.com/user/77323), did you manage to solve your issue? I’m sure the rest of the Community wants to know the solution 🙂

---

<div class="post-metadata">

**Author:** ![mn\_24](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mn\_24](https://community.dynatrace.com/u/mn_24)\
**Post date:** [January 13, 2025, 4:34pm UTC](https://community.dynatrace.com/t/samples-threshold-oracle-backup-with-status-failed/48124/4 "2025-01-13T16:34:55Z")

</div>

Hi,

well i am not using the two backup related metrics because don’t want to overlap the work of the assigned Backup Teams.

But if you create a separate Alerting profile and than if you are using for example ServiceNow integrate it properly based on the following rule: a human must close the incident manually.

The data for this metric is fetched on every 1min so change the Violating Samples to 4 and the Window to 5 just to have enough time to process the ticket and to lock it in SNOW until someone close it manually.

The problem in Dynatrace will be auto-closed and it will continue to check based on the SQL.

This is the process how it will continue to monitor only the latest backups and not stuck on one FAILED but after it could have completed without any errors, right?

On top of that you can enable the second metric to monitor only the FULL backups:

com.dynatrace.extension.sql-oracle.backup.time\_since:filter(and(not(eq(“incremental.level”,“INCREMENTAL 1”)),or(not(eq(“incremental.level”,“N/A”))))):splitBy(“incremental.level”,“input.type”,“dt.entity.sql:com\_dynatrace\_extension\_sql-oracle\_host”,“dt.entity.sql:com\_dynatrace\_extension\_sql-oracle\_instance”):sort(value(auto,descending))

don’t forget to adjust the threshold according to your environmental needs - maybe 1 week would be fine.

The other option to monitor oracle database backups is and if you don’t have a dedicated Backup team who is monitoring them via third party technology(could be Dynatrace as well) and if you are using rman backup scripts in crontab. Those backups should have logs. You can edit the backup scripts to check for any keywords like “RMAN-”, “WARNRING”, “ORA-” and if there are any to save them in a separate log. Than use the Log Monitoring in Dynatrace to monitor this log.

---

<div class="post-metadata">

**Author:** ![mn\_24](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mn\_24](https://community.dynatrace.com/u/mn_24)\
**Post date:** [February 11, 2025, 3:24pm UTC](https://community.dynatrace.com/t/samples-threshold-oracle-backup-with-status-failed/48124/5 "2025-02-11T15:24:23Z")

</div>

Hi,

wanted to ask in the last version what do you mean by 5/3/5 alerting strategy - is it related with the violating samples /window or with anything else? Could you please clarify?

 ![mn_24_0-1739287326037.png](https://global.discourse-cdn.com/dynatrace/original/2X/e/e9d20f11f839bbaf313326ec7fd43229ff7ab7fe.png)

[@TomásSeroteRoos](https://community.dynatrace.com/user/55565)

---

<div class="post-metadata">

**Author:** ![Tom\_sSeroteRoos](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@Tom\_sSeroteRoos](https://community.dynatrace.com/u/Tom_sSeroteRoos)\
**Post date:** [February 12, 2025, 9:15am UTC](https://community.dynatrace.com/t/samples-threshold-oracle-backup-with-status-failed/48124/6 "2025-02-12T09:15:36Z")

</div>

Hi [@mn\_24](https://community.dynatrace.com/user/77323),

Yes exactly, it means that the default metric event for failed backups that comes packaged with the extension has adjusted sliding window settings:

 ![TomsSeroteRoos_0-1739351603613.png](https://global.discourse-cdn.com/dynatrace/original/2X/9/9c08fd3fe9962f8abd4a2e125ffad41b7d1a188e.png)
