top of page

Transparent Data Encryption (TDE) in Oracle Database 23ai — Implementation & Management Runbook

OmerNarman
Sep 27
7 min read

Updated: Oct 24

Environment used in this runbook:

  • Database: Oracle Database 23ai, multitenant (CDB CDB23, PDB PDB1)

  • Platform: Linux x86-64

  • Keystore: software keystore (wallet)

  • Privileges: commands run as SYS or a user holding SYSKM unless stated otherwise


Why TDE?

TDE encrypts data at rest: datafiles, and by extension redo, undo, temp and RMAN backups of encrypted tablespaces. Applications don't change; decryption happens transparently for authorised sessions. A stolen datafile or backup is useless without the keystore.

TDE uses a two-tier key architecture:

  • TDE master encryption key (MEK) — lives outside the database in a keystore (software wallet, Oracle Key Vault or an HSM).

  • Tablespace / column keys — stored inside the database (datafile headers, data dictionary), encrypted by the MEK.

Rotate the MEK and every tablespace key is protected by the new key without rewriting data.

What is different in 23ai (read before you start)

  • ENCRYPTION_WALLET_LOCATION in sqlnet.ora is desupported. The keystore location is defined only by the WALLET_ROOT and TDE_CONFIGURATION initialization parameters.

  • Default algorithm is AES256 for both tablespace and column encryption (used to be AES128 / AES192). Tablespace keys now use AES-XTS mode, column encryption uses AES-GCM.

  • GOST and SEED algorithms are deprecated for new keys.

  • Every 23ai database is a CDB, so you decide between united mode (one keystore in the root for all PDBs) and isolated mode (a PDB owns its keystore).

  • Licensing: on-premises TDE belongs to Oracle Advanced Security (Enterprise Edition); on OCI database services it is included. Confirm your entitlement before rolling out.

Step 1 — Verify the starting point

SQL

SELECT banner_full FROM v$version;

SELECT wrl_type, wrl_parameter, status, wallet_type, keystore_mode, con_id

FROM v$encryption_wallet;

Why: you want to see STATUS = NOT_AVAILABLE (no keystore yet) and confirm nothing is left over from sqlnet.ora. If WRL_PARAMETER still shows a sqlnet.ora-derived path, remove that entry first.

Step 2 — Create the keystore directory

Shell

mkdir -p /u01/app/oracle/admin/CDB23/wallet/tde

chmod 700 /u01/app/oracle/admin/CDB23/wallet /u01/app/oracle/admin/CDB23/wallet/tde

Why: with WALLET_ROOT = /u01/app/oracle/admin/CDB23/wallet, Oracle expects the root keystore in $WALLET_ROOT/tde and isolated PDB keystores in $WALLET_ROOT/<PDB_GUID>/tde. Keep the directory owned by the oracle OS user only. For RAC or Data Guard, place it on shared storage (ACFS, ASM +DATA) or copy it to every node.

Step 3 — Point the database at the keystore

SQL

-- static parameter: needs a restart

ALTER SYSTEM SET WALLET_ROOT = '/u01/app/oracle/admin/CDB23/wallet' SCOPE = SPFILE;

SHUTDOWN IMMEDIATE

STARTUP

-- dynamic parameter, only accepted once WALLET_ROOT is active

ALTER SYSTEM SET TDE_CONFIGURATION = 'KEYSTORE_CONFIGURATION=FILE' SCOPE = BOTH;

Why: WALLET_ROOT is the base directory, TDE_CONFIGURATION says which kind of keystore lives there (FILE = wallet, OKV = Oracle Key Vault, FILE|OKV for migration).

Step 4 — Create the password-protected keystore (root container)

SQL

ADMINISTER KEY MANAGEMENT CREATE KEYSTORE IDENTIFIED BY "Wallet#Pwd_2026";

Why: no path is needed — Oracle derives it from WALLET_ROOT. This creates ewallet.p12. Store the password in your secrets vault; losing keystore + password means losing the data.

Step 5 — Open the keystore

SQL

ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY "Wallet#Pwd_2026" CONTAINER = ALL;

SELECT con_id, status, wallet_type, keystore_mode FROM v$encryption_wallet;

Why: CONTAINER = ALL opens it for the root and all open PDBs (united mode). Expect OPEN_NO_MASTER_KEY until Step 6.

Step 6 — Set the master encryption key

SQL

ADMINISTER KEY MANAGEMENT SET KEY

USING TAG 'CDB23 initial key'

IDENTIFIED BY "Wallet#Pwd_2026"

WITH BACKUP USING 'initial_key'

CONTAINER = ALL;

SELECT con_id, key_id, tag, creation_time FROM v$encryption_keys ORDER BY con_id;

Why: each container gets its own MEK; WITH BACKUP writes a copy of the keystore (ewallet_<timestamp>_initial_key.p12) before changing it. Status now shows OPEN.

Step 7 — Make the keystore auto-login

SQL

ADMINISTER KEY MANAGEMENT CREATE AUTO_LOGIN KEYSTORE

FROM KEYSTORE '/u01/app/oracle/admin/CDB23/wallet/tde'

IDENTIFIED BY "Wallet#Pwd_2026";

SELECT wallet_type, status FROM v$encryption_wallet WHERE con_id = 1;

Why: without auto-login someone must type the password at every startup, and encrypted SYSTEM/SYSAUX (Step 10) would not even open. cwallet.sso is created next to ewallet.p12. Use CREATE LOCAL AUTO_LOGIN to tie the file to this host (single-instance only — not for RAC or Data Guard, where the file is copied between hosts). The password keystore stays the source of truth; keep both files.

Step 8 — Create an encrypted tablespace

SQL

ALTER SESSION SET CONTAINER = PDB1;

CREATE TABLESPACE secure_data

DATAFILE SIZE 500M AUTOEXTEND ON NEXT 100M

ENCRYPTION USING 'AES256' ENCRYPT;

SELECT tablespace_name, encrypted FROM dba_tablespaces;

Why: in 23ai ENCRYPTION ENCRYPT alone already means AES256; the USING clause is here to make intent explicit. Everything stored in the tablespace is encrypted, including indexes, LOBs and undo/redo generated for it.

Step 9 — Encrypt an existing tablespace online (no downtime)

SQL

ALTER TABLESPACE users

ENCRYPTION ONLINE USING 'AES256' ENCRYPT

FILE_NAME_CONVERT = ('users01.dbf', 'users01_enc.dbf');

SELECT ts#, encryptionalg, status FROM v$encrypted_tablespaces;

Why: the online conversion writes an encrypted copy of each datafile while users keep working. You need free space equal to the largest datafile in the tablespace. FILE_NAME_CONVERT is mandatory unless you use OMF/ASM. Alternatively, ENCRYPTION OFFLINE ENCRYPT while the tablespace is offline (faster, needs no extra space, but is downtime).

Step 10 — Encrypt SYSTEM, SYSAUX, UNDO and TEMP

SQL

-- root and each PDB separately, all online

ALTER TABLESPACE system ENCRYPTION ONLINE ENCRYPT FILE_NAME_CONVERT = ('system01.dbf','system01_enc.dbf');

ALTER TABLESPACE sysaux ENCRYPTION ONLINE ENCRYPT FILE_NAME_CONVERT = ('sysaux01.dbf','sysaux01_enc.dbf');

ALTER TABLESPACE undotbs1 ENCRYPTION ONLINE ENCRYPT FILE_NAME_CONVERT = ('undotbs01.dbf','undotbs01_enc.dbf');

-- TEMP cannot be converted: create an encrypted one and swap

CREATE TEMPORARY TABLESPACE temp_enc TEMPFILE SIZE 1G ENCRYPTION ENCRYPT;

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp_enc;

DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES;

Why: encrypting only application tablespaces leaves cleartext copies in undo, temp and the dictionary (e.g. statistics histograms). Prerequisite for SYSTEM/SYSAUX: an auto-login keystore (Step 7), otherwise the instance cannot open.

Step 11 — Encrypt every new tablespace automatically

SQL

ALTER SYSTEM SET TABLESPACE_ENCRYPTION = 'AUTO_ENABLE' SCOPE = SPFILE;

ALTER SYSTEM SET TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHM = 'AES256' SCOPE = BOTH;

Why: AUTO_ENABLE makes every CREATE TABLESPACE encrypted even without the ENCRYPTION clause (it is the default on OCI). MANUAL_ENABLE is the on-premises default and DECRYPT_ONLY forbids creating encrypted tablespaces. Restart to apply the first parameter.

Step 12 — Column-level encryption (when only a few columns are sensitive)

SQL

ALTER TABLE hr.employees MODIFY (national_id ENCRYPT USING 'AES256' NO SALT);

SELECT owner, table_name, column_name, encryption_alg, salt

FROM dba_encrypted_columns;

Why: column encryption fits legacy tables where a tablespace rebuild is impossible. Rules: use NO SALT if the column is indexed; foreign-key columns cannot be encrypted; equality searches work, range scans on encrypted columns do not use the index. Tablespace encryption is the default recommendation; column encryption is the exception.

Step 13 — Rotate (rekey) the master key

SQL

ADMINISTER KEY MANAGEMENT SET KEY

USING TAG 'CDB23 rotation 2026Q3'

FORCE KEYSTORE

IDENTIFIED BY "Wallet#Pwd_2026"

WITH BACKUP USING 'rekey_2026Q3'

CONTAINER = ALL;

-- optional: rekey the tablespace key itself (rewrites the datafiles online)

ALTER TABLESPACE secure_data ENCRYPTION ONLINE USING 'AES256' REKEY;

Why: a MEK rotation is metadata-only and instant; old keys stay in the keystore so old backups remain restorable. FORCE KEYSTORE is required because the auto-login keystore is in use and Oracle must temporarily open the password keystore. Rekeying a tablespace key rewrites data and is rarely required (compliance, suspected key compromise).

Step 14 — Protect and back up the keystore

SQL

-- change the keystore password

ADMINISTER KEY MANAGEMENT ALTER KEYSTORE PASSWORD

FORCE KEYSTORE IDENTIFIED BY "Wallet#Pwd_2026" SET "Wallet#Pwd_2027"

WITH BACKUP USING 'pwd_change';

Shell

# keep the wallet backups away from database backups

ls -l /u01/app/oracle/admin/CDB23/wallet/tde/

# ewallet.p12 cwallet.sso ewallet_2026093012345_initial_key.p12 ...

Why: RMAN never backs up the keystore. Copy ewallet.p12 (and the ewallet_* backups) to a secure, separate location after every SET KEY. Backups of encrypted datafiles without the matching keystore cannot be restored. Recreate cwallet.sso after any password change (repeat Step 7).

Step 15 — Optional: isolate a PDB keystore (tenant-owned keys)

SQL

ALTER SESSION SET CONTAINER = PDB1;

ADMINISTER KEY MANAGEMENT ISOLATE KEYSTORE

IDENTIFIED BY "Pdb1#Pwd_2026"

FROM ROOT KEYSTORE FORCE KEYSTORE IDENTIFIED BY "Wallet#Pwd_2026"

WITH BACKUP;

SELECT con_id, keystore_mode, wallet_type, status FROM v$encryption_wallet;

Why: isolated mode gives the PDB its own ewallet.p12 under $WALLET_ROOT/<GUID>/tde, its own password and its own MEK lifecycle — useful for hosted/multi-tenant setups. ADMINISTER KEY MANAGEMENT UNITE KEYSTORE reverses it.

Step 16 — Unplug / plug / clone an encrypted PDB

SQL

-- in the source PDB: export its keys

ADMINISTER KEY MANAGEMENT EXPORT ENCRYPTION KEYS

WITH SECRET "transport#secret" TO '/tmp/pdb1_keys.exp'

FORCE KEYSTORE IDENTIFIED BY "Wallet#Pwd_2026";

-- in the target PDB after plugging in: import them

ADMINISTER KEY MANAGEMENT IMPORT ENCRYPTION KEYS

WITH SECRET "transport#secret" FROM '/tmp/pdb1_keys.exp'

FORCE KEYSTORE IDENTIFIED BY "TargetWallet#Pwd" WITH BACKUP;

Why: the PDB's data is encrypted with keys that only exist in the source keystore. CREATE PLUGGABLE DATABASE ... KEYSTORE IDENTIFIED BY ... and DECRYPT USING/ENCRYPT USING clauses cover the same need in one step for clones and unplug/plug.

Step 17 — Monitoring queries you will reuse

SQL

-- keystore health per container

SELECT con_id, status, wallet_type, keystore_mode, wrl_parameter FROM v$encryption_wallet;

-- which tablespaces are encrypted and with what

SELECT t.name, e.encryptionalg, e.encryptedts, e.status

FROM v$encrypted_tablespaces e JOIN v$tablespace t ON t.ts# = e.ts#;

-- unencrypted tablespaces still to convert

SELECT tablespace_name FROM dba_tablespaces WHERE encrypted = 'NO';

-- key history

SELECT con_id, key_id, tag, creation_time, activation_time FROM v$encryption_keys ORDER BY creation_time;

Operational checklist

Situation

What to do

Data Guard

Copy ewallet.p12 + cwallet.sso to the standby's WALLET_ROOT/tde after every SET KEY; standby must use the same MEK.

RAC

Same WALLET_ROOT on shared storage, or identical copies on every node (no LOCAL AUTO_LOGIN).

RMAN

Backups of encrypted tablespaces stay encrypted; add SET ENCRYPTION ON only for unencrypted ones. Test a restore on another host with the keystore.

Data Pump

Export of encrypted data is clear text unless you use ENCRYPTION=ALL ENCRYPTION_PASSWORD=... or ENCRYPTION_MODE=TRANSPARENT (keystore on the import side).

Performance

Tablespace encryption uses hardware AES-NI; expect single-digit % CPU overhead. Column encryption is costlier and limits indexing.

Compliance evidence

v$encryption_keys (rotation dates), dba_tablespaces.encrypted, wallet backup log.


Common errors

  • ORA-28365: wallet is not open — keystore closed after restart: create the auto-login keystore or open it manually.

  • ORA-28374: typed master key not found in wallet — datafile was encrypted with a MEK that is not in this keystore (restored old wallet or missing key import).

  • ORA-46693: The <keystore> keystore already exists — you re-ran CREATE KEYSTORE; open the existing one instead.

  • ORA-28417: password-based keystore is not open — use FORCE KEYSTORE in the command while auto-login is active.

Quick reference

SQL

ADMINISTER KEY MANAGEMENT SET KEYSTORE CLOSE IDENTIFIED BY "pwd";

ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY "pwd" CONTAINER = ALL;

ADMINISTER KEY MANAGEMENT SET KEY FORCE KEYSTORE IDENTIFIED BY "pwd" WITH BACKUP CONTAINER = ALL;

ALTER TABLESPACE x ENCRYPTION ONLINE ENCRYPT FILE_NAME_CONVERT = ('a.dbf','a_enc.dbf');

ALTER TABLESPACE x ENCRYPTION ONLINE DECRYPT FILE_NAME_CONVERT = ('a_enc.dbf','a.dbf');

Recent Posts

See All

Comments


bottom of page