---
title: "OracleDB Credentials Rotation"
description: "Learn how to automatically rotate Oracle Database credentials."
---

<Info>
    When working with SQL in Oracle databases, any values not surrounded by "quotes" will become UPPERCASE. Keep this in mind when creating users.
</Info>

## Prerequisites

1. Create a [OracleDB Connection](/integrations/app-connections/oracledb) with the required **Secret Rotation** permissions
2. Create two designated database users for Infisical to rotate the credentials for. Be sure to grant each user login permissions for the desired database with the necessary privileges their use case will require.

    An example creation statement might look like:
    ```SQL
    -- create user roles
    CREATE USER INFISICAL_USER_1 IDENTIFIED BY "temporary_password";
    CREATE USER INFISICAL_USER_2 IDENTIFIED BY "temporary_password";

    -- grant necessary privileges
    GRANT ALL PRIVILEGES TO INFISICAL_USER_1;
    GRANT ALL PRIVILEGES TO INFISICAL_USER_2;
    ```

    <Note>
      Username must either be ALL UPPERCASE or not be surrounded by "quotes". Values not surrounded by quotes get automatically transformed to uppercase by Oracle Database.
    </Note>

    <Tip>
        To learn more about the Oracle Database permission system, please visit their [documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/dbseg/configuring-privilege-and-role-authorization.html).
    </Tip>

3. Ensure your network security policies allow incoming requests from Infisical to this rotation provider, if network restrictions apply.

## Create an Oracle Database Credentials Rotation in Infisical

<Tabs>
    <Tab title="Infisical UI">
        1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.
        ![Secret Manager Dashboard](/images/secret-rotations-v2/generic/add-secret-rotation.png)

        2. Select the **OracleDB Credentials** option.
        ![Select OracleDB Credentials](/images/secret-rotations-v2/oracledb-credentials/select-oracledb-credentials-option.png)

        3. Select the **OracleDB Connection** to use and configure the rotation behavior. Then click **Next**.
        ![Rotation Configuration](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-configuration.png)

            - **OracleDB Connection** - the connection that will perform the rotation of the configured database user credentials.
            - **Rotation Interval** - the interval, in days, that once elapsed will trigger a rotation.
            - **Rotate At** - the local time of day when rotation should occur once the interval has elapsed.
            - **Auto-Rotation Enabled** - whether secrets should automatically be rotated once the rotation interval has elapsed. Disable this option to manually rotate secrets or pause secret rotation.

        4. Input the usernames of the database users created above that will be used for rotation. Then click **Next**.
        ![Rotation Parameters](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-parameters.png)

            - **Database Username 1** - the username of the first user that will be used for rotation.
            - **Database Username 2** - the username of the second user that will be used for rotation.

            <Note>
                If your Oracle usernames were created without "quotes", Oracle sees them as UPPERCASE. Please use UPPERCASE for those names in the fields above.
            </Note>

        ![Rotation Advance Parameters](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-advance-parameters.png)
            
            - **Rotation Statement** - the template string query to generate password for the rotated user.
            - **Password Requirements** - the requirements for the password of the MySQL users that will be created for the rotation.

        5. Specify the secret names that the active credentials should be mapped to. Then click **Next**.
        ![Rotation Secrets Mapping](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-secrets-mapping.png)

            - **Username** - the name of the secret that the active username will be mapped to.
            - **Password** - the name of the secret that the active password will be mapped to.

        6. Give your rotation a name and description (optional). Then click **Next**.
        ![Rotation Details](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-details.png)

            - **Name** - the name of the secret rotation configuration. Must be slug-friendly.
            - **Description** (optional) - a description of this rotation configuration.

        7. Review your configuration, then click **Create Secret Rotation**.
        ![Rotation Review](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-confirm.png)

        8. Your **OracleDB Credentials** are now available for use via the mapped secrets.
        ![Rotation Created](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-created.png)
    </Tab>
    <Tab title="API">
        To create a OracleDB Credentials Rotation, make an API request to the [Create OracleDB Credentials Rotation](/api-reference/endpoints/secret-rotations/oracledb-credentials/create) API endpoint.

        ### Sample request

        ```bash Request
        curl --request POST \
        --url https://us.infisical.com/api/v2/secret-rotations/oracledb-credentials \
        --header 'Content-Type: application/json' \
        --data '{
            "name": "my-oracledb-rotation",
            "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "description": "my database credentials rotation",
            "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "environment": "dev",
            "secretPath": "/",
            "isAutoRotationEnabled": true,
            "rotationInterval": 30,
            "rotateAtUtc": {
                "hours": 0,
                "minutes": 0
            },
            "parameters": {
                "username1": "INFISICAL_USER_1",
                "username2": "INFISICAL_USER_2"
            },
            "secretsMapping": {
                "username": "ORACLEDB_USERNAME",
                "password": "ORACLEDB_PASSWORD"
            }
        }'
        ```

        ### Sample response

        ```bash Response
        {
            "secretRotation": {
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "name": "my-oracledb-rotation",
                "description": "my database credentials rotation",
                "secretsMapping": {
                    "username": "ORACLEDB_USERNAME",
                    "password": "ORACLEDB_PASSWORD"
                },
                "isAutoRotationEnabled": true,
                "activeIndex": 0,
                "folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "createdAt": "2023-11-07T05:31:56Z",
                "updatedAt": "2023-11-07T05:31:56Z",
                "rotationInterval": 30,
                "rotationStatus": "success",
                "lastRotationAttemptedAt": "2023-11-07T05:31:56Z",
                "lastRotatedAt": "2023-11-07T05:31:56Z",
                "lastRotationJobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "nextRotationAt": "2023-11-07T05:31:56Z",
                "connection": {
                    "app": "oracledb",
                    "name": "my-oracledb-connection",
                    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
                },
                "environment": {
                    "slug": "dev",
                    "name": "Development",
                    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
                },
                "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "folder": {
                    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                    "path": "/"
                },
                "rotateAtUtc": {
                    "hours": 0,
                    "minutes": 0
                },
                "lastRotationMessage": null,
                "type": "oracledb-credentials",
                "parameters": {
                    "username1": "INFISICAL_USER_1",
                    "username2": "INFISICAL_USER_2"
                }
            }
        }
        ```
    </Tab>
</Tabs>
