Configure Realms in Oracle Database Vault on Autonomous Database

 

Configure Realms in Oracle Database Vault on Autonomous Database

Oracle Database Vault enhances database security by enforcing separation of duties and protecting application data from unauthorized access — even by privileged users like DBAs. In this guide, we'll walk through the process of creating a Realm on an Autonomous Database, specifically targeting the HR schema.


What is a Realm?

A Realm is a security boundary in Oracle Database Vault that protects a set of database objects (like tables or schemas) from access—even by users with administrative privileges—unless they are specifically authorized.


Steps to Configure a Realm in Autonomous Database

 1. Connect as DV Owner User

Log in to your Autonomous Database using SQL Developer Web or any SQL client.

Ensure that you're connected as the Database Vault Owner (typically a user with DVOWNER role), and set the container to ROOT, if required.

sql
ALTER SESSION SET CONTAINER = CDB$ROOT;

If working with a PDB-enabled environment (not typical for Autonomous), switch accordingly.

 2. Enable REST Access (Optional for SQL Developer Web)

Ensure REST access is enabled to connect to the necessary services. This step might already be configured in ADB.


 3. Create a Realm on the HR Schema

Use the following PL/SQL block to create a realm:

sql
BEGIN DBMS_MACADM.CREATE_REALM( realm_name => 'HR_REALM', description => 'Realm for HR Schema', enabled => DBMS_MACUTL.G_YES, audit_options => DBMS_MACUTL.G_REALM_AUDIT_FAIL + DBMS_MACUTL.G_REALM_AUDIT_SUCCESS ); END; /

 This realm will start auditing both successful and failed access attempts.

 4. Add Objects to the Realm

Now add all objects under the HR schema to the realm. Use % to include all objects:

sql
BEGIN DBMS_MACADM.ADD_OBJECT_TO_REALM( realm_name => 'HR_REALM', object_owner => 'HR', object_name => '%', object_type => '%' ); END; /

This ensures all objects under the HR schema are protected by the realm.

 5. Test Realm Protection

Switch to a regular privileged user (e.g., ADMIN) and try to access HR schema objects:

sql
SELECT * FROM hr.employees;

If access is not explicitly granted through Realm Authorizations, you should receive a security violation error, even if the user has SELECT ANY TABLE or DBA privileges.


Summary

In this guide, you've learned how to:

  • Connect to Autonomous DB as DV owner

  • Create a Database Vault Realm for the HR schema

  • Add all schema objects to the realm

  • Protect access to sensitive HR data even from privileged accounts


Why Use Realms in Autonomous DB?

Using Realms in Autonomous Databases adds a strong layer of protection, particularly for sensitive business data, and is a best practice for zero-trust architecture in cloud deployments.


Want to automate this with a script or protect specific tables only? Comment below or explore more on bidhandba.blogspot.com!

Comments

Popular posts from this blog

Configure Oracle Database Vault Realms

Configure Transparent Database Encryption (TDE) in Oracle CDB

Cloning Oracle E-Business Suite 12.2.11: RMAN + Rapid Clone