When starting the Standby database, the alert log complains about ORA-28374 and shutdown the Media Recovery process.
Note: On this Oracle 18c database environment, PROD is the Primary Database. PRODDR is the standby database and standbyhost is the standby hostname.
Standby Oracle alert log shows:
2019-09-27T18:53:46.804678-04:00
Errors in file /oracle/oraBase/oracle/diag/rdbms/proddr/PRODDR/trace/PRODDR_pr00_3661.trc:
ORA-28374: typed master key not found in wallet
2019-09-27T18:53:46.825090-04:00
Background Media Recovery process shutdown (PRODDR)
Querying the v$encryption_wallet confirms that we have a wallet without a master key at the location /oracle/oraBase/oracle/admin/PRODDR/wallet.
SQL> set lines 200 pages 9999
SQL> col wrl_parameter for a45
SQL> col wrl_type for a10
SQL> col status for a10
SQL> col wallet_type for a15
SQL> select * from v$encryption_wallet;
WRL_TYPE WRL_PARAMETER STATUS WALLET_TYPE WALLET_ORDER KEYSTORE_MODE FULLY_BACKED_UP CON_ID
---------- --------------------------------------------- -------------------- --------------- --------------------------- ------------------------ --------------------------- ----------
FILE /oracle/oraBase/oracle/admin/PRODDR/wallet OPEN AUTOLOGIN SINGLE NONE NO 1
FILE OPEN AUTOLOGIN SINGLE UNITED NO 2
FILE OPEN_NO_MASTER_KEY AUTOLOGIN SINGLE UNITED UNDEFINED 3
The Primary has the good wallet with the master key.
WRL_TYPE WRL_PARAMETER STATUS WALLET_TYPE WALLET_ORDER KEYSTORE_MODE FULLY_BACKED_UP CON_ID
---------- --------------------------------------------- ---------- --------------- --------------------------- ------------------------ --------------------------- ----------
FILE /oracle/oraBase/oracle/admin/PROD/wallet OPEN AUTOLOGIN SINGLE NONE NO 1
FILE OPEN AUTOLOGIN SINGLE UNITED NO 2
FILE OPEN AUTOLOGIN SINGLE UNITED NO 3
To correct the ORA-28374 error, login as oracle OS user on the Primary host and copy the wallet to Standby.
Note: You should back up the old Standby wallet just in case.
$ scp -p /oracle/oraBase/oracle/admin/PROD/wallet/* standbyhost:/oracle/oraBase/oracle/admin/PROD/wallet/
On the Standby, open the wallet.
SQL> ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY "<same_password_on_primary>";
System altered.
Start the managed recovery.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT NODELAY;
Database altered.
HINT: If you want to put the wallet in a different location, modify the sqlnet.ora located in the $ORACLE_HOME/network/admin and specify the DIRECTORY where you want your wallet. Make sure you modify the sqlnet.ora in the database home owner and not the one in the Grid Infrastructure home.
The following sqlnet.ora example will tell oracle to look in /home/oracle/wallet:
NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)
SQLNET.EXPIRE_TIME=1
SQLNET.OUTBOUND_CONNECT_TIMEOUT=3
ENCRYPTION_WALLET_LOCATION=
(SOURCE=
(METHOD=FILE)
(METHOD_DATA=
(DIRECTORY=/home/oracle/wallet)))