Introduction
Bash_profile : Apart from the home directory to create and store files ,users need an environment to execute some of the tools and resources ,When a user logs in to a system the users work environment is determined by the initialization files ,these initialization files are defined by the users startup shell, The .bash_profile is a personal initialization file for configuring the user environment,the file is defined in your home directory and can be used modifying your work environment by setting custom environment variables and terminal settings,and instruction the sytem to start up the application ,in this we have two homes like GRID_HOME,and DB_HOME to startup the services of the cluster application and rdbms application.
Verify Cluster services - status
#cd /u01/app/11.2.0/grid/bin
#./crsctl check cluster -all
su - oracle
vi .bash_profile
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
GRID_HOME=/u01/app/11.2.0/grid; export GRID_HOME
DB_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export DB_HOME
ORACLE_HOME=$DB_HOME; export ORACLE_HOME
ORACLE_SID=prod1; export ORACLE_SID
BASE_PATH=/usr/sbin:$PATH; export BASE_PATH
PATH=$ORACLE_HOME/bin:$BASE_PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
:wq!
$. .bash_profile
Now... create grid_env
$vi grid_env
ORACLE_SID=+ASM2; export ORACLE_SID
ORACLE_HOME=$GRID_HOME; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$BASE_PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
:wq!
$vi db_env
ORACLE_SID=prod2; export ORACLE_SID
ORACLE_HOME=$DB_HOME; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$BASE_PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
:wq!
$chmod +x db_env
$chmod +x grid_env
To login to grid - for asm instance
$. grid_env
$echo $ORACLE_SID
$echo $ORACLE_HOME
sqlplus "/as sysasm"
sql>
To login to DB
. db_env
sqlplus '/as sysdba'
Two home
Grid home
db home
Note : Info on bash_profile it may differ in your environment production,testing,development,and directories etc
THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME OR SUBSCRIBE ME