Enterprise Grafana Cloud
Last reviewed: May 22, 2026

Configure the Oracle data source

This document explains how to configure the Oracle data source in Grafana.

Before you begin

Before configuring the data source, ensure you have:

  • Grafana permissions: Organization administrator role.
  • Oracle Database access: An Oracle user with SELECT permissions on the tables you want to query.
  • Plugin installed: The Oracle plugin must be installed. Refer to Install and upgrade the Oracle data source plugin for installation instructions.

Note

When adding a data source, ensure the database user you specify has only SELECT permissions on the relevant database and tables you want to query. Grafana does not validate the safety of queries, which means they can include potentially harmful SQL statements such as DROP TABLE user; or DELETE FROM user;. To minimize this risk, Grafana strongly recommends creating a dedicated Oracle Database user with restricted permissions.

Create a least-privilege database user

Create a dedicated Oracle user for Grafana with minimal permissions:

SQL
CREATE USER grafana_reader IDENTIFIED BY "<strong_password>";

GRANT CREATE SESSION TO grafana_reader;

GRANT SELECT ON schema_name.table_name TO grafana_reader;

To grant read access to all tables in a schema:

SQL
BEGIN
  FOR t IN (SELECT table_name FROM all_tables WHERE owner = 'SCHEMA_NAME') LOOP
    EXECUTE IMMEDIATE 'GRANT SELECT ON SCHEMA_NAME.' || t.table_name || ' TO grafana_reader';
  END LOOP;
END;
/

For monitoring dashboards that query system views (V$ views, DBA_ views), grant the appropriate roles:

SQL
GRANT SELECT_CATALOG_ROLE TO grafana_reader;

Caution

SELECT_CATALOG_ROLE grants read access to all data dictionary views. For tighter security, grant access to individual views instead (for example, GRANT SELECT ON V_$SYSSTAT TO grafana_reader).

Key concepts

If you’re new to Oracle Database connectivity, these terms are used throughout the configuration:

TermDescription
TNSNamesA file-based naming method (tnsnames.ora) that maps connection identifiers to Oracle Net connection descriptors.
Connection poolA cache of database connections maintained for reuse, reducing the overhead of creating new connections for each query.
PDCPrivate data source connect, a Grafana Cloud feature that establishes a private, secured connection to data sources in a private network.
Prefetch rowsThe number of rows buffered from the database after each query execution, improving performance for large result sets.

Add the data source

To add the Oracle data source:

  1. Click Connections in the left-side menu.
  2. Click Add new connection.
  3. Type Oracle in the search bar.
  4. Select Oracle Database.
  5. Click Add new data source.

Configure settings

The following settings are available on the data source configuration page.

SettingDescription
NameThe display name for this data source in panels and queries.
DefaultToggle to make this the default data source for new panels.

Connection

You can connect to Oracle using two connection methods.

MethodBest forGrafana Cloud
Host with TCP PortAny deploymentSupported
TNSNames EntrySelf-managed EnterpriseNot supported

Host with TCP Port

Connect using a hostname or IP address with the TCP port number.

SettingDescription
HostThe hostname or IP address with TCP port number (for example, oracle-server:1521).
DatabaseThe name of the Oracle database or service name.

TNSNames Entry

Specify a tnsnames.ora entry for connection. This method requires the tnsnames.ora file to be present on the Grafana server.

Note

TNSNames is not supported in Grafana Cloud. Use Host with TCP Port and Private data source connect instead.

SettingDescription
TNSNameThe connection identifier as specified in the tnsnames.ora file.

Authentication

The data source supports two authentication methods. The available methods depend on your connection type.

Basic authentication

Basic authentication is available with both connection methods. Authenticate using an Oracle username and password.

SettingDescription
UserThe Oracle username with access to the database.
PasswordThe Oracle password for the specified user.

Kerberos authentication

Kerberos authentication requires a TNSNames connection and server-side Kerberos configuration.

Note

Kerberos authentication is not supported in Grafana Cloud.

Kerberos must be configured in the tnsnames.ora and sqlnet.ora files. Refer to Kerberos integration for configuration parameters.

Additional settings

SettingDescriptionDefault
TimezoneThe timezone of the Oracle server, selected from a drop-down.UTC
Secure Socks ProxyProxy the data source connection through a secure socks proxy. Only visible when the secureSocksDSProxyEnabled feature toggle is enabled and Grafana is version 10.0 or later. Timezone configuration is ignored when enabled, and Kerberos authentication is not guaranteed.Disabled
Connection Pool SizeMaximum number of connections in the pool. Overrides the GF_PLUGINS_ORACLE_DATASOURCE_POOLSIZE environment variable when set.50
Dataproxy TimeoutMaximum time in seconds to wait for a query response. Overrides the GF_DATAPROXY_TIMEOUT environment variable when set.120
Prefetch Row SizeNumber of rows buffered after each query execution. Higher values improve performance for large result sets. Refer to Oracle prefetch documentation for details.Not set
Row LimitMaximum number of rows returned per query. Queries exceeding this limit return a truncated result.1000000

Connection pool behavior

The Oracle plugin maintains a pool of persistent TCP connections to the database. Understanding how the pool works helps you tune the Connection Pool Size for your workload:

  • Lazy creation: Connections are created on demand as queries arrive, not all at once when the data source is configured.
  • Reuse: After a query completes, the connection returns to the pool for the next query.
  • Pool exhaustion: If all connections are in use, new queries wait until a connection becomes available. Under sustained load this can cause query timeouts. Increase the pool size or reduce dashboard concurrency.
  • Idle connections: Idle connections remain open indefinitely. Some network appliances or Oracle configurations may close idle connections (causing “connection reset by peer”). Configure Oracle’s SQLNET.EXPIRE_TIME to send keep-alive probes.
  • One pool per data source: Each configured Oracle data source instance has its own independent pool. If you have three Oracle data sources, Grafana maintains three separate pools.

Sizing guidance:

Dashboard concurrencyRecommended pool size
Low (1-5 concurrent users)10-25
Medium (5-20 concurrent users)25-75
High (20+ concurrent users, auto-refresh)75-150

Monitor the Oracle V$SESSION view to observe how many sessions Grafana actually opens:

SQL
SELECT COUNT(*) FROM V$SESSION WHERE USERNAME = 'GRAFANA_READER';

Private data source connect

For Grafana Cloud users connecting to databases in a private network, Private data source connect (PDC) establishes a secured connection between your Grafana Cloud instance and your private Oracle database.

Refer to Private data source connect for setup instructions.

Verify the connection

Click Save & test to verify the connection. On success, Grafana displays a message with your Oracle version banner, for example: Success: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production. If the connection fails, refer to Troubleshoot connection errors.

Provision the data source

You can define the data source in YAML files as part of the Grafana provisioning system. For more information, refer to Provision Grafana.

TCP connection with basic authentication

YAML
apiVersion: 1
datasources:
  - name: Oracle
    type: grafana-oracle-datasource
    access: proxy
    url: <HOST>:<PORT>
    jsonData:
      database: <DATABASE>
      user: <USERNAME>
      timezone_name: UTC
      connectionPoolSize: 50
      dataProxyTimeout: 120
      prefetchRowsCount: 100
      rowLimit: 1000000
    secureJsonData:
      password: <PASSWORD>

TNSNames connection with basic authentication

YAML
apiVersion: 1
datasources:
  - name: Oracle (TNS)
    type: grafana-oracle-datasource
    access: proxy
    jsonData:
      timezone_name: UTC
      useTNSNamesBasedConnection: true
      tnsNamesEntry: <TNSNAME>
      useKerberosAuthentication: false
      user: <USERNAME>
    secureJsonData:
      password: <PASSWORD>

Terraform

You can provision the Oracle data source using the Grafana Terraform provider:

hcl
resource "grafana_data_source" "oracle" {
  type = "grafana-oracle-datasource"
  name = "Oracle"
  url  = "<HOST>:<PORT>"

  json_data_encoded = jsonencode({
    database           = "<DATABASE>"
    user               = "<USERNAME>"
    timezone_name      = "UTC"
    connectionPoolSize = 50
    dataProxyTimeout   = 120
    prefetchRowsCount  = 100
    rowLimit           = 1000000
  })

  secure_json_data_encoded = jsonencode({
    password = "<PASSWORD>"
  })
}

Manage multiple Oracle data sources

Each Oracle database requires its own data source configuration in Grafana. The plugin doesn’t support dynamic connection switching via template variables. You can’t use a single data source to query different databases based on a dashboard variable.

For environments with many Oracle databases, use automated provisioning to manage data sources at scale.

  1. Use Terraform for provisioning. Define data sources as Terraform resources with variables for database-specific values:

    hcl
    variable "oracle_databases" {
      type = map(object({
        host     = string
        port     = number
        database = string
        user     = string
        password = string
      }))
    }
    
    resource "grafana_data_source" "oracle" {
      for_each = var.oracle_databases
    
      type = "grafana-oracle-datasource"
      name = "Oracle - ${each.key}"
      url  = "${each.value.host}:${each.value.port}"
    
      json_data_encoded = jsonencode({
        database           = each.value.database
        user               = each.value.user
        timezone_name      = "UTC"
        connectionPoolSize = 50
        dataProxyTimeout   = 120
        rowLimit           = 1000000
      })
    
      secure_json_data_encoded = jsonencode({
        password = each.value.password
      })
    }
  2. Use consistent naming conventions. Adopt a pattern like Oracle - <environment> - <service> (for example, Oracle - prod - inventory) so users can find the correct data source using the data source selector or the built-in datasource template variable.

  3. Use the Grafana HTTP API. For CI/CD pipelines, you can create data sources programmatically using the Data source API.

  4. Use the data source template variable. Create a datasource type variable filtered to grafana-oracle-datasource to let users switch between Oracle databases within a single dashboard.

Environment variables

You can configure additional Oracle data source settings using environment variables or the Grafana configuration file (grafana.ini).

Note

Environment variables are not supported in Grafana Cloud.

VariableDescriptionDefault
GF_PLUGINS_ORACLE_DATASOURCE_MAX_RESPONSE_SIZEMaximum query response size in MB.16 (max 512)
GF_PLUGINS_ORACLE_DATASOURCE_POOLSIZEConnection pool size.50
GF_DATAPROXY_TIMEOUTQuery and health check timeout in seconds.120

Example:

Bash
export GF_PLUGINS_ORACLE_DATASOURCE_MAX_RESPONSE_SIZE=32
export GF_PLUGINS_ORACLE_DATASOURCE_POOLSIZE=100

Alternatively, configure these parameters in grafana.ini under the [plugin.grafana-oracle-datasource] section:

ini
[plugin.grafana-oracle-datasource]
oracle_datasource_poolsize = 50
oracle_datasource_max_response_size = 16