This post contains some of the scripts I have been using on my TDE encrypted database to see the big picture of what is being encrypted by what key.
1) Wallet information
The first script I put together will list the status of wallets for all tenants on all nodes. This will give you the wallet location, type of wallet, united, etc.
Below is the output of this script for my single node, local wallet database.
INST_ID PDB Name Type WRL_PARAMETER Status WALLET_TYPE KEYSTORE Backed Up
---------- ---------- ---------- -------------------------------------------------- ------------------------------ -------------------- -------- ----------
1 CDB$ROOT FILE /home/oracle/app/oracle/admin/tdecdb/wallet/tde/ OPEN AUTOLOGIN NONE NO
PDB$SEED FILE OPEN AUTOLOGIN UNITED NO
PDBTDE1 FILE OPEN AUTOLOGIN UNITED NO
PDBTDE2 FILE OPEN AUTOLOGIN UNITED NO
PDBTDE3 FILE OPEN AUTOLOGIN UNITED NO
Below is a the output from a 4 node cluster with OKV configured.
INST_ID PDB Name Type WRL_PARAMETER Status WALLET_TYPE KEYSTORE Backed Up
------ ---------- ---------- ------------------------------------ -------------- ---------------- ------------- -------------------- -------- ----------
1 CDB$ROOT FILE /u02/app/oracle/admin/jckey/wallet/tde/ OPEN_NO_MASTER_KEY AUTOLOGIN NONE UNDEFINED
CDB$ROOT OKV OPEN OKV NONE UNDEFINED
JCKPDB FILE OPEN_NO_MASTER_KEY AUTOLOGIN UNITED UNDEFINED
JCKPDB OKV OPEN OKV UNITED UNDEFINED
PDB$SEED FILE OPEN_NO_MASTER_KEY AUTOLOGIN UNITED UNDEFINED
PDB$SEED OKV OPEN OKV UNITED UNDEFINED
2 CDB$ROOT FILE /u02/app/oracle/admin/jckey/wallet/tde/ OPEN_NO_MASTER_KEY AUTOLOGIN NONE UNDEFINED
CDB$ROOT OKV OPEN OKV NONE UNDEFINED
JCKPDB FILE OPEN_NO_MASTER_KEY AUTOLOGIN UNITED UNDEFINED
JCKPDB OKV OPEN OKV UNITED UNDEFINED
PDB$SEED FILE OPEN_NO_MASTER_KEY AUTOLOGIN UNITED UNDEFINED
PDB$SEED OKV OPEN OKV UNITED UNDEFINED
3 CDB$ROOT FILE /u02/app/oracle/admin/jckey/wallet/tde/ OPEN_NO_MASTER_KEY AUTOLOGIN NONE UNDEFINED
CDB$ROOT OKV OPEN OKV NONE UNDEFINED
JCKPDB FILE OPEN_NO_MASTER_KEY AUTOLOGIN UNITED UNDEFINED
JCKPDB OKV OPEN OKV UNITED UNDEFINED
PDB$SEED FILE OPEN_NO_MASTER_KEY AUTOLOGIN UNITED UNDEFINED
PDB$SEED OKV OPEN OKV UNITED UNDEFINED
4 CDB$ROOT FILE /u02/app/oracle/admin/jckey/wallet/tde/ OPEN_NO_MASTER_KEY AUTOLOGIN NONE UNDEFINED
CDB$ROOT OKV OPEN OKV NONE UNDEFINED
JCKPDB FILE OPEN_NO_MASTER_KEY AUTOLOGIN UNITED UNDEFINED
JCKPDB OKV OPEN OKV UNITED UNDEFINED
PDB$SEED FILE OPEN_NO_MASTER_KEY AUTOLOGIN UNITED UNDEFINED
PDB$SEED OKV OPEN OKV UNITED UNDEFINED
2) Tablespace information
This script will list the tablespaces, if the tablespace is encrypted, and what the key is.
Below is the output from my database.
PDB Name Tablespace Name Enc. Master Key ID Key ID tablespace Encryt key (trunc)
---------- --------------- ----- ------------------------- ----------------------------------- ------------------------------
CDB$ROOT SYSAUX NO AQbOELhZAk9Dv8A2mADBKQQ= 06CE10B859024F43BFC0369800C12904 9C21DCFF8CB7DCC6E038239DD07D3D
SYSTEM NO AQbOELhZAk9Dv8A2mADBKQQ= 06CE10B859024F43BFC0369800C12904 9C21DCFF8CB7DCC6E038239DD07D3D
TEMP NO AQbOELhZAk9Dv8A2mADBKQQ= 06CE10B859024F43BFC0369800C12904 9C21DCFF8CB7DCC6E038239DD07D3D
UNDOTBS1 NO AQbOELhZAk9Dv8A2mADBKQQ= 06CE10B859024F43BFC0369800C12904 9C21DCFF8CB7DCC6E038239DD07D3D
USERS YES AQbOELhZAk9Dv8A2mADBKQQ= 06CE10B859024F43BFC0369800C12904 9C21DCFF8CB7DCC6E038239DD07D3D
PDBTDE1 SYSAUX NO AYQysCoXXk+Nv/Q//9sUAV4= 8432B02A175E4F8DBFF43FFFDB14015E 4D7007D0FFFCB3F2702233BDD2702A
SYSTEM NO AYQysCoXXk+Nv/Q//9sUAV4= 8432B02A175E4F8DBFF43FFFDB14015E 4D7007D0FFFCB3F2702233BDD2702A
TEMP NO AYQysCoXXk+Nv/Q//9sUAV4= 8432B02A175E4F8DBFF43FFFDB14015E 4D7007D0FFFCB3F2702233BDD2702A
UNDOTBS1 NO AYQysCoXXk+Nv/Q//9sUAV4= 8432B02A175E4F8DBFF43FFFDB14015E 4D7007D0FFFCB3F2702233BDD2702A
USERS YES AYQysCoXXk+Nv/Q//9sUAV4= 8432B02A175E4F8DBFF43FFFDB14015E 4D7007D0FFFCB3F2702233BDD2702A
PDBTDE2 SYSAUX NO AegHs2QPk09xv0HVO3B1alQ= E807B3640F934F71BF41D53B70756A54 C3F9A04600AFE07F023589C0DE0ED8
SYSTEM NO AegHs2QPk09xv0HVO3B1alQ= E807B3640F934F71BF41D53B70756A54 C3F9A04600AFE07F023589C0DE0ED8
TEMP NO AegHs2QPk09xv0HVO3B1alQ= E807B3640F934F71BF41D53B70756A54 C3F9A04600AFE07F023589C0DE0ED8
UNDOTBS1 NO AegHs2QPk09xv0HVO3B1alQ= E807B3640F934F71BF41D53B70756A54 C3F9A04600AFE07F023589C0DE0ED8
USERS YES AegHs2QPk09xv0HVO3B1alQ= E807B3640F934F71BF41D53B70756A54 C3F9A04600AFE07F023589C0DE0ED8
PDBTDE3 SYSAUX NO AW5TJ43d8E+ZvxD8A1YhdcM= 6E53278DDDF04F99BF10FC03562175C3 6911A4106D914681528706E03202E6
SYSTEM NO AW5TJ43d8E+ZvxD8A1YhdcM= 6E53278DDDF04F99BF10FC03562175C3 6911A4106D914681528706E03202E6
TEMP NO AW5TJ43d8E+ZvxD8A1YhdcM= 6E53278DDDF04F99BF10FC03562175C3 6911A4106D914681528706E03202E6
UNDOTBS1 NO AW5TJ43d8E+ZvxD8A1YhdcM= 6E53278DDDF04F99BF10FC03562175C3 6911A4106D914681528706E03202E6
USERS YES AW5TJ43d8E+ZvxD8A1YhdcM= 6E53278DDDF04F99BF10FC03562175C3 6911A4106D914681528706E03202E6
3) Wallet Contents
Below you can see the master key ID for each CDB/PDB and information about when it was created.
Master Key ID Tag PDB Name KEYSTORE_TYPE Origin Key Creation Time Key Act. Time
------------------------------------------------------- -------------------- --------------- ----------------- ---------- ------------------ ------------------
ASd1jY/loU8Bv6HuSfZZFqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA cdbroot_first_key CDB$ROOT SOFTWARE KEYSTORE LOCAL 06/28/2021 17:46 06/28/2021 17:46
AQbOELhZAk9Dv8A2mADBKQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA cdbroot_second_key SOFTWARE KEYSTORE LOCAL 06/28/2021 18:46 06/28/2021 18:46
AfhjvV/z/U9ev5bICBLYV1MAAAAAAAAAAAAAAAAAAAAAAAAAAAAA pdbtde1_firstkey PDBTDE1 SOFTWARE KEYSTORE LOCAL 06/28/2021 17:53 06/28/2021 17:53
AYQysCoXXk+Nv/Q//9sUAV4AAAAAAAAAAAAAAAAAAAAAAAAAAAAA pdbtde1_second_key SOFTWARE KEYSTORE LOCAL 06/28/2021 18:50 06/28/2021 18:50
AVXCNjl3f0+Av+/osXobX2sAAAAAAAAAAAAAAAAAAAAAAAAAAAAA pdbtde2_firstkey PDBTDE2 SOFTWARE KEYSTORE LOCAL 06/28/2021 17:54 06/28/2021 17:54
AegHs2QPk09xv0HVO3B1alQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA pdbtde2_second_key SOFTWARE KEYSTORE LOCAL 06/28/2021 18:50 06/28/2021 18:50
Ab1/+jaPck+Ev6rhmBKtxXEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA pdbtde3_firstkey PDBTDE3 SOFTWARE KEYSTORE LOCAL 06/28/2021 17:54 06/28/2021 17:54
AW5TJ43d8E+ZvxD8A1YhdcMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA pdbtde1_second_key SOFTWARE KEYSTORE LOCAL 06/28/2021 18:50 06/28/2021 18:50
NOTE: I rotated my master key, and you can see both keys.. Adding a tag to the key helps identify the key also.
4) Control file Contents
This query looks at the x$jcbdbk table to determine the master key(s) currently in use.
PDB Name Key ID Master Key ID
--------------- ----------------------------------- -------------------------
CDB$ROOT 06CE10B859024F43BFC0369800C12904 AQbOELhZAk9Dv8A2mADBKQQ=
PDB$SEED 00000000000000000000000000000000 AQAAAAAAAAAAAAAAAAAAAAA=
PDBTDE1 8432B02A175E4F8DBFF43FFFDB14015E AYQysCoXXk+Nv/Q//9sUAV4=
PDBTDE2 E807B3640F934F71BF41D53B70756A54 AegHs2QPk09xv0HVO3B1alQ=
PDBTDE3 6E53278DDDF04F99BF10FC03562175C3 AW5TJ43d8E+ZvxD8A1YhdcM=
Conclusion :
By looking at the queries above you should have a better of idea of how the Master encryption key ties to the tablespace encryption.
You can also see what happens when you rotate the master key, and how it affects the tablespaces.
No comments:
Post a Comment