Oracle Database measures itself in detail. The numbers sit in the V$ views, in
Enterprise Manager and in AWR reports, and that is where they stay. The team that runs
Grafana for everything else sees the database as a host with CPU and disks, and nothing
of what happens inside it.
The OpenTelemetry Collector has a receiver that reads those views over a normal database connection and turns them into metrics. This guide sets it up: a monitoring user, the collector configuration, the alert log, and the same pattern for SQL Server and SAP HANA.
Database administrators and platform teams that run Oracle Database on their own infrastructure and use Grafana, or plan to. You need the right to create a database user, a host that can reach the listener, and a Grafana target (Grafana Cloud’s free tier is fine).
What you’ll have when you’re done
- Sessions, processes, transactions and locks against their limits, with history, so you see a limit coming before the database refuses connections.
- Tablespace usage per tablespace, next to its maximum size.
- Workload counters: executions, parses and hard parses, logical and physical reads, commits and rollbacks, CPU time.
- The alert log searchable in one place, across all databases.
- Optionally, top queries and wait events as log records.
How it maps to what you already use
Nothing here is a new measurement. It is what Oracle already records, sent to Grafana:
| You know it as… | Oracle keeps it in… | The metric is called |
|---|---|---|
| Sessions and processes against their limits | V$SESSION, V$RESOURCE_LIMIT |
oracledb.sessions.usage, oracledb.sessions.limit, oracledb.processes.usage, oracledb.processes.limit |
| Tablespace usage in Enterprise Manager | DBA_TABLESPACE_USAGE_METRICS, DBA_TABLESPACES |
oracledb.tablespace_size.usage, oracledb.tablespace_size.limit |
| The load profile of an AWR report | V$SYSSTAT |
oracledb.executions, oracledb.hard_parses, oracledb.logical_reads, oracledb.physical_reads, oracledb.user_commits |
| Locks and deadlocks | V$RESOURCE_LIMIT, V$SYSSTAT |
oracledb.dml_locks.usage, oracledb.enqueue_deadlocks |
| The alert log | alert_<SID>.log in the diagnostic repository |
Log records |
Figure 1. The receiver is a database client. Only the alert log needs a collector on the database host.
Step 1 — Create a monitoring user
The receiver needs a user that can log in and read a handful of views. These grants cover the metrics that are on by default and the instance details the receiver adds to every metric:
CREATE USER otel IDENTIFIED BY "<password>";
GRANT CREATE SESSION TO otel;
GRANT SELECT ON V_$SESSION TO otel;
GRANT SELECT ON V_$SYSSTAT TO otel;
GRANT SELECT ON V_$RESOURCE_LIMIT TO otel;
GRANT SELECT ON V_$OSSTAT TO otel;
GRANT SELECT ON V_$SGAINFO TO otel;
GRANT SELECT ON DBA_TABLESPACES TO otel;
GRANT SELECT ON DBA_DATA_FILES TO otel;
GRANT SELECT ON DBA_TABLESPACE_USAGE_METRICS TO otel;
GRANT SELECT ON V_$INSTANCE TO otel;
GRANT SELECT ON V_$DATABASE TO otel;
In a multitenant database, create the user in the pluggable database you connect to. To see every pluggable database from the container root, the receiver needs a common user and container-wide grants. The receiver’s README lists them, together with the grants for ASM and for Amazon RDS.
Step 2 — Install the collector where it can reach the listener
The receiver is a database client. It connects to the listener like any application, so the collector does not have to run on the database host. One collector on a monitoring host can watch several databases. The alert log in Step 4 is the exception, because it is a file.
Install the contrib distribution from the official releases. The Oracle receiver ships there. Its driver is written in Go, so you do not install an Oracle client. Pin the release you install. The examples below follow the receiver’s documentation for contrib v0.165.0.
Step 3 — Configure the receiver
receivers:
oracledb:
endpoint: db01.example.internal:1521
service: ORCLPDB1
username: otel
password: ${env:ORACLE_PASSWORD}
collection_interval: 60s
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 25
exporters:
otlphttp/grafana: # where the data goes: paste your values here
endpoint: "https://otlp-gateway-<zone>.grafana.net/otlp"
headers:
Authorization: "Basic <base64 of instanceID:token>"
sending_queue:
enabled: true
batch:
enabled: true
service:
pipelines:
metrics:
receivers: [oracledb]
processors: [memory_limiter]
exporters: [otlphttp/grafana]
endpointandserviceare the listener address and the service name, the same values an application uses.passwordcomes from an environment variable and never sits in the file. See managing secrets in collector config.collection_intervaldefaults to 10 seconds. One minute is enough for capacity metrics and sends fewer queries to the database.exportersis the destination. In Grafana Cloud you find both values under Connections → OTLP.
Self-hosting Grafana? Replace the exporter with prometheusremotewrite to Prometheus
or Mimir. Nothing else changes.
Two more things are worth knowing. The receiver has 25 metrics switched on and about
110 more that you enable by name, for example for ASM disk groups or the SGA. And one
collector can watch several databases: add one receiver per database, named
oracledb/erp, oracledb/crm and so on, and list them all in the pipeline.
Step 4 — Add the alert log
The alert log is a text file in the diagnostic repository. To find the directory, ask the database:
SELECT value FROM v$diag_info WHERE name = 'Diag Trace';
A collector on the database host reads the file with the filelog receiver:
extensions:
file_storage:
directory: /var/lib/otelcol/storage
create_directory: true
receivers:
filelog/oracle-alert:
include:
- /u01/app/oracle/diag/rdbms/*/*/trace/alert_*.log
start_at: end
storage: file_storage
multiline:
line_start_pattern: '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}'
service:
extensions: [file_storage]
pipelines:
logs:
receivers: [filelog/oracle-alert]
processors: [memory_limiter]
exporters: [otlphttp/grafana]
multilinekeeps an entry together. Since Oracle Database 12.2 every entry starts with a timestamp line, followed by one or more message lines. Older releases write the timestamp in another format, so adjust the pattern there.storageremembers how far the file was read, so a restart does not send the log twice.- The user the collector runs as needs read access to that directory.
Step 5 — Check that it works
- Run
otelcol-contrib validate --config config.yaml. It reports a typo before the service starts. - Start the collector and read its own log. A wrong password or a missing grant shows
up there as an
ORA-error within the first interval. - Open Grafana → Explore, pick your metrics data source and search for
oracledb. The names arrive with underscores, for exampleoracledb_sessions_usage. - Switch to Loki and search the alert log for
ORA-.
Step 6 — Build the dashboard
Six panels answer most of what an on-call administrator asks first:
- Sessions and processes against their limit.
oracledb.sessions.usageoveroracledb.sessions.limit, and the same pair for processes. Alert well before 100 %. A limit of-1means unlimited. - Tablespace used.
oracledb.tablespace_size.usageoveroracledb.tablespace_size.limit, per tablespace. - Hard parses. The rate of
oracledb.hard_parsesnext tooracledb.parse_calls. A high share of hard parses usually points to statements without bind variables. - Logical and physical reads.
oracledb.logical_readsandoracledb.physical_readsas rates. - Commits and rollbacks.
oracledb.user_commitsandoracledb.user_rollbacks. - Deadlocks. Any increase of
oracledb.enqueue_deadlocksdeserves a look.
Add a logs panel with the ORA- lines of the alert log under them, and the first
question after an alert is answered on the same screen.
Step 7 — Optional: top queries and wait events
The receiver can also report the most expensive queries, samples of running queries, wait events per session and the top stored procedures. These arrive as log records, they are switched off by default, and the receiver rates them as in development:
receivers:
oracledb:
# connection settings as in Step 3
events:
db.server.top_query:
enabled: true
db.server.session.wait_sample:
enabled: true
They need more grants, among them V_$SQL, V_$SQL_PLAN_STATISTICS_ALL and
V_$SESSION_EVENT. The receiver obfuscates the SQL text before it reports it. Look at
a sample anyway before you send these records to a shared backend, and
mask what should not leave.
The same pattern for SQL Server and SAP HANA
- SQL Server. The
sql_serverreceiver (sqlserverin older releases) is rated beta for metrics. It reads Windows performance counters on the host, or connects directly withserver,port,usernameandpassword. A direct connection needs the right to see the databases and the server state:VIEW SERVER STATE, orVIEW SERVER PERFORMANCE STATEfrom SQL Server 2022. The counter route is described in Monitor Windows Server with OpenTelemetry and Grafana. - SAP HANA. The
saphanareceiver is rated alpha and is meant for HANA 2. It needs a restricted user with read access to the monitoring views. Its README has the script. - Everything else. The
sqlqueryreceiver runs your own SQL and turns columns into metrics or log records. It has drivers for Oracle, SQL Server, SAP HANA, SAP ASE, PostgreSQL, MySQL, Snowflake and ClickHouse.
Step 8 — Many databases: manage the collectors with LinkMesh
One database is a file you edit. Twenty databases in test and production, each with its own credentials and a collector on each database host for the alert log, are a fleet. Editing YAML over SSH on every host is where such a setup starts to drift.
The collector speaks OpAMP, so it can be managed centrally. LinkMesh is a self-hosted control plane for exactly this. You enrol each collector with a token and put the database hosts into collector groups that share a configuration. Where the source catalog has no template for a receiver, you add it as a custom source: you write the receiver’s settings as YAML once, and LinkMesh places them in the generated configuration and rolls it out. Every change is previewed, versioned and audited.
The telemetry still flows straight from each collector to Grafana and stays on your network. LinkMesh only manages the configuration, and it is priced per managed collector, not per gigabyte.
Troubleshooting
ORA-01017(invalid username or password). If you use thedatasourceform of the configuration, special characters in the password must be URL-encoded. With the separatepasswordfield they are allowed as they are.ORA-12514(listener does not know the service).servicetakes the service name, not the SID.lsnrctl statuslists the services.ORA-00942(table or view does not exist). A grant from Step 1 is missing.- No tablespace metrics. The three
DBA_grants are missing. - Different limits on a pluggable database. Connected directly to a pluggable database, the receiver reads the limits for transactions and DML locks from another view than at the container root, and the values can differ.
Two limits to keep in mind. In contrib v0.165.0 the receiver is rated alpha for metrics, so names and settings can change between releases. Pin the version and read the release notes before you upgrade, as described in keeping a collector fleet up to date. And it does not replace AWR or Enterprise Manager for diagnosis. It puts the health of the database next to the rest of your estate, so the first look happens in one place.
LinkMesh manages the collector on every host from one self-hosted control plane: define the source once, preview the configuration and deploy it over OpAMP, with an audited rollout, priced per collector rather than per gigabyte. Stand one up in minutes, or see what it does.