Configure the Oracle data source
Grafana provides a number of configuration options for the Oracle data source. For general information on installing a data source, refer to Install Grafana plugins. For general information on adding a data source, refer to Add a data source.
Before you begin
You must have the Organization Administrator
role to add data sources. Administrators can also configure the data source via YAML with Grafana’s provisioning system.
In order to add the Oracle data source you must first install the Oracle plugin. Refer to Installation on the Oracle plugin page 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 asDROP TABLE user;
orDELETE FROM user;
, which could get executed. To minimize this risk, Grafana strongly recommends creating a dedicated Oracle Database user with restricted permissions.
Configure the data source
To add the Oracle data source, complete the following steps:
- Install the Oracle plugin.
- Click Connections in the left-side menu.
- Under Connections, click Add new connection.
- Enter Oracle in the search bar.
- Select Oracle Database under the Data Source section.
- Click Add new data source in the upper right.
You are taken to the Settings tab where you will set up your Oracle configuration.
Configuration options
Following is a list configuration options for Oracle.
- Name - The data source name. This is how you refer to the data source in panels and queries. Examples: Oracle Database-1, Oracle-DB-Sales.
- Default - Toggle to make this Oracle data source the default pre-selected data source in panels and visualizations.
Connection:
You can connect to Oracle via 2 different connection methods, depending on whether you have an on-premise or cloud account.
Host with TCP Port - Connect with a hostname or IP address with the TCP port number.
Host - Enter the hostname or IP address with TCP port number.
Database - Enter the name of the database.
TNSNames Entry - Enterprise only. Specify a tnsnames.ora entry for connection. This is not available in Grafana Cloud.
- TNSName - Use configuration connection specified in the
tnsnames.ora
file.
- TNSName - Use configuration connection specified in the
Authentication:
There are 2 authentication methods you can choose in the drop-down. Authentication methods depend on your connection method.
Basic authentication -The only authentication available with the Host with TCP Port connection method. Authenticate with a username and password.
User - The Oracle username with access to the specified database.
Password - The Oracle password with access to the specified database.
Kerberos Authentication - Not supported in Grafana Cloud. Kerberos authentication only works with TNSNames enabled, and must be configured in the
tnsnames.ora
configuration file. Refer to Kerberos integration for configuration parameters. Follow Oracle’s documentation Configuring Kerberos Authentication to integrate Oracle with Kerberos.
Additional settings:
- Timezone - Select the default timezone of the Oracle server in UTC from the drop-down.
Private data source connect (PDC):
- Private data source connect: - Only for Grafana Cloud users. Private data source connect, or PDC, allows you to establish a private, secured connection between a Grafana Cloud instance, or stack, and data sources secured within a private network. Click the drop-down to locate the URL for PDC. Refer to Private data source connect for more information on how PDC works and Configure Grafana private data source connect (PDC) for steps on setting up a PDC connection.
Click Manage private data source connect to be taken to your PDC connection page, where you’ll find your PDC configuration details.
Once you have configured your Oracle data source options, click Save & test at the bottom to test out your data source connection. You can also remove a connection by clicking Delete.
Configure the data source with provisioning
You can define and configure the Oracle data source in YAML files as part of Grafana’s provisioning system. For more information about provisioning a data source, and for available configuration options, refer to Provision Grafana.
Following are provisioning examples for the Oracle data source.
TNSNames enabled with basic auth:
apiVersion: 1
datasources:
- name: Oracle (TNS-BASICAUTH)
type: grafana-oracle-datasource
access: proxy
basicAuth: false
editable: true
jsonData:
timezone_name: UTC
useKerberosAuthentication: false
useTNSNamesBasedConnection: true
user: USERNAME
secureJsonData:
password: PASSWORD
url: TNSNAME
version: 1
TNSNames disabled with basic auth:
apiVersion: 1
datasources:
- name: Oracle (Integration)
type: grafana-oracle-datasource
access: proxy
basicAuth: false
editable: true
jsonData:
database: DATABASE
user: USERNAME
secureJsonData:
password: PASSWORD
url: HOST
version: 1
Other configurations
You can adjust the Oracle datasource connection details using environment variables or updating the Grafana Server configuration file.
Note
Environment variables are not supported in Grafana Cloud.
Max response size
You can set GF_PLUGINS_ORACLE_DATASOURCE_MAX_RESPONSE_SIZE
in your environment variable to change query response data size. The default is 16
, the maximum is 512
.
export GF_PLUGINS_ORACLE_DATASOURCE_MAX_RESPONSE_SIZE=<number>
Connection pool size
You can set GF_PLUGINS_ORACLE_DATASOURCE_POOLSIZE
in your environment variable to change connection pool size. The default value is 50
export GF_PLUGINS_ORACLE_DATASOURCE_POOLSIZE=<number>
Alternatively, you can configure these parameters on the Grafana configuration file grafana.ini
under the [plugins]
section.
[plugins]
oracle_datasource_poolsize = 50
oracle_datasource_max_response_size = 16