Oracle TDE Setup - nchillal/Oracle GitHub Wiki
In PR/HA/DP/DS
DB_UNIQUE_NAME=$(sqlplus -s / as sysdba <<!
SET HEADING OFF
SELECT value FROM v\$spparameter WHERE name = 'db_unique_name';
!
);
DB_UNIQUE_NAME=$(echo ${DB_UNIQUE_NAME}|tr -d '\n')
In PR/HA/DP/DS
mkdir -p ${ORACLE_BASE}/admin/${DB_UNIQUE_NAME}/wallet && ls -ld ${ORACLE_BASE}/admin/${DB_UNIQUE_NAME}/wallet
chmod -R 700 ${ORACLE_BASE}/admin
ENCRYPTION_WALLET_LOCATION =
(SOURCE = (METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = ${ORACLE_BASE}/admin/<DB_UNIQUE_NAME>/wallet)
)
)
NOTE: If the compatibility of the database is set to a release earlier than Oracle Database Release 10.2, then restart the database.
In PR
ALTER SYSTEM SET ENCRYPTION KEY IDENTIFIED BY &pwd;
The preceding command achieves the following
- If no encrypted wallet is present in the directory specified, an encrypted wallet is created (ewallet.p12), the wallet is opened, and the master encryption key for TDE is created/re-created.
- If an encrypted wallet is present in the directory specified, the wallet is opened, and the master encryption key for TDE is created/re-created.
COLUMN wrl_parameter FORMAT a60
SET LINESIZE 200 PAGESIZE 1000
SELECT * FROM v$encryption_wallet;
ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY &pwd;
cd ${ORACLE_BASE}/admin/${DB_UNIQUE_NAME}/wallet
orapki wallet create -wallet . -auto_login
chmod 600 ewallet.p12 cwallet.sso
chattr +i ewallet.p12 cwallet.sso
NOTE: Should be logged in as root.
lsattr ewallet.p12 cwallet.sso
NOTE: This is how it should be after making it immutable
----i--------e--- cwallet.sso
----i--------e--- ewallet.p12
scp -rp ewallet.p12 <Standby hostname>:${ORACLE_BASE}/admin/${DB_UNIQUE_NAME}/wallet
cd ${ORACLE_BASE}/admin/${DB_UNIQUE_NAME}/wallet
orapki wallet create -wallet . -auto_login
CREATE TABLESPACE data_tde_ts ENCRYPTION USING 'AES256'
DEFAULT STORAGE (ENCRYPT)
DATAFILE '+data' SIZE 8192M;
CREATE TABLESPACE index_tde_ts ENCRYPTION USING 'AES256'
DEFAULT STORAGE (ENCRYPT)
DATAFILE '+data' SIZE 8192M;
SELECT tablespace_name, encrypted
FROM dba_tablespaces
WHERE tablespace_name LIKE '%TDE%';
To know which encryption algorithm each of them use
SELECT * FROM v$encrypted_tablespaces;
ALTER SYSTEM SET ENCRYPTION WALLET CLOSE;
ALTER SYSTEM SET ENCRYPTION WALLET CLOSE IDENTIFIED BY &pwd;
Do not do change password if you unsure of it does.
cd ${ORACLE_BASE}/admin/${DB_UNIQUE_NAME}/wallet
orapki wallet change_pwd -wallet .
As root user, change permission to make ewallet.p12 and cwallet.sso mutable
chattr -i ewallet.p12 cwallet.sso
NOTE: This is how it should look after making it mutable.
-------------e--- cwallet.sso
-------------e--- ewallet.p12
-
Verify wallet location (SQL is above)
-
If v$encryption_wallet shows different wallet path than default ($ORACLE_BASE/admin/<DB_UNIQUE_NAME>/wallet), for database to pickup correct wallet, entry below content in sqlnet.ora to make sure correct encryption wallet location is picked.
ENCRYPTION_WALLET_LOCATION =
(SOURCE = (METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = ${ORACLE_BASE}/admin/<DB_UNIQUE_NAME>/wallet)
)
)