Oracle
Monitor Oracle Database performance, sessions, I/O operations, and system metrics with OpenTelemetry for comprehensive database observability
Use OpenTelemetry to monitor Oracle Database performance and send telemetry data to Last9. This integration provides comprehensive monitoring of Oracle database performance, including SQL execution, I/O operations, session management, and system resource utilization.
Prerequisites
Before setting up Oracle Database monitoring, ensure you have:
- Oracle Database: Oracle Database 11g or higher installed and running
- Administrative Access: Database administrator privileges to create monitoring users
- OpenTelemetry Collector: v0.147.0 installed on the monitoring server
- Network Access: Connectivity between collector host and Oracle Database on port 1521
- Last9 Account: With OpenTelemetry integration credentials
-
Verify Oracle Database Installation
Ensure Oracle Database is running and accessible:
# Check if Oracle processes are runningps aux | grep ora_# Test database connectivitysqlplus sys/password@localhost:1521/ORCL as sysdba# Check Oracle servicesGet-Service | Where-Object { $_.Name -like "*Oracle*" }# Test connectivitysqlplus sys/password@localhost:1521/ORCL as sysdbaFor Oracle installation, refer to the Oracle Database documentation.
-
Create Oracle Monitoring User
Connect as SYSDBA and create a dedicated read-only monitoring user:
CREATE USER last9_monitor IDENTIFIED BY "YourSecurePassword123!";GRANT CREATE SESSION TO last9_monitor;GRANT SELECT_CATALOG_ROLE TO last9_monitor;GRANT SELECT ON V_$SESSION TO last9_monitor;GRANT SELECT ON V_$SYSSTAT TO last9_monitor;GRANT SELECT ON V_$SYSTEM_EVENT TO last9_monitor;GRANT SELECT ON V_$TABLESPACE TO last9_monitor;GRANT SELECT ON DBA_DATA_FILES TO last9_monitor;GRANT SELECT ON DBA_FREE_SPACE TO last9_monitor;-- VerifySELECT username, account_status FROM dba_users WHERE username = 'LAST9_MONITOR'; -
Install OpenTelemetry Collector
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.147.0/otelcol-contrib_0.147.0_linux_amd64.debsudo dpkg -i otelcol-contrib_0.147.0_linux_amd64.debwget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.147.0/otelcol-contrib_0.147.0_linux_amd64.rpmsudo rpm -ivh otelcol-contrib_0.147.0_linux_amd64.rpm$url = "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.147.0/otelcol-contrib_0.147.0_windows_x64.msi"Invoke-WebRequest -Uri $url -OutFile "otelcol-contrib.msi" -UseBasicParsingStart-Process msiexec.exe -ArgumentList "/i otelcol-contrib.msi /quiet" -Wait -NoNewWindow -
Set Environment Variables
Store the Oracle password as an environment variable rather than hardcoding it in the config.
# For systemd service — add to the service's EnvironmentFileecho 'ORACLE_MONITOR_PASSWORD=YourSecurePassword123!' | sudo tee -a /etc/otelcol-contrib/env# Machine-level — persists across reboots and service restarts[Environment]::SetEnvironmentVariable("ORACLE_MONITOR_PASSWORD", "YourSecurePassword123!", "Machine")# Restart the service to pick up the new variableRestart-Service otelcol-contrib -ErrorAction SilentlyContinue -
Configure OpenTelemetry Collector
Create
/etc/otelcol-contrib/config.yaml:extensions:health_check:pprof:endpoint: localhost:1777receivers:hostmetrics:collection_interval: 60sscrapers:cpu:metrics:system.cpu.logical.count:enabled: truememory:metrics:system.memory.utilization:enabled: truesystem.memory.limit:enabled: trueload:disk:filesystem:metrics:system.filesystem.utilization:enabled: truenetwork:paging:oracledb:endpoint: localhost:1521 # Change to your Oracle host:portservice: ORCL # Use service name (not SID) — query: SELECT value FROM v$parameter WHERE name = 'service_names'username: last9_monitorpassword: ${env:ORACLE_MONITOR_PASSWORD}collection_interval: 60smetrics:oracledb.cpu_time:enabled: trueoracledb.executions:enabled: trueoracledb.logical_reads:enabled: trueoracledb.hard_parses:enabled: trueoracledb.parse_calls:enabled: trueoracledb.pga_memory:enabled: trueoracledb.physical_reads:enabled: trueoracledb.consistent_gets:enabled: trueoracledb.db_block_gets:enabled: trueoracledb.user_commits:enabled: trueoracledb.user_rollbacks:enabled: trueoracledb.enqueue_deadlocks:enabled: trueoracledb.exchange_deadlocks:enabled: trueoracledb.enqueue_locks.usage:enabled: trueoracledb.enqueue_locks.limit:enabled: trueoracledb.dml_locks.usage:enabled: trueoracledb.dml_locks.limit:enabled: trueoracledb.enqueue_resources.usage:enabled: trueoracledb.enqueue_resources.limit:enabled: trueoracledb.sessions.usage:enabled: trueoracledb.sessions.limit:enabled: trueoracledb.processes.usage:enabled: trueoracledb.processes.limit:enabled: trueoracledb.transactions.usage:enabled: trueoracledb.transactions.limit:enabled: trueoracledb.tablespace_size.usage:enabled: trueoracledb.tablespace_size.limit:enabled: trueprocessors:batch:timeout: 10ssend_batch_size: 10000send_batch_max_size: 10000resourcedetection/system:detectors: ["system"]system:hostname_sources: ["os"]resource_attributes:host.ip:enabled: truehost.cpu.model.name:enabled: trueexporters:otlphttp/last9:endpoint: "${env:LAST9_OTLP_ENDPOINT}"headers:"Authorization": "${env:LAST9_OTLP_AUTH}"service:extensions: [health_check, pprof]pipelines:metrics:receivers: [oracledb, hostmetrics]processors: [batch, resourcedetection/system]exporters: [otlphttp/last9]Create
C:\Program Files\OpenTelemetry Collector\config.yaml:extensions:health_check:pprof:endpoint: localhost:1777zpages:endpoint: 0.0.0.0:55679receivers:# Collector self-logs from Windows Application Event Logwindowseventlog/collector:query: |<QueryList><Query Id="0" Path="Application"><Select Path="Application">*[System[Provider[@Name="OpenTelemetry Collector Contrib"]]]</Select></Query></QueryList>hostmetrics:collection_interval: 60sscrapers:cpu:metrics:system.cpu.logical.count:enabled: truememory:metrics:system.memory.utilization:enabled: truesystem.memory.limit:enabled: trueload:disk:filesystem:metrics:system.filesystem.utilization:enabled: truenetwork:paging:process:mute_process_user_error: truemute_process_io_error: truemute_process_exe_error: trueinclude:names: ["otelcol-contrib"]match_type: regexpmetrics:process.cpu.utilization:enabled: trueprocess.memory.utilization:enabled: trueprocess.threads:enabled: trueoracledb:endpoint: localhost:1521 # Change to your Oracle host:portservice: ORCL # Use service name (not SID) — query: SELECT value FROM v$parameter WHERE name = 'service_names'username: last9_monitorpassword: ${env:ORACLE_MONITOR_PASSWORD}collection_interval: 60smetrics:oracledb.cpu_time:enabled: trueoracledb.executions:enabled: trueoracledb.logical_reads:enabled: trueoracledb.hard_parses:enabled: trueoracledb.parse_calls:enabled: trueoracledb.pga_memory:enabled: trueoracledb.physical_reads:enabled: trueoracledb.consistent_gets:enabled: trueoracledb.db_block_gets:enabled: trueoracledb.user_commits:enabled: trueoracledb.user_rollbacks:enabled: trueoracledb.enqueue_deadlocks:enabled: trueoracledb.exchange_deadlocks:enabled: trueoracledb.enqueue_locks.usage:enabled: trueoracledb.enqueue_locks.limit:enabled: trueoracledb.dml_locks.usage:enabled: trueoracledb.dml_locks.limit:enabled: trueoracledb.enqueue_resources.usage:enabled: trueoracledb.enqueue_resources.limit:enabled: trueoracledb.sessions.usage:enabled: trueoracledb.sessions.limit:enabled: trueoracledb.processes.usage:enabled: trueoracledb.processes.limit:enabled: trueoracledb.transactions.usage:enabled: trueoracledb.transactions.limit:enabled: trueoracledb.tablespace_size.usage:enabled: trueoracledb.tablespace_size.limit:enabled: trueprocessors:batch:timeout: 10ssend_batch_size: 10000send_batch_max_size: 10000resourcedetection/system:detectors: ["system"]system:hostname_sources: ["os"]resource_attributes:host.ip:enabled: truehost.cpu.model.name:enabled: trueresource/collector_logs:attributes:- key: service.namevalue: otel-collectoraction: upsert- key: sourcevalue: windows-event-logaction: upsertexporters:otlphttp/last9:endpoint: "${env:LAST9_OTLP_ENDPOINT}"headers:"Authorization": "${env:LAST9_OTLP_AUTH}"service:extensions: [health_check, pprof, zpages]pipelines:metrics:receivers: [oracledb, hostmetrics]processors: [batch, resourcedetection/system]exporters: [otlphttp/last9]logs:receivers: [windowseventlog/collector]processors: [batch, resourcedetection/system, resource/collector_logs]exporters: [otlphttp/last9] -
Start and Enable the Service
sudo systemctl daemon-reloadsudo systemctl enable otelcol-contribsudo systemctl start otelcol-contribsudo systemctl status otelcol-contribSet-Service -Name otelcol-contrib -StartupType AutomaticStart-Service otelcol-contribGet-Service otelcol-contrib
Verification
-
Check Service Status
sudo systemctl status otelcol-contribsudo journalctl -u otelcol-contrib -fGet-Service otelcol-contrib# View recent logs from Windows Event LogGet-EventLog -LogName Application -Source "OpenTelemetry Collector Contrib" -Newest 20 -
Test Oracle Connectivity
-- Connect with monitoring user and verify view accesssqlplus last9_monitor/password@localhost:1521/ORCLSELECT COUNT(*) FROM V$SESSION;SELECT COUNT(*) FROM V$SYSSTAT;SELECT COUNT(*) FROM DBA_TABLESPACES; -
Verify Metrics in Last9
Log into your Last9 account and check that Oracle metrics are being received in Grafana.
Look for metrics like:
oracledb_sessions_usageoracledb_physical_readsoracledb_consistent_getsoracledb_cpu_timeoracledb_tablespace_size_usage
Key Metrics to Monitor
Sessions and Connections
| Metric | Description | Alert Threshold |
|---|---|---|
oracledb.sessions.usage | Active database sessions | > 80% of sessions.limit |
oracledb.sessions.limit | Maximum allowed sessions | Reference value |
oracledb.processes.usage | Current Oracle processes | > 80% of processes.limit |
oracledb.transactions.usage | Active transactions | > 80% of transactions.limit |
I/O and Buffer Cache
| Metric | Description | Alert Threshold |
|---|---|---|
oracledb.physical_reads | Physical disk reads | High growth rate |
oracledb.consistent_gets | Logical reads (buffer cache) | Track ratio vs physical_reads |
oracledb.db_block_gets | Current mode block reads | Baseline monitoring |
oracledb.logical_reads | Total logical reads | Baseline monitoring |
SQL Execution
| Metric | Description | Alert Threshold |
|---|---|---|
oracledb.executions | SQL executions per interval | Baseline monitoring |
oracledb.hard_parses | Hard parses (full SQL compilation) | Rising trend |
oracledb.parse_calls | Total parse calls | Track hard/soft ratio |
oracledb.cpu_time | Database CPU time | > 80% sustained |
Locks and Deadlocks
| Metric | Description | Alert Threshold |
|---|---|---|
oracledb.enqueue_deadlocks | Deadlock events | > 0 |
oracledb.exchange_deadlocks | Exchange deadlocks | > 0 |
oracledb.enqueue_locks.usage | Enqueue locks in use | > 80% of limit |
oracledb.dml_locks.usage | DML locks in use | > 80% of limit |
Storage
| Metric | Description | Alert Threshold |
|---|---|---|
oracledb.tablespace_size.usage | Tablespace bytes used | > 80% of limit |
oracledb.tablespace_size.limit | Tablespace max size | Reference value |
oracledb.pga_memory | PGA memory in use | > 80% of target |
Troubleshooting
Connection Issues
ORA-12154: TNS could not resolve the connect identifier
Use the full service name, not the SID:
-- Find the correct service nameSELECT value FROM v$parameter WHERE name = 'service_names';Set service: in the config to that value (e.g., ORCL.domain.com).
Authentication errors:
SELECT username, account_status FROM dba_users WHERE username = 'LAST9_MONITOR';SELECT * FROM dba_sys_privs WHERE grantee = 'LAST9_MONITOR';Windows-Specific
Service not starting:
# Check Windows Event Log for errorsGet-EventLog -LogName Application -Source "OpenTelemetry Collector Contrib" -Newest 10 | Format-List
# Validate config before starting& "C:\Program Files\OpenTelemetry Collector\otelcol-contrib.exe" validate --config "C:\Program Files\OpenTelemetry Collector\config.yaml"Environment variable not picked up:
# Verify it's set at Machine level (not just current session)[Environment]::GetEnvironmentVariable("ORACLE_MONITOR_PASSWORD", "Machine")
# Restart service after setting to reload envRestart-Service otelcol-contribMissing Metrics
No metrics appearing:
-- Verify statistics_level allows V$ view accessSELECT VALUE FROM V$PARAMETER WHERE NAME = 'statistics_level';
-- Should return TYPICAL or ALL (not BASIC)Invalid keys error on startup: The metrics: block is a strict allowlist — any key not in the receiver’s metadata.yaml at your version causes a hard startup failure. Use only the metric names listed in the configuration above.
Need Help?
If you encounter any issues or have questions:
- Join our Discord community for real-time support
- Contact our support team at support@last9.io