TDE - Lost Your TDE Wallet Password? There IS a Recovery Path - What Happens When You Lose the TDE Password?
Lost Your TDE Wallet Password?
There IS a Recovery Path!
You cannot recover the original TDE wallet password — but if an Auto-Login wallet (cwallet.sso) exists and the keystore is open, you can create a new wallet with a new password and continue accessing your encrypted data — with zero data loss.
The Scenario — What Happens When You Lose the TDE Password?
It happens more often than DBAs admit: the TDE wallet password was set by a colleague who left the team, stored in a password manager no one can access, or simply forgotten after a long period without keystore operations. The database is running, encrypted data is accessible — but the moment you need to do a keystore operation (key rotation, adding a new tablespace, manual wallet open after restart), you hit a wall.
ewallet.p12. The only path forward is creating a new wallet with a new password.
The One Critical Prerequisite — cwallet.sso
The entire recovery path hinges on a single file: cwallet.sso — the Auto-Login wallet. This file is created when you run ADMINISTER KEY MANAGEMENT CREATE AUTO_LOGIN KEYSTORE. Unlike ewallet.p12 (which requires a password), cwallet.sso opens automatically via OS-level authentication.
❌ Recovery NOT Possible
- Only ewallet.p12 exists
- Keystore is CLOSED
- cwallet.sso was never created
- cwallet.sso was deleted
- Database was restarted without auto-login
✅ Recovery IS Possible
- cwallet.sso exists in WALLET_ROOT
- Keystore STATUS = OPEN (auto-login active)
- Database is running (not restarted since last open)
- SYSDBA or SYSKM privilege available
- Master Encryption Keys are intact
Step 0: Check Your Current State
Before anything else, verify whether recovery is possible in your environment.
-- 1. Check keystore status — STATUS must be OPEN or OPEN_NO_MASTER_KEY SELECT wrl_type, wrl_parameter, status, wallet_type, con_id FROM v$encryption_wallet; -- STATUS should be: OPEN or OPEN_NO_MASTER_KEY -- WALLET_TYPE should be: AUTOLOGIN or PASSWORD -- If STATUS = CLOSED → Recovery path is NOT available without the password -- 2. Check physical wallet files in your WALLET_ROOT SELECT value FROM v$parameter WHERE name = 'wallet_root'; -- Then from OS shell — verify both files exist: -- $ ls -la $WALLET_ROOT/tde/ -- cwallet.sso ← Auto-Login wallet (the recovery enabler) -- ewallet.p12 ← Password-protected wallet -- 3. Check existing encryption keys SELECT key_id, creation_time, activation_time, keystoretype FROM v$encryption_keys ORDER BY creation_time DESC;
Decision Tree — Which Path Are You On?
The Recovery Procedure — Step by Step
ewallet.p12 and cwallet.sso as-is before any changes.
Back Up Your Existing Wallet Files
Copy the entire wallet directory before any changes. This is your rollback point.
# Step 1: Backup WALLET_ROOT directory (DO THIS FIRST) WALLET_ROOT="/etc/oracle/wallets/${ORACLE_SID}/tde" BACKUP_DIR="/backup/tde_wallet_$(date +%Y%m%d_%H%M%S)" mkdir -p $BACKUP_DIR cp -p $WALLET_ROOT/* $BACKUP_DIR/ ls -la $BACKUP_DIR # Verify both files backed up: # ewallet.p12 (password-protected — old, inaccessible password) # cwallet.sso (auto-login — this is the recovery key)
Confirm Keystore is Open via Auto-Login
The keystore must currently be OPEN. If the database was restarted and no auto-login wallet exists, this path is unavailable.
-- Verify keystore is OPEN — this is the go/no-go check SELECT wrl_type, status, wallet_type, fully_backed_up FROM v$encryption_wallet; -- Expected output (recovery possible): -- WRL_TYPE STATUS WALLET_TYPE FULLY_BACKED_UP -- FILE OPEN AUTOLOGIN NO ← GOOD: auto-login open -- FILE OPEN PASSWORD NO ← GOOD: password-opened (use known pwd) -- -- Recovery NOT possible if: -- FILE CLOSED UNKNOWN NO ← CLOSED = need password to open -- For CDB: check all PDB keystores too SELECT con_id, status, wallet_type FROM v$encryption_wallet ORDER BY con_id;
Create a New Password-Protected Wallet FROM the Open Keystore
This is the core recovery command. Oracle copies all existing Master Encryption Keys from the currently-open keystore into a brand new ewallet.p12 protected by your chosen new password.
-- THE KEY RECOVERY COMMAND -- Creates a new ewallet.p12 with NewPassword from the currently-open keystore -- All existing Master Encryption Keys are preserved ADMINISTER KEY MANAGEMENT CREATE KEYSTORE '/etc/oracle/wallets/${ORACLE_SID}/tde' IDENTIFIED BY "YourNewStrongPassword@2024" FROM KEYSTORE IDENTIFIED EXTERNALLY; -- NOTE: "IDENTIFIED EXTERNALLY" means Oracle reads from the -- currently-open auto-login (cwallet.sso) keystore. -- This does NOT require the old password. -- The command REPLACES ewallet.p12 with a new file using the new password. -- For CDB environments — run in the CDB root (not a PDB) ALTER SESSION SET container = CDB$ROOT; ADMINISTER KEY MANAGEMENT CREATE KEYSTORE '/etc/oracle/wallets/${ORACLE_SID}/tde' IDENTIFIED BY "YourNewStrongPassword@2024" FROM KEYSTORE IDENTIFIED EXTERNALLY CONTAINER=ALL;
Verify the New Password Works
Test the new password immediately by closing and re-opening the keystore with the new credentials.
-- Close the keystore (now uses new ewallet.p12) ADMINISTER KEY MANAGEMENT SET KEYSTORE CLOSE IDENTIFIED BY "YourNewStrongPassword@2024" CONTAINER=ALL; -- Re-open with new password — if this succeeds, recovery is complete ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY "YourNewStrongPassword@2024" CONTAINER=ALL; -- Verify keystore is open and keys are accessible SELECT status, wallet_type, fully_backed_up FROM v$encryption_wallet; -- Confirm all MEKs are intact SELECT key_id, creation_time, activation_time FROM v$encryption_keys ORDER BY creation_time; -- Verify encrypted tablespaces are still accessible SELECT tablespace_name, encrypted, encryption_algorithm FROM v$encrypted_tablespaces;
Regenerate the Auto-Login Wallet with the New Password
After creating the new ewallet.p12, regenerate cwallet.sso so it stays in sync with the new wallet. This also ensures future database restarts work without manual intervention.
-- Regenerate cwallet.sso from the newly-created ewallet.p12 ADMINISTER KEY MANAGEMENT CREATE AUTO_LOGIN KEYSTORE FROM KEYSTORE '/etc/oracle/wallets/${ORACLE_SID}/tde' IDENTIFIED BY "YourNewStrongPassword@2024"; -- Verify cwallet.sso was created/updated on OS: -- $ ls -la $WALLET_ROOT/tde/ -- -rw-r----- cwallet.sso ← Updated auto-login (synced with new ewallet.p12) -- -rw-r----- ewallet.p12 ← New password-protected wallet -- Final verification: keystore opens automatically (simulates restart) ADMINISTER KEY MANAGEMENT SET KEYSTORE CLOSE IDENTIFIED BY "YourNewStrongPassword@2024" CONTAINER=ALL; -- Open via auto-login (no password needed = simulates post-restart auto-open) ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED EXTERNALLY CONTAINER=ALL; SELECT status, wallet_type FROM v$encryption_wallet; -- Expected: STATUS=OPEN, WALLET_TYPE=AUTOLOGIN ← SUCCESS
Data Guard Environments — Extra Steps
If you're running a Data Guard configuration, the new wallet must be propagated to all Standby databases after recovery.
-- After recovery on PRIMARY, sync to Standby: -- Step 1: Copy both wallet files to Standby's WALLET_ROOT -- $ scp $WALLET_ROOT/tde/ewallet.p12 oracle@standby:$WALLET_ROOT/tde/ -- $ scp $WALLET_ROOT/tde/cwallet.sso oracle@standby:$WALLET_ROOT/tde/ -- Step 2: Open keystore on Standby with new password ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY "YourNewStrongPassword@2024" CONTAINER=ALL; -- Step 3: Verify standby TDE sync status SELECT dest_id, db_unique_name, tde_keystore_status, status FROM v$archive_dest_status WHERE status = 'VALID'; -- Using Oracle Key Vault (OKV)? -- Key sync is automatic — just ensure OKV is reachable from Standby -- Verify: ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED EXTERNALLY;
Troubleshooting Common Errors
| Error | Cause | Fix |
|---|---|---|
ORA-46656 |
cwallet.sso missing or corrupted | Restore from RMAN backup; contact Oracle Support |
ORA-28365 |
Keystore is CLOSED — cannot create from closed keystore | Recovery path unavailable without password; restore wallet from backup |
ORA-46655 |
Keystore path does not exist or insufficient permissions | Verify WALLET_ROOT path; check OS permissions for oracle user |
| New password not accepted | Weak password — Oracle enforces complexity rules | Use mixed case, numbers, special chars: Wallet@2024#Secure |
| CDB: some PDBs still show CLOSED | CONTAINER=ALL not used |
Re-run with CONTAINER=ALL or connect to each PDB and open individually |
| Keys missing after recovery | MEK was in a different keystore location (HSM vs FILE) | Run SELECT * FROM v$encryption_keys on both; use MERGE KEYSTORE |
Prevention — Best Practices to Avoid This Again
Always Create an Auto-Login Wallet
Create cwallet.sso immediately after setting up your keystore. This is both your operational convenience tool AND your recovery insurance. Run: ADMINISTER KEY MANAGEMENT CREATE AUTO_LOGIN KEYSTORE FROM KEYSTORE '/path' IDENTIFIED BY "pwd";
Store the Password in a Vault or PAM Tool
Use CyberArk, HashiCorp Vault, Oracle Key Vault, or your organisation's PAM solution. Never store TDE passwords only in a personal password manager or undocumented.
Include Wallet Files in RMAN Backup
RMAN does not back up wallet files by default. Script an OS-level backup of WALLET_ROOT after every keystore change (key rotation, new password). Keep 3+ generations.
Test Password Rotation Quarterly
Add a quarterly calendar event to verify the wallet password on all databases. Open and close the keystore manually: SET KEYSTORE OPEN → SET KEYSTORE CLOSE. Catch issues before they become emergencies.
Use Oracle Key Vault for Enterprise Deployments
OKV eliminates the lost-password problem entirely for most scenarios. Keys are centrally managed, access-controlled, and audited. Especially critical for Data Guard and RAC environments.
Quick Reference — All Commands
-- ═══════════════════════════════════════════════════════════ -- ORACLE TDE WALLET PASSWORD RECOVERY — FULL COMMAND REFERENCE -- Prerequisite: cwallet.sso exists + keystore STATUS = OPEN -- ═══════════════════════════════════════════════════════════ -- DIAGNOSE: Check current state SELECT wrl_type,status,wallet_type FROM v$encryption_wallet; -- BACKUP: OS-level wallet backup (run from shell) -- cp -rp $WALLET_ROOT/tde /backup/tde_$(date +%Y%m%d) -- RECOVER: Create new wallet from open auto-login keystore ADMINISTER KEY MANAGEMENT CREATE KEYSTORE '/path/to/wallet' IDENTIFIED BY "NewPassword@2024" FROM KEYSTORE IDENTIFIED EXTERNALLY CONTAINER=ALL; -- TEST: Close and reopen with new password ADMINISTER KEY MANAGEMENT SET KEYSTORE CLOSE IDENTIFIED BY "NewPassword@2024" CONTAINER=ALL; ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY "NewPassword@2024" CONTAINER=ALL; -- REGEN: Rebuild auto-login wallet from new ewallet.p12 ADMINISTER KEY MANAGEMENT CREATE AUTO_LOGIN KEYSTORE FROM KEYSTORE '/path/to/wallet' IDENTIFIED BY "NewPassword@2024"; -- VERIFY: All keys intact SELECT status,wallet_type FROM v$encryption_wallet; SELECT tablespace_name,encrypted FROM v$encrypted_tablespaces;
Post a Comment: