ADOP Apply Phase Error: You Must Be In Maintenance Mode To Apply Patches


Adop phase fails with the following error:

AutoPatch error:
You must be in Maintenance Mode to apply patches.
You can use the AD Administration Utility to set Maintenance Mode.
Additionally, connecting attempts to the PDB would fail with the following error:

$ sqlplus apps/<password>

ORA-12514: TNS:listener does not currently know of service requested in connect


The database local_listener parameter at the PDB level was set to the wrong value. It was pointing to an old hostname. The value for local_listener was <oldhostname>.<domain> when it should have been <newhostname>.<domain>. The value of local_listener is inherited from the CDB, so should not be set at all, it has to be reset. 

SQL> show parameter listener

------------------------------------ ----------- ------------------------------
forward_listener string
listener_networks string
local_listener string <oldhostname>.<domain> remote_listener string


Reset the value of the database local_listener parameter:

$ sqlplus / as sysdba
SQL> alter session set container=<PDB_SID>;
SQL> show parameter listener; <--- Check the wrong value
SQL> alter system reset local_listener scope=both;
SQL> shutdown immediate;
SQL> startup
SQL> show parameter listener; <--- Confirm the correct value

Check if you are able to successfully connect to the database using the APPS user.

If you like please follow and comment