top of page

Handing Out PDBs Without Handing Out the Server: Lockdown Profiles on a Shared CDB in Oracle Database@Azure

OmerNarman
7 days ago
7 min read

Consolidation on Exadata works well until the first team asks for more control. A shared container database in Oracle Database@Azure hosts a dozen PDBs, one per application, and each team wants a local administrator who can create users, grant roles and tune its own schema. That is reasonable. What is not reasonable is that the same administrator can run ALTER SYSTEM on parameters that affect every PDB, call UTL_HTTP to reach any host the database server can reach, or use UTL_FILE and Java to touch the server's file system.


PDB lockdown profiles solve this. A lockdown profile is a named set of rules, created in the CDB root, that disables chosen statements, clauses, options and features inside the PDBs it is assigned to. This post builds a profile for application tenants on Exadata Database Service in Oracle Database@Azure, tests it in one PDB, and rolls it out to the rest.



The Use Case

The CDB SHAREDCDB on Exadata Database Service in Oracle Database@Azure hosts PDBs for several internal applications. Each team has a local user with the PDB_DBA role. The security review found three risks: local administrators can change memory and process parameters for their PDB, PL/SQL code can open outbound HTTP and SMTP connections from the database servers, and the UTL_FILE package can read files in directories created by the team. The DBA team wants these closed without taking normal administration away.


Environment used in this runbook


  • Service: Exadata Database Service on Dedicated Infrastructure in Oracle Database@Azure

  • Database: container database SHAREDCDB, Oracle Database 19c (19.24), two-node RAC

  • Tenants: PDBs TEAMA_PDB, TEAMB_PDB and TEAMC_PDB, each with a local administrator

  • Profile: APP_TENANT, created in CDB$ROOT and assigned per PDB

  • Licence: lockdown profiles are part of Oracle Database Enterprise Edition and need no extra-cost option



How Lockdown Profiles Work

  • The profile lives in the CDB root. It is created and changed only from CDB$ROOT or an application root, so a tenant cannot edit the rules that apply to it.

  • A new profile allows everything. Rules are added with ALTER LOCKDOWN PROFILE, which disables, or re-enables, statements, clauses, options and features.

  • Features come in bundles. NETWORK_ACCESS covers the PL/SQL network packages such as UTL_HTTP, UTL_SMTP and UTL_TCP, and OS_ACCESS covers operating system access such as UTL_FILE and Java OS calls.

  • A parameter assigns it. PDB_LOCKDOWN set in a PDB applies the profile there; set in the root, it is the default for every PDB without its own value.

  • Rules can spare common users. With USERS = LOCAL, a rule applies only to local users of the PDB, so the CDB administrators keep full control.



Step 1: See What Applies Today

Check which PDBs exist and whether any lockdown profile is already set, in the root or in a PDB.


SQL

-- Connected to CDB$ROOT as SYSDBA

COLUMN pdb_name FORMAT A12

COLUMN value FORMAT A12

SELECT p.name AS pdb_name, NVL(sp.value, '(none)') AS value

FROM v$pdbs p

LEFT JOIN v$system_parameter sp

ON sp.con_id = p.con_id AND sp.name = 'pdb_lockdown'

WHERE p.name <> 'PDB$SEED'

ORDER BY p.name;

Expected output

PDB_NAME     VALUE
------------ ------------
TEAMA_PDB    (none)
TEAMB_PDB    (none)
TEAMC_PDB    (none)

What to expect: No profile anywhere: every local administrator has the full set of powers that the PDB_DBA role and their grants allow. Lockdown profiles are an extra layer on top of privileges; they block statements even for users who hold the privilege to run them.



Step 2: Create the Profile

Create the profile in the root. At this point it allows everything, so creating it changes nothing for the PDBs.


SQL

CREATE LOCKDOWN PROFILE app_tenant;

COLUMN profile_name FORMAT A16

SELECT DISTINCT profile_name

FROM dba_lockdown_profiles

WHERE profile_name = 'APP_TENANT';

Expected output

Lockdown Profile created.

PROFILE_NAME
----------------
APP_TENANT

What this does: It creates an empty profile named APP_TENANT. The database also has a few Oracle-supplied profiles, such as PRIVATE_DBAAS, SAAS and PUBLIC_DBAAS, which are useful as examples but are usually too strict or too loose for an internal consolidation platform.



Step 3: Restrict ALTER SYSTEM to the Parameters Teams Need

Disable ALTER SYSTEM SET for local users, except for a short list of session-level and optimizer parameters that application teams legitimately tune in their own PDB.


SQL

ALTER LOCKDOWN PROFILE app_tenant

DISABLE STATEMENT = ('ALTER SYSTEM')

CLAUSE = ('SET')

OPTION ALL EXCEPT = ('open_cursors', 'optimizer_mode', 'optimizer_index_cost_adj',

'cursor_sharing', 'job_queue_processes')

USERS = LOCAL;

ALTER LOCKDOWN PROFILE app_tenant

DISABLE STATEMENT = ('ALTER SYSTEM')

CLAUSE ALL EXCEPT = ('SET', 'FLUSH SHARED_POOL', 'KILL SESSION')

USERS = LOCAL;

Expected output

Lockdown Profile altered.

Lockdown Profile altered.

What this does: The first rule lets local users set only the five listed parameters with ALTER SYSTEM SET; any other parameter, such as SGA_TARGET, PROCESSES or CPU_COUNT, is refused. The second rule disables every other ALTER SYSTEM clause for local users except flushing the shared pool of their PDB and killing sessions, which teams need for daily support. Common users, such as the CDB administrators, are not affected.


Tip: Agree the list of allowed parameters with the application teams before you enable the profile. A parameter that a team sets in its deployment scripts, and that is suddenly refused, breaks the next release at the worst moment.


Step 4: Block Network and Operating System Access

Disable the feature bundles that let PL/SQL code leave the database: outbound network connections and access to the server's operating system.


SQL

ALTER LOCKDOWN PROFILE app_tenant DISABLE FEATURE = ('NETWORK_ACCESS');

ALTER LOCKDOWN PROFILE app_tenant DISABLE FEATURE = ('OS_ACCESS');

Expected output

Lockdown Profile altered.

Lockdown Profile altered.

What this does: With NETWORK_ACCESS disabled, PL/SQL in the PDB can no longer use packages such as UTL_HTTP, UTL_SMTP, UTL_TCP and UTL_INADDR, so code in a tenant PDB cannot call arbitrary hosts from the Exadata database servers. With OS_ACCESS disabled, UTL_FILE and similar OS access are refused. If one team really needs outbound HTTP, for example to call an internal API, give that PDB its own profile with this one rule removed, and control the target hosts with a network ACL.



Step 5: Review the Rules

List the rules of the profile from the dictionary, so the definition can be reviewed and kept with the platform documentation.


SQL

COLUMN rule_type FORMAT A10

COLUMN rule FORMAT A16

COLUMN clause FORMAT A8

COLUMN users FORMAT A6

SELECT rule_type, rule, clause, status, users

FROM dba_lockdown_profiles

WHERE profile_name = 'APP_TENANT'

ORDER BY rule_type, rule, clause;

Expected output

RULE_TYPE  RULE             CLAUSE   STATUS  USERS
---------- ---------------- -------- ------- ------
FEATURE    NETWORK_ACCESS            DISABLE ALL
FEATURE    OS_ACCESS                 DISABLE ALL
STATEMENT  ALTER SYSTEM              DISABLE LOCAL
STATEMENT  ALTER SYSTEM     SET      DISABLE LOCAL

What to expect: Two feature rules for all users and two statement rules for local users only. The exceptions given with ALL EXCEPT are stored with the rules and can be seen in the CLAUSE_OPTION and LIST columns of the same view; include them in the review if the list is long.



Step 6: Assign the Profile to One PDB First

Start with a single PDB whose team has agreed to test. Set PDB_LOCKDOWN inside that PDB as a common user.


SQL

ALTER SESSION SET CONTAINER = teama_pdb;

ALTER SYSTEM SET pdb_lockdown = 'APP_TENANT' SCOPE = BOTH;

SHOW PARAMETER pdb_lockdown

Expected output

Session altered.

System altered.

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pdb_lockdown                         string      APP_TENANT

What this does: From now on, local users in TEAMA_PDB work under the APP_TENANT rules, including sessions that are already connected. The other PDBs are unchanged. Because the rules are evaluated when a statement runs, there is no restart and no outage.



Step 7: Test as the Tenant's Administrator

Connect as the local administrator of TEAMA_PDB and try both an allowed and a blocked change, so everyone sees exactly how the profile behaves.


SQL

-- Connected to TEAMA_PDB as TEAMA_ADMIN, a local user with the PDB_DBA role

ALTER SYSTEM SET open_cursors = 500;

ALTER SYSTEM SET sga_target = 64G;

DECLARE

l_text VARCHAR2(200);

BEGIN

l_text := UTL_HTTP.REQUEST('http://internal-api.example.internal/health');

END;

/

Expected output

System altered.

ALTER SYSTEM SET sga_target = 64G
*
ERROR at line 1:
ORA-01031: insufficient privileges

DECLARE
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYS.UTL_HTTP", line 1530
ORA-06512: at line 4

What to expect: The allowed parameter changes, while SGA_TARGET and the outbound HTTP call are refused. The error is a plain insufficient privileges, which can confuse a team that holds the privilege; tell them in advance that a lockdown profile is in place, so the error is understood.



Step 8: Roll Out to the Other PDBs

When the test team has run its normal releases and jobs for a week without problems, assign the profile to the remaining PDBs. Setting it in the root makes it the default for every PDB that has no profile of its own, including new ones.


SQL

-- Connected to CDB$ROOT as SYSDBA

ALTER SYSTEM SET pdb_lockdown = 'APP_TENANT' SCOPE = BOTH SID = '*';

COLUMN pdb_name FORMAT A12

COLUMN value FORMAT A12

SELECT p.name AS pdb_name,

NVL(sp.value, (SELECT value FROM v$system_parameter

WHERE con_id = 1 AND name = 'pdb_lockdown')) AS value

FROM v$pdbs p

LEFT JOIN v$system_parameter sp

ON sp.con_id = p.con_id AND sp.name = 'pdb_lockdown'

WHERE p.name <> 'PDB$SEED'

ORDER BY p.name;

Expected output

System altered.

PDB_NAME     VALUE
------------ ------------
TEAMA_PDB    APP_TENANT
TEAMB_PDB    APP_TENANT
TEAMC_PDB    APP_TENANT

What to expect: Every tenant PDB now works under the profile, TEAMA_PDB through its own setting and the others through the default from the root. A PDB created tomorrow gets the same rules without anyone remembering to set them. Note that a lockdown profile set in the root does not restrict the root itself.



Step 9: Give One PDB an Exception

Sooner or later one team needs something the standard profile blocks. Instead of weakening APP_TENANT for everyone, create a second profile based on it and assign it to that PDB only.


SQL

CREATE LOCKDOWN PROFILE app_tenant_http FROM app_tenant;

ALTER LOCKDOWN PROFILE app_tenant_http ENABLE FEATURE = ('NETWORK_ACCESS');

ALTER SESSION SET CONTAINER = teamc_pdb;

ALTER SYSTEM SET pdb_lockdown = 'APP_TENANT_HTTP' SCOPE = BOTH;

SHOW PARAMETER pdb_lockdown

Expected output

Lockdown Profile created.

Lockdown Profile altered.

Session altered.

System altered.

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pdb_lockdown                         string      APP_TENANT_HTTP

What this does: TEAMC_PDB gets all the rules of APP_TENANT except the network block, and the decision is visible in the dictionary rather than hidden in a weakened shared profile. A profile created with FROM is a static copy; changes to APP_TENANT later are not inherited, so record both profiles in the platform change process. In this PDB, restrict the hosts it may reach with DBMS_NETWORK_ACL_ADMIN as well.



Summary

Lockdown profiles let a shared CDB give each team a real PDB administrator without giving away the platform. Check which profiles apply today, create a profile in the root, and restrict ALTER SYSTEM for local users to the few parameters teams need. Disable the NETWORK_ACCESS and OS_ACCESS feature bundles, review the rules in DBA_LOCKDOWN_PROFILES, and assign the profile to one PDB to test it as the tenant's administrator. Then set it in the root as the default for every PDB, and handle exceptions with a separate profile for the PDB that needs it, never by loosening the shared one.

Recent Posts

See All

Comments


bottom of page