Environment variable for two oracle_home i have installed oracle binaries at two different location on Oracle Linux , /u01 &amp; /u02
when i set environment variable for databases created for oracle_home in /u01 it works fine as i edited .profile but when i set environment variable for the databases created in /u02 it does not change the environment and i use to set it manually . Like , PATH, LIBRARY, CLASS PATH, ORACLE_BASE etc.

i have tried setting both the environment variable in .profile but it seems to be not working.

where do i make the entry to change it automatically ?
I suggest you don't set the environment variables in .profile. Instead use the oraenv utility to change the environment to suite the instance you want to connect to.