DBAtlas · Database operations atlas

Create, open, set the master key of and back up a TDE keystore (19c+)

OracleSecurity

Command

-- 1) Keystore location (static parameter, restart required), then keystore type:
ALTER SYSTEM SET WALLET_ROOT = '/u01/app/oracle/admin/ORCL/wallet' SCOPE = SPFILE;
-- SHUTDOWN IMMEDIATE;  STARTUP;
ALTER SYSTEM SET TDE_CONFIGURATION = 'KEYSTORE_CONFIGURATION=FILE' SCOPE = BOTH;

-- 2) In CDB root: create a software keystore (under WALLET_ROOT/tde), open it, set the master key
ADMINISTER KEY MANAGEMENT CREATE KEYSTORE IDENTIFIED BY "<keystore_pwd>";
ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN
  IDENTIFIED BY "<keystore_pwd>" CONTAINER = ALL;
ADMINISTER KEY MANAGEMENT SET KEY USING TAG 'mk_2026_10'
  IDENTIFIED BY "<keystore_pwd>" WITH BACKUP USING 'mk_before' CONTAINER = ALL;

-- 3) Open automatically after restart (auto-login, cwallet.sso):
ADMINISTER KEY MANAGEMENT CREATE AUTO_LOGIN KEYSTORE
  FROM KEYSTORE IDENTIFIED BY "<keystore_pwd>";

-- 4) Backup (repeat after every SET KEY / rekey, store SEPARATELY from database backups):
ADMINISTER KEY MANAGEMENT BACKUP KEYSTORE USING 'daily'
  FORCE KEYSTORE IDENTIFIED BY "<keystore_pwd>" TO '/backup/tde/';

-- 5) Status:
SELECT con_id, wrl_type, wrl_parameter, status, wallet_type, keystore_mode
FROM   v$encryption_wallet;
SELECT con_id, key_id, tag, creation_time, activation_time
FROM   v$encryption_keys ORDER BY creation_time;

What it does

Sets up a software keystore for Transparent Data Encryption in united mode (all PDBs share the CDB keystore), creates the master encryption key and enables auto-login so it opens after restart. In 19c+ the recommended method is WALLET_ROOT/TDE_CONFIGURATION instead of sqlnet.ora ENCRYPTION_WALLET_LOCATION.

When to use it

As the first step before tablespace/column encryption in compliance projects that require data-at-rest encryption (GDPR, PCI-DSS, ISO 27001).

Caution

On-premises requires the Advanced Security option (extra cost); it is included in Oracle Cloud (OCI/Autonomous) licensing. WALLET_ROOT is static and needs an instance restart (downtime). If the keystore and its password are lost, encrypted data is PERMANENTLY unreadable; store keystore backups securely and separately from database backups. Anyone holding the auto-login file (cwallet.sso) can open the database; restrict file permissions and use LOCAL AUTO_LOGIN where appropriate. With Data Guard, copy the keystore to the standby as well.

Open in DBAtlas →

Related