Enterprise Grafana Cloud
Last reviewed: May 22, 2026

Oracle annotations

Annotations allow you to mark points on a graph with events from your Oracle database. Use annotations to overlay deployment times, incidents, or other significant events on your time-series visualizations.

For general information on Grafana annotations, refer to Annotate visualizations.

Before you begin

Create an annotation query

To add Oracle annotations to a dashboard:

  1. Open your dashboard and click the gear icon to access Dashboard settings.
  2. Select Annotations from the left menu.
  3. Click Add annotation query.
  4. Select the Oracle data source.
  5. Write a SQL query that returns the required columns.
  6. Click Save dashboard.

Required columns

Your annotation query must return columns with specific names that Grafana recognizes. Use the AS keyword to alias your columns appropriately.

Column nameTypeRequiredDescription
timedatetime or Unix epochYesThe timestamp for the annotation.
timeEnddatetime or Unix epochNoEnd time for region annotations (creates a shaded range instead of a vertical line).
textvarcharYesThe annotation text displayed on hover.
tagsvarcharNoComma-separated tags for filtering annotations.

Example queries

Event markers from an audit table

SQL
SELECT
  event_time AS time,
  event_description AS text,
  event_type AS tags
FROM audit_events
WHERE $__timeFilter(event_time)
ORDER BY event_time

Deployment annotations

SQL
SELECT
  deploy_time AS time,
  'Deployed ' || version || ' to ' || environment AS text,
  'deployment,' || environment AS tags
FROM deployments
WHERE $__timeFilter(deploy_time)
ORDER BY deploy_time

Threshold crossing events

SQL
SELECT
  check_time AS time,
  metric_name || ' exceeded threshold: ' || TO_CHAR(metric_value) AS text,
  'threshold,' || metric_name AS tags
FROM threshold_violations
WHERE $__timeFilter(check_time)
ORDER BY check_time

Region annotations (start and end time)

Use timeEnd to create shaded regions that span a time range, such as maintenance windows or incidents:

SQL
SELECT
  start_time AS time,
  end_time AS timeEnd,
  'Maintenance: ' || description AS text,
  'maintenance,' || system_name AS tags
FROM maintenance_windows
WHERE $__timeFilter(start_time)
ORDER BY start_time

Use macros in annotations

You can use the same macros available in the query editor within annotation queries. The $__timeFilter macro is particularly important to scope annotations to the dashboard time range:

SQL
SELECT
  event_time AS time,
  message AS text,
  category AS tags
FROM system_events
WHERE $__timeFilter(event_time)
  AND severity = 'CRITICAL'
ORDER BY event_time

Template variables are also supported in annotation queries, allowing you to filter annotations dynamically:

SQL
SELECT
  event_time AS time,
  message AS text,
  category AS tags
FROM system_events
WHERE $__timeFilter(event_time)
  AND hostname = '$hostname'
ORDER BY event_time

Next steps