opatchauto must run from one of the homes specified
Met an error when I tried to apply a patch by root.
[root@primary01 ~]# opatchauto apply /home/patches/31307682 -analyze
opatchauto must run from one of the homes specified
opatchauto returns with error code = 2
opatchauto seemed confused about what homes should be applied first. How does it know about homes? Let's check environment variables.
[root@primary01 ~]# env | grep HOME
...
GRID_HOME=/u01/app/12.1.0/grid
ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
Indeed, there're multiple homes. But when did I set them? Let's continue our investigation.
[root@primary01 ~]# cat /root/.bash_profile
...
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
export GRID_HOME=/u01/app/12.1.0/grid/
Oh, that's why I got this error.
So next, I unset both variables.
[root@primary01 ~]# unset GRID_HOME
[root@primary01 ~]# unset ORACLE_HOME
I can continue my job. Just don't forget to remove them from the profile at a later time
Thanks a lot.
My pleasure!