1---
2layout: "docs"
3page_title: "Oracle - Database - Secrets Engines"
4sidebar_title: "Oracle"
5sidebar_current: "docs-secrets-databases-oracle"
6description: |-
7  Oracle is one of the supported plugins for the database secrets engine. This
8  plugin generates database credentials dynamically based on configured roles
9  for the Oracle database.
10---
11
12# Oracle Database Secrets Engine
13
14Oracle is one of the supported plugins for the database secrets engine. This
15plugin generates database credentials dynamically based on configured roles for
16the Oracle database.
17
18The Oracle database plugin is not bundled in the core Vault code tree and can be
19found at its own git repository here:
20[hashicorp/vault-plugin-database-oracle](https://github.com/hashicorp/vault-plugin-database-oracle)
21
22See the [Database Backend](/docs/secrets/databases/index.html) docs for more
23information about setting up the Database Backend.
24
25## Setup
26
27The Oracle Database Plugin does not live in the core Vault code tree and can be found
28at its own git repository here: [hashicorp/vault-plugin-database-oracle](https://github.com/hashicorp/vault-plugin-database-oracle)
29
30For linux/amd64, pre-built binaries can be found at [the releases page](https://releases.hashicorp.com/vault-plugin-database-oracle)
31
32Before running the plugin you will need to have the the Oracle Instant Client
33library installed. These can be downloaded from Oracle. The libraries will need to
34be placed in the default library search path or defined in the ld.so.conf configuration files.
35
36If you are running Vault with [mlock enabled](/docs/configuration/index.html#disable_mlock),
37you will need to enable ipc_lock capabilities for the plugin binary.
38
391. Enable the database secrets engine if it is not already enabled:
40
41    ```text
42    $ vault secrets enable database
43    Success! Enabled the database secrets engine at: database/
44    ```
45
46    By default, the secrets engine will enable at the name of the engine. To
47    enable the secrets engine at a different path, use the `-path` argument.
48
491. Download and register the plugin:
50
51    ```text
52    $ vault write sys/plugins/catalog/database/oracle-database-plugin \
53        sha256="..." \
54        command=vault-plugin-database-oracle
55    ```
56
571. Configure Vault with the proper plugin and connection information:
58
59    ```text
60    $ vault write database/config/my-oracle-database \
61        plugin_name=oracle-database-plugin \
62        connection_url="system/Oracle@localhost:1521/OraDoc.localhost" \
63        allowed_roles="my-role"
64    ```
65
661. Configure a role that maps a name in Vault to an SQL statement to execute to
67create the database credential:
68
69    ```text
70    $ vault write database/roles/my-role \
71        db_name=my-oracle-database \
72        creation_statements="CREATE USER {{name}} IDENTIFIED BY {{password}}; GRANT CONNECT TO {{name}}; GRANT CREATE SESSION TO {{name}};" \
73        default_ttl="1h" \
74        max_ttl="24h"
75    Success! Data written to: database/roles/my-role
76    ```
77
78## Usage
79
80After the secrets engine is configured and a user/machine has a Vault token with
81the proper permission, it can generate credentials.
82
831. Generate a new credential by reading from the `/creds` endpoint with the name
84of the role:
85
86    ```text
87    $ vault read database/creds/my-role
88    Key                Value
89    ---                -----
90    lease_id           database/creds/my-role/2f6a614c-4aa2-7b19-24b9-ad944a8d4de6
91    lease_duration     1h
92    lease_renewable    true
93    password           8cab931c-d62e-a73d-60d3-5ee85139cd66
94    username           v-root-e2978cd0-
95    ```
96
97## API
98
99The full list of configurable options can be seen in the [Oracle database plugin
100API](/api/secret/databases/oracle.html) page.
101
102For more information on the database secrets engine's HTTP API please see the
103[Database secrets engine API](/api/secret/databases/index.html) page.
104