Today I stumbled across a strange error when I tried to run orachk on a customer’s system:
$ ./orachk Enter ORACLE_HOME for PRODDB : /opt/oracle/product/rdbms/12.1.0 Could not login to PRODDB using /opt/oracle/product/rdbms/12.1.0. Try again (3 attempts remaining) Enter ORACLE_HOME for PRODDB : a.s.f...
A quick internet search revealed nothing useful, so I checked MOS. Document 1989401.1 had the right hint: It was due to a customized “login.sql” that had an “ALTER SESSION …” in it. This leads to incorrect results for orachk’s scripts. Disabling login.sql (or glogin.sql, if you use this one) solved the problem.
Side note: The Oracle Docs say that “login.sql” is executed from your current directory or from the directory list in $SQLPATH. Neither of that applied to my environment, but ORACLE_PATH was set and pointed to a directory containing login.sql. Looks like this important detail is missing in the docs.