Installing and Configuring Oracle Backend with Supabase APIs

Prepare the database and ORDS, configure Deep Data Security (DDS), create a project in the Console, and connect the fusabase CLI.

What You Will Do

In this chapter, you will:

Prerequisites

Before you start, make sure you have:

To prepare a dedicated administrative account, connect to the target PDB as SYS AS SYSDBA and run:

CREATE USER setup_admin IDENTIFIED BY "ADMIN_PASSWORD";
GRANT CREATE SESSION, DBA TO setup_admin;

Replace ADMIN_PASSWORD with a strong password for this administrative account. Use SETUP_ADMIN for DDS and schema enablement. The project-owning schema is a separate account created later in this chapter.

The schema enablement package must be permitted to inherit the caller’s privileges. Some administrative accounts, including an account created with a PDB’s ADMIN USER clause, can lack that permission despite having DBA. For those accounts, see Troubleshooting.

Before continuing, confirm that you can connect to the database and run show parameter compatible.

Prepare the Database

Oracle Backend with Supabase APIs requires a compatible database, extended string support, and Transparent Data Encryption (TDE).

Check the Database Version and Compatibility Setting

Connect as SYS AS SYSDBA or another privileged user and run:

show parameter compatible;
SELECT banner_full FROM v$version;

If COMPATIBLE is lower than 23.9.0, connect to CDB$ROOT, update the parameter, and restart the instance according to your environment’s restart procedure:

ALTER SYSTEM SET COMPATIBLE='23.9.0' SCOPE=SPFILE;

Enable Extended String Support

Connect to the target PDB as SYS AS SYSDBA and check the string-size setting:

SHOW PARAMETER max_string_size;

If the value is EXTENDED, continue to the TDE configuration. Otherwise, connect to CDB$ROOT as SYS AS SYSDBA and run the following sequence:

ALTER PLUGGABLE DATABASE PDB_NAME CLOSE;
ALTER PLUGGABLE DATABASE PDB_NAME OPEN UPGRADE;
ALTER SESSION SET CONTAINER=PDB_NAME;
ALTER SYSTEM SET max_string_size = extended;
@?/rdbms/admin/utl32k.sql
ALTER SESSION SET CONTAINER=CDB$ROOT;
ALTER PLUGGABLE DATABASE PDB_NAME CLOSE;
ALTER PLUGGABLE DATABASE PDB_NAME OPEN;
ALTER SESSION SET CONTAINER=PDB_NAME;
@?/rdbms/admin/utlrp.sql
SHOW PARAMETER max_string_size;

Replace PDB_NAME with the target PDB name. The utlrp.sql script recompiles invalid objects after the PDB reopens in normal mode. Confirm that MAX_STRING_SIZE is EXTENDED.

Configure the TDE Wallet and Master Key

The following procedure configures a password-protected file keystore in united mode, where the CDB and its PDBs share a keystore. If your keystore is already configured, open it if needed and verify the target PDB’s wallet and master key in step 5.

  1. On the database host, create the wallet directory with an operating system account that can set its ownership and permissions:

    mkdir -p /opt/oracle/oradata/FREE/tde
    chown oracle:oinstall /opt/oracle/oradata/FREE/tde
    chmod 700 /opt/oracle/oradata/FREE/tde

    These example paths use /opt/oracle/oradata/FREE as WALLET_ROOT and its tde subdirectory for the wallet. Use paths that meet your organization’s storage, backup, and access requirements. Replace oracle:oinstall with your database software owner and group.

  2. Connect to CDB$ROOT as SYS AS SYSDBA and set the wallet root:

    ALTER SYSTEM SET wallet_root='/opt/oracle/oradata/FREE' SCOPE=SPFILE;

    Replace the example path with your selected wallet root, excluding the tde subdirectory.

  3. Restart the database according to your environment’s procedure. Reconnect to CDB$ROOT as SYS AS SYSDBA, verify the wallet root, and set the keystore type:

    SHOW PARAMETER wallet_root;
    ALTER SYSTEM SET tde_configuration='KEYSTORE_CONFIGURATION=FILE'
      SCOPE=BOTH;
  4. Connect to CDB$ROOT as a common user with the ADMINISTER KEY MANAGEMENT or SYSKM privilege. Ensure that the target PDB is open in read-write mode. Create and open the keystore, then set the master keys:

    ADMINISTER KEY MANAGEMENT CREATE KEYSTORE
      IDENTIFIED BY "KEYSTORE_PASSWORD";
    ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN
      IDENTIFIED BY "KEYSTORE_PASSWORD" CONTAINER=ALL;
    ADMINISTER KEY MANAGEMENT SET KEY
      IDENTIFIED BY "KEYSTORE_PASSWORD" WITH BACKUP CONTAINER=ALL;

    Replace KEYSTORE_PASSWORD with a strong keystore password that you manage securely.

  5. Connect to the target PDB as SYS AS SYSDBA and verify its wallet and master key:

    SELECT WRL_TYPE, WRL_PARAMETER, STATUS FROM V$ENCRYPTION_WALLET;
    SELECT MASTERKEY_ACTIVATED FROM V$DATABASE_KEY_INFO;

    Continue only when the target PDB’s wallet status is OPEN and MASTERKEY_ACTIVATED is YES.

After restarting a CDB or PDB, check the target PDB’s wallet status. If it is CLOSED, reopen the password-protected keystore before using TDE.

Enable Oracle Backend with Supabase APIs in ORDS

The installation procedures in this chapter target a PDB. Use that PDB’s service name when configuring the ORDS pool and running the installation commands.

The examples in this section use a standalone ORDS deployment:

For the full ORDS installation and configuration workflow, see Installing and Configuring Oracle REST Data Services.

Oracle recommends adding the ORDS bin directory to your PATH, so the examples in this chapter use the ords command directly. If you want to avoid repeating --config, you can also set the ORDS_CONFIG environment variable to your configuration directory.

Replace these example paths and URLs with the values for your environment. Keep the ORDS configuration directory outside the ORDS product directory.

Verify the ORDS Version

Run:

ords --version

Continue only if the reported version is 26.3 or later.

Run the Oracle Backend with Supabase APIs Installer

If you have installed ORDS in standalone mode, a basic layout looks like the following after configuration:

/opt/ords
  bin/ords

/opt/ords-config
  global/
    settings.xml
    standalone/
  databases/
    default/
      pool.xml

Enable the backend feature in the installed ORDS database repository. Run the installer with the ORDS command-line interface and point it to your standalone configuration directory. Use the pool configured for the target PDB’s service.

ords --config /opt/ords-config fusabase install

During the prompts, select the existing pool configured for the target PDB. Then provide the feature, passphrase, and administrator values:

If you specify a database connection instead of selecting an existing pool, select the Basic connection type and enter the database host name, listener port, and PDB service name. The TCP listener port is usually 1521.

When the installer finishes, confirm that ORDS reports that the Oracle Backend with Supabase APIs feature is enabled.

For simplicity, this chapter continues with an HTTP localhost example. For shared or production standalone deployments, configure HTTPS rather than HTTP.

If you want to avoid using SYS AS SYSDBA for a PDB installation, Oracle provides the scripts/installer/ords_installer_privileges.sql script to grant a designated database user the privileges needed to install, upgrade, repair, and uninstall ORDS. Use that same designated user for the ORDS installation.

The ORDS installation account is only for the installation step. Schema enablement is a separate action later in this chapter and is performed with a user that has the DBA role.

Configure Deep Data Security

Configure the IAM applications, a secure database connection, and DDS for the ORDS pool before creating a Supabase-style project.

This chapter uses the default ORDS pool for installation, DDS, and Console and CLI access. Use the same pool throughout these procedures. For a named pool, also use its matching pool mapping in the Console and schema URLs.

Configure the IAM Identity Domain

Register the database and ORDS in the same OCI IAM identity domain. The example applications are OracleDB, which represents the database resource, and fusabase, which represents ORDS.

  1. In the OCI Console, open Identity & Security > Domains and select your domain. Copy its Domain URL for the DDS enablement command.

  2. In Integrated applications, select Add application > Confidential Application > Launch workflow.

    Figure 3-1 Add a Confidential Application

    Description of the illustration dds-iam-add-confidential.png

  3. For Name, enter OracleDB. You can add a description and leave the optional Application URL empty. Select Submit.

  4. Open OAuth configuration > Edit OAuth configuration. Under Resource server configuration, select Configure this application as a resource server now and enter OracleDB for Primary audience.

  5. Enable Add scopes and select Add. Enter the following values, leave Requires user consent off, and add the scope:

    Field Example value
    Scope DB_ACCESS_SCOPE
    Display name DB Access
    Description Access the database

    Figure 3-2 Add the Database Access Scope

    Description of the illustration dds-iam-database-scope.png

  6. Under Client configuration, select Configure this application as a client now and enable Client credentials. Select Specific for authorized resources.

    For this example, select Anywhere for the client IP policy. For a deployment with a configured network perimeter, use the policy that permits the database’s requests to IAM.

    Figure 3-3 Database Resource Server Configuration

    Description of the illustration dds-iam-database-resource.png

  7. Select Submit, then select Actions > Activate. In the confirmation dialog, select Activate application.

    Figure 3-4 Activate an Application

    Description of the illustration dds-iam-activate-application.png

  8. On the database application’s Details page, record its Application ID. The DDS command needs this identifier, which differs from the database application’s OAuth Client ID.

  9. Create another confidential application named fusabase by repeating steps 2 and 3 with that name. To use an application that already represents your ORDS deployment, open that application instead.

  10. Open the fusabase application’s OAuth configuration > Edit OAuth configuration. Under Client configuration, select Configure this application as a client now and enable Client credentials.

    Use Anywhere for this example, or a configured network perimeter that permits ORDS to contact IAM. Select Specific under Authorized resources.

    Figure 3-5 ORDS Client Credentials Configuration

    Description of the illustration dds-iam-ords-client-credentials.png

  11. Enable Add resources and select Add scope. Expand OracleDB, select OracleDBDB_ACCESS_SCOPE, and select Add.

    Figure 3-6 Select the Database Scope for ORDS

    Description of the illustration dds-iam-ords-allowed-scope.png

    The fully qualified scope combines the audience and scope name: OracleDB + DB_ACCESS_SCOPE = OracleDBDB_ACCESS_SCOPE. Do not insert a / between these example values.

  12. Select Submit, then select Actions > Activate for the fusabase application. Confirm by selecting Activate application.

  13. On the fusabase application’s OAuth configuration page, securely record its Client ID and Client secret. These are the ORDS credentials supplied to the DDS command.

    Figure 3-7 ORDS OAuth Credentials

    Description of the illustration dds-iam-ords-credentials.png

  14. Return to Integrated applications and confirm that both applications are Active.

    Figure 3-8 Active Database and ORDS Applications

    Description of the illustration dds-iam-applications-active.png

  15. In the domain’s Settings tab, select Edit domain settings. Under Access signing certificate, enable Configure client access.

    Figure 3-9 Allow Public Access to the Signing Certificate

    Description of the illustration dds-iam-public-signing-certificate.png

  16. Select Save changes. In the separate Save domain settings confirmation, select Save changes again.

    Figure 3-10 Confirm the Domain Settings Change

    Description of the illustration dds-iam-confirm-domain-settings.png

  17. In Bash on the ORDS host, verify that the signing keys are accessible without authentication:

    DOMAIN_URL='IAM_DOMAIN_URL'
    curl --fail --silent --show-error \
      "${DOMAIN_URL}/admin/v1/SigningCert/jwk"

    Replace IAM_DOMAIN_URL with the complete domain URL copied in step 1. Continue when the request returns a JSON Web Key Set. An HTTP 401 Unauthorized status code indicates that public access is not enabled.

  18. To verify the ORDS client’s access to the database scope, set ORDS_CLIENT_ID and ORDS_CLIENT_SECRET to the values saved in step 13, then request a token:

    umask 077
    read -r -p 'ORDS client ID: ' ORDS_CLIENT_ID
    read -r -s -p 'ORDS client secret: ' ORDS_CLIENT_SECRET
    printf '\n'
    curl --fail --silent --show-error --request POST \
      "${DOMAIN_URL}/oauth2/v1/token" \
      --user "${ORDS_CLIENT_ID}:${ORDS_CLIENT_SECRET}" \
      --header "Content-Type: application/x-www-form-urlencoded" \
      --data-urlencode "grant_type=client_credentials" \
      --data-urlencode "scope=OracleDBDB_ACCESS_SCOPE" \
      --output db-token-response.json \
      --write-out 'HTTP %{http_code}\n'

    Continue when the request returns HTTP 200 and the protected response file contains an access_token. Keep the response file and client secret secure. For a different audience or scope name, use the fully qualified scope configured for your database resource.

For more information, see Register the Database in OCI IAM.

Configure the TCPS Connection

DDS requires Transport Layer Security (TLS) on the connection from ORDS to the database to transmit the end-user security context. TCPS is a Transmission Control Protocol (TCP) connection secured with TLS. HTTPS connections to ORDS or IAM and TDE do not secure this database connection.

The fusabase enable-dds command configures DDS identities and OAuth settings; configure the secure database connection separately. For the TLS requirement, see Configure the Database for IAM Integration.

If the project’s ORDS pool already connects to the target PDB over TCPS and validates its server certificate, verify the connection with ords --config /opt/ords-config config verify. Then continue to Enable DDS in ORDS. Otherwise, configure the target PDB’s TCPS service and the ORDS runtime pool as described in this example.

For a named pool, use ords --config /opt/ords-config config --db-pool POOL_NAME verify, replacing POOL_NAME with your pool’s name.

The following Linux example creates a test certificate authority (CA) and a server certificate valid for 30 days. For production, use certificates issued by your approved CA. For certificate alternatives, see Configuring Transport Layer Security Encryption.

The TDE wallet and TLS wallet have separate purposes and locations. This example keeps the TDE wallet in WALLET_ROOT/tde and places the PDB’s TLS wallet in WALLET_ROOT/PDB_GUID/tls.

  1. Connect to CDB$ROOT as SYS AS SYSDBA and identify the wallet root and target PDB’s GUID:

    SHOW PARAMETER wallet_root;
    SELECT name, RAWTOHEX(guid) AS pdb_guid
      FROM v$pdbs WHERE name='PDB_NAME';

    Replace PDB_NAME with the target PDB name. Use the wallet root configured during TDE setup. The target PDB must be open in read-write mode.

  2. On the database host, use Bash as the database software owner and prepare the wallet locations and certificate names:

    WALLET_ROOT='WALLET_ROOT_PATH'
    PDB_GUID='PDB_GUID_VALUE'
    CA_WALLET='CA_WALLET_PATH'
    CLIENT_WALLET='CLIENT_WALLET_PATH'
    SERVER_DN='CN=DB_HOST,O=Example'
    CA_DN='CN=Example Test CA,O=Example'
    SERVER_WALLET="${WALLET_ROOT}/${PDB_GUID}/tls"
    umask 077
    mkdir -p "$CA_WALLET" "$SERVER_WALLET" "$CLIENT_WALLET"
    chmod 700 "$CA_WALLET" "$SERVER_WALLET" "$CLIENT_WALLET"
    read -r -s -p 'CA wallet password: ' CA_PASSWORD
    printf '\n'
    read -r -s -p 'TLS wallet password: ' TLS_PASSWORD
    printf '\n'

    Replace the following values:

    • WALLET_ROOT_PATH: the wallet root returned in step 1.
    • PDB_GUID_VALUE: the target PDB’s GUID returned in step 1.
    • CA_WALLET_PATH: a protected directory for the test CA wallet.
    • CLIENT_WALLET_PATH: a separate directory for the ORDS trust wallet.
    • DB_HOST: the database host name that ORDS uses to connect.

    Enter strong wallet passwords at the prompts. Keep the same Bash session for the wallet commands that follow.

  3. Create the test CA wallet and export its root certificate:

    orapki wallet create -wallet "$CA_WALLET" \
      -pwd "$CA_PASSWORD" -auto_login
    orapki wallet add -wallet "$CA_WALLET" -dn "$CA_DN" \
      -keysize 2048 -sign_alg sha256 -self_signed -validity 30 \
      -pwd "$CA_PASSWORD"
    orapki wallet export -wallet "$CA_WALLET" -dn "$CA_DN" \
      -cert "$CA_WALLET/rootCA.crt" -pwd "$CA_PASSWORD"
  4. Create the server wallet, generate a certificate request, sign it with the test CA, and import the signed certificate:

    orapki wallet create -wallet "$SERVER_WALLET" \
      -pwd "$TLS_PASSWORD" -auto_login
    orapki wallet add -wallet "$SERVER_WALLET" -trusted_cert \
      -cert "$CA_WALLET/rootCA.crt" -pwd "$TLS_PASSWORD"
    orapki wallet add -wallet "$SERVER_WALLET" -keysize 2048 \
      -dn "$SERVER_DN" -pwd "$TLS_PASSWORD"
    orapki wallet export -wallet "$SERVER_WALLET" -dn "$SERVER_DN" \
      -request "$SERVER_WALLET/server.csr" -pwd "$TLS_PASSWORD"
    orapki cert create -wallet "$CA_WALLET" \
      -request "$SERVER_WALLET/server.csr" \
      -cert "$SERVER_WALLET/server.crt" -validity 30 \
      -sign_alg sha256 -pwd "$CA_PASSWORD"
    orapki wallet add -wallet "$SERVER_WALLET" -user_cert \
      -cert "$SERVER_WALLET/server.crt" -pwd "$TLS_PASSWORD"
    orapki wallet display -wallet "$SERVER_WALLET"

    Confirm that the server certificate appears under User Certificates and the CA certificate appears under Trusted Certificates.

  5. Create a separate auto-login wallet containing only the CA trust certificate for ORDS:

    orapki wallet create -wallet "$CLIENT_WALLET" \
      -pwd "$TLS_PASSWORD" -auto_login
    orapki wallet add -wallet "$CLIENT_WALLET" -trusted_cert \
      -cert "$CA_WALLET/rootCA.crt" -pwd "$TLS_PASSWORD"
    orapki wallet display -wallet "$CLIENT_WALLET"
    unset CA_PASSWORD TLS_PASSWORD

    Confirm that this wallet has the CA under Trusted Certificates and no User Certificates.

  6. Locate the database network configuration files in TNS_ADMIN, or $ORACLE_HOME/network/admin when TNS_ADMIN is unset. In sqlnet.ora, add the following setting while retaining the other network settings:

    TLS_CLIENT_AUTHENTICATION=FALSE

    This example uses one-way TLS: the client verifies the server certificate, and the server does not require a client certificate.

  7. In listener.ora, add a TCPS address and the listener’s wallet location. For example, retain TCP administration access while adding TCPS on port 2484:

    LISTENER=
      (DESCRIPTION_LIST=
        (DESCRIPTION=
          (ADDRESS=(PROTOCOL=TCP)(HOST=DB_HOST)(PORT=1521))
          (ADDRESS=(PROTOCOL=TCPS)(HOST=DB_HOST)(PORT=2484))))
    WALLET_LOCATION=
      (SOURCE=(METHOD=FILE)
        (METHOD_DATA=(DIRECTORY=WALLET_ROOT_PATH/PDB_GUID_VALUE/tls)))
    TLS_CLIENT_AUTHENTICATION=FALSE

    Use the same server wallet for the listener and the target PDB. Replace DB_HOST, WALLET_ROOT_PATH, and PDB_GUID_VALUE with the values used in step 2. Retain other listener entries required by your environment.

  8. Restart the listener:

    lsnrctl stop
    lsnrctl start

    Reconnect to CDB$ROOT as SYS AS SYSDBA and register the services:

    ALTER SYSTEM REGISTER;
  9. On the ORDS host, create ORDS_WALLET_PATH as the ORDS software owner and restrict the directory to that owner:

    mkdir -p ORDS_WALLET_PATH
    chmod 700 ORDS_WALLET_PATH

    Replace ORDS_WALLET_PATH with the path selected for the ORDS trust wallet. Securely copy ewallet.p12 and cwallet.sso from the database host’s CLIENT_WALLET directory into this directory. As the ORDS software owner, restrict the copied files:

    chmod 600 ORDS_WALLET_PATH/ewallet.p12 ORDS_WALLET_PATH/cwallet.sso
  10. On the ORDS host, configure the default pool to use the PDB’s TCPS service and require a full certificate distinguished name (DN) match:

    ords --config /opt/ords-config config set db.connectionType customurl
    ords --config /opt/ords-config config set db.customURL 'jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=DB_HOST)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=PDB_SERVICE))(SECURITY=(SSL_SERVER_DN_MATCH=YES)(SSL_SERVER_CERT_DN="CN=DB_HOST,O=Example")(WALLET_LOCATION=ORDS_WALLET_PATH)))'
    ords --config /opt/ords-config config verify

    Replace the following values:

    • DB_HOST: the database host name used in the server certificate and reachable from ORDS.
    • PDB_SERVICE: the target PDB’s service name.
    • ORDS_WALLET_PATH: the ORDS trust wallet directory from step 9.

    Match SSL_SERVER_CERT_DN to the complete server certificate DN. Continue when config verify reports that the database pool connection is valid.

    These commands configure the default pool. For a named pool, insert --db-pool POOL_NAME immediately after config in each command, including config verify. Replace POOL_NAME with your pool’s name. Use that same pool for DDS enablement and project access.

    The connection descriptor uses the Oracle wallet for database certificate trust. Other HTTPS connections, including IAM requests, retain the JVM’s default CA trust configuration.

Enable DDS in ORDS

Enable DDS for the same ORDS configuration directory and TCPS pool used by your project:

  1. Run the DDS enablement command:

    ords --config /opt/ords-config fusabase enable-dds
  2. Supply the following values at the prompts:

    Prompt Value
    Database pool The default pool configured for TCPS, or your matching named pool
    Enter the administrator username An account created with CREATE USER and granted the DBA role in the target PDB
    Enter the database password for the administrator That database account’s password
    Enter the IDCS domain URL The domain URL copied from the IAM domain’s Details page
    Enter the OAuth client id The fusabase application’s OAuth Client ID
    Enter the OAuth client secret The fusabase application’s OAuth Client secret
    Enter the OCI IAM application id The OracleDB application’s Application ID from its Details page
    Enter the OAuth scope OracleDBDB_ACCESS_SCOPE, or your database resource’s fully qualified scope

    Keep the database application’s Application ID separate from its OAuth Client ID. The OAuth client ID and secret entered here belong to the ORDS application.

  3. Restart the ORDS server to load the pool configuration. For a standalone deployment that is not running, start it with:

    ords --config /opt/ords-config serve
  4. Connect to the target PDB as SYS AS SYSDBA and verify the identity provider, application mapping, and common data role:

    SHOW PARAMETER identity_provider_type;
    SELECT application_name, mapped_to
      FROM dba_application_identities
      WHERE application_name='BAAS_EUSC_APP';
    SELECT data_role, grantee
      FROM dba_data_role_grants
      WHERE grantee='BAAS_EUSC_APP' AND data_role='BAAS$COMMON';

    Confirm that the provider is OCI_IAM, the application identity maps to the ORDS OAuth Client ID, and BAAS$COMMON is granted to BAAS_EUSC_APP.

Continue with Prepare and Enable the Project Schema, then Open the Console and Create Your First Project.

Prepare and Enable the Project Schema

Each Oracle Backend with Supabase APIs project is owned by one schema. That schema becomes the project owner and receives BAAS_ROLE when the enablement procedure succeeds.

Create the Schema

The following is an example of creating a dedicated tablespace and schema for your project:

CREATE TABLESPACE fusabase_tbs
  DATAFILE 'fusabase_tbs01.dbf' SIZE 50M AUTOEXTEND ON
  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

CREATE USER fusabase_user IDENTIFIED BY "SCHEMA_PASSWORD"
  DEFAULT TABLESPACE fusabase_tbs
  QUOTA UNLIMITED ON fusabase_tbs;

Replace SCHEMA_PASSWORD with a strong password for the project-owning schema.

Grant the Required Database Privileges

Grant the privileges used for this example before enabling the schema:

GRANT CREATE SESSION TO fusabase_user;
GRANT RESOURCE TO fusabase_user;

The schema enablement procedure assigns BAAS_ROLE and grants the DDS privileges described in Enable DDS for the Project Schema.

For service-specific storage prerequisites, see Storage Setup and Configuration.

Enable the Schema for Oracle Backend with Supabase APIs

Connect to the target PDB as SETUP_ADMIN, or another DBA account whose privileges the schema enablement package can inherit. Do not invoke this procedure as SYS or SYSTEM. Run:

BEGIN
  OBAAS_ADMIN.OBAAS_ENABLE_SCHEMA(
    'FUSABASE_USER',
    'BASE_PATH',
    'fusabase_user',
    FALSE
  );
END;
/
COMMIT;

In this example, BASE_PATH is the ORDS URL mapping type, and fusabase_user is the ORDS path mapping pattern exposed in the schema URL. These parameters follow the same behavior as p_url_mapping_type and p_url_mapping_pattern in ORDS.ENABLE_SCHEMA.

The procedure enables the schema for Oracle Backend with Supabase APIs and assigns BAAS_ROLE.

Enable DDS for the Project Schema

Complete the schema enablement procedure after enabling DDS in ORDS. Schema enablement grants the following DDS privileges automatically:

You do not need to grant these privileges separately.

Open the Console

If ORDS is stopped, start it:

ords --config /opt/ords-config serve

For a standalone deployment, keep the server terminal open while continuing in the browser. If you started ORDS during DDS enablement, use that running server.

Open http://localhost:8080/ords/_/landing in your browser. Replace the host and port if ORDS is running elsewhere. Select Go on the Oracle Backend for Fusabase tile and sign in with the fusabase_user credentials.

Figure 3-11 ORDS Landing Page

Description of the illustration dds-ords-landing.png

Create Your First Project

Create a relational project for the schema you enabled:

  1. In the Console, on the Oracle Backend with Supabase APIs card, select Create project.

  2. After completing the DDS configuration, select Yes, Deep Data Security is enabled.

    Figure 3-12 Confirm DDS Configuration

    Description of the illustration dds-console-confirm-enabled.png

  3. Select Continue.

  4. In Project name, enter a name for your project.

  5. For this example, select Set up using quickstart and leave Set up authentication for me and Set up storage for me selected.

    Figure 3-13 Create a Project Using Quickstart

    Description of the illustration dds-console-project-quickstart.png

  6. Select Create Project.

The Console lists the new project. This project uses the RELATIONAL project type. Quickstart configures Basic authentication and BASE storage for this example.

Open the project to view its Overview page:

Figure 3-14 Project Overview

Description of the illustration dds-console-project-overview.png

For more information, see Creating a Project.

Configure the CLI

The CLI needs an ORDS OAuth client for schema administration. This client is created in Database Actions and is separate from the OCI IAM client used by ORDS for DDS. Install the CLI from npm, then configure its administrative OAuth client.

Install the CLI from npm

Before you begin, install Node.js 18 or later and npm.

Install the CLI globally from npm:

npm install -g fusabase-cli

Verify that your shell can find the installed command:

fusabase --help

Create an OAuth Client for the CLI

  1. Open Database Actions for the schema you enabled for Oracle Backend with Supabase APIs. Dismiss any welcome tour before continuing.

    Figure 3-15 Database Actions Launchpad

    Description of the illustration dds-cli-database-actions.png

  2. Open REST, then open Security and select OAuth Clients.

    Figure 3-16 REST Security Options

    Description of the illustration dds-cli-rest-security.png

  3. Select Create OAuth Client.

  4. Confirm that Owner is the enabled schema. Enter the following values for the example client:

    • Grant type: CLIENT_CRED

    • Name: fusabase-cli

    • Description: a description such as OAuth client for the fusabase CLI

    • Support Email and Support URI: contact values appropriate for your environment

    Figure 3-17 Define the CLI OAuth Client

    Description of the illustration dds-cli-oauth-definition.png

  5. On the Roles tab, select SQL Developer and move it into the selected roles list using the right-arrow control. This role enables the CLI’s administrative API calls.

    Figure 3-18 Grant the SQL Developer Role

    Description of the illustration dds-cli-sql-developer-role.png

  6. Select Create. The client secret dialog appears.

  7. Copy the client secret and store it securely before closing the dialog. The secret is shown only once; if you lose it, rotate the secret to generate another.

    Figure 3-19 Save the Client Secret

    Description of the illustration dds-cli-secret-once.png

  8. Select OK. On the OAuth client card, show or copy the Client ID and save it with the secret. You can return to this card to copy the Client ID again.

    Figure 3-20 CLI OAuth Client Card

    Description of the illustration dds-cli-oauth-card.png

Create the CLI Configuration File

Create a fusabase.config.js file in the same directory where you will run the CLI:

module.exports = {
  host: 'http://localhost:8080/ords/fusabase_user/'
}

Replace the example URL with your actual ORDS host, port, and schema base path. Keep the trailing /.

Sign In to the CLI

From that same directory, run:

fusabase init

Enter the OAuth client ID and client secret for the client you created in Database Actions. The CLI requests an access token and reports a successful login.

It then lists the available projects and prompts you to select one. Select the relational project you created in the Console.

The CLI saves the token and selected project in .fusabase.conf in the working directory. Exclude this session file from version control.

Confirm the CLI Can Reach Your Schema

After you sign in, run:

fusabase list-projects

Confirm that the output includes the relational project you created in the Console. If the project is absent, verify the schema URL in fusabase.config.js and the project selected during fusabase init.

Verify the Installation

The installation and administrative setup are complete when all of the following are true:

These checks verify administrative access. After adding a web app, complete the following check to verify application data access through DDS.

Verify Application Data Access

Use the Console to create a table, add rows, and configure a DDS data grant. Then use your registered web app to verify that DDS returns only the permitted row.

Use the relational project created in this chapter and sign in to the Console as its schema owner. For the SDK check, use the app’s generated configuration and an application session without a signed-in user.

  1. In the Console, open your project and select Database > Table Editor. Select Tables.

  2. Select Create table. For Table name, enter DDS_SETUP_CHECK. Use an unused name if that table already exists, and use that name throughout this check.

    Add the following columns:

    • Select Add Columns. For Column name, enter ID; for Data type, select INT. Select Make primary key, then select Add.
    • Select Add Columns again. For Column name, enter PROBE_VALUE; for Data type, select VARCHAR2. Select Add.

    Figure 3-21 Create the Verification Table

    Description of the illustration dds-console-check-create-table.png

    Select Save. Confirm that DDS_SETUP_CHECK appears in the table list.

  3. Select DDS_SETUP_CHECK, then select Insert > Row. Enter 1 for ID and allowed-row for PROBE_VALUE.

    Figure 3-22 Add a Verification Row

    Description of the illustration dds-console-check-add-row.png

    Select Save. Repeat Insert > Row to add a second row with ID 2 and PROBE_VALUE hidden-row, then select Save.

  4. Confirm that the Table Editor displays both rows. This verifies that the schema owner can create and manage the table through the Console.

    Figure 3-23 Verify Both Rows in the Console

    Description of the illustration dds-console-check-two-rows.png

  5. In Table Editor, select Grants > Create grant. Configure the grant:

    • Grant name: DDS_SETUP_READ, or another unused grant name.
    • Object type: Table.
    • Target object: DDS_SETUP_CHECK.
    • Roles: the schema’s NoAuth role, such as FUSABASE_USER$noauth_role. The screenshots use the test schema’s TESTUSER$noauth_role.

    Figure 3-24 Configure the Verification Grant

    Description of the illustration dds-console-check-grant.png

    Under Actions, select only SELECT. Leave INSERT, UPDATE, and DELETE cleared.

    For Column scope, select Selected columns and choose ID and PROBE_VALUE in Columns.

    For Row scope, select Matching rows. Set Column name to ID, leave Operator set to =, and enter 1 for Value.

    Confirm that the SQL preview grants SELECT on those two columns, with WHERE ID = 1, to the NoAuth role. Select Create grant.

  6. Confirm that DDS_SETUP_READ appears in the grants list. To inspect the saved rule, open its Actions menu and select Edit. Review the SQL preview, then select Cancel to close the dialog without changing the grant.

    Figure 3-25 Inspect the Saved Verification Grant

    Description of the illustration dds-console-check-grant-scope.png

    The saved predicate can appear as Custom condition when you reopen the grant. Confirm that the SQL preview still contains WHERE ID = 1.

  7. In your web app, initialize the relational SDK client with the app configuration copied from the Console. Follow Adding Oracle Backend with Supabase APIs to Your Apps. In a browser session where you have not signed in to the application, run this code after initializing client:

    const { data, error } = await client
      .from('DDS_SETUP_CHECK')
      .select('ID,PROBE_VALUE')
      .order('ID', { ascending: true });
    
    if (error) {
      throw error;
    }
    
    if (data?.length !== 1 || data[0].ID !== 1 ||
        data[0].PROBE_VALUE !== 'allowed-row') {
      throw new Error('DDS verification failed: unexpected rows.');
    }
    
    console.log('DDS verification passed:', data);

    Confirm that the browser console reports DDS verification passed and shows only the allowed-row row. The second row must remain hidden from the application even though the Console displays it to the schema owner. This verifies application access through DDS as well as table management in the Console.

  8. After verification, remove the test objects in the Console:

    • In Table Editor > Grants, open the DDS_SETUP_READ Actions menu, select Delete, and confirm Delete.
    • In Table Editor > Tables, select DDS_SETUP_CHECK. Open the menu next to the table name, select Delete table, and confirm Delete.

    If you changed the test names, select those objects for cleanup.

Troubleshooting