Oracle RAC - grid_env of the user oracle
Oracle RAC Solution · Config document · referenced from Database creation and user environments
A small file of environment variables that the user oracle sources to point the current shell at the Grid Infrastructure home and the local ASM instance. It is not run as a script: the alias grid_env in .bash_profile sources it.
| Item | Value |
|---|---|
| Path | /home/oracle/grid_env |
| Shown here | oradb01 |
| Deployed on | oradb01 and oradb02, one line differs |
| Activated with | grid_env, an alias for . /home/oracle/grid_env |
| Depends on | GRID_HOME and BASE_PATH from .bash_profile |
| Counterpart | db_env |
The file
ORACLE_SID=+ASM1; 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
On the second node the notes show the first line and ... for the rest:
| Host | Line | Value |
|---|---|---|
oradb01 | ORACLE_SID | +ASM1 |
oradb02 | ORACLE_SID | +ASM2 |
The lines one by one:
| Line | What it does |
|---|---|
ORACLE_SID=+ASM1 | The local ASM instance instead of the database instance |
ORACLE_HOME=$GRID_HOME | /data/u01/app/grid11204, taken from the variable the profile exports |
PATH=$ORACLE_HOME/bin:$BASE_PATH | Rebuilt from BASE_PATH, so the bin directory of the database home drops out and the one of the Grid home comes first |
LD_LIBRARY_PATH, CLASSPATH | The same two lines as in the profile, evaluated again with the new ORACLE_HOME |
The file leaves ORACLE_BASE at /data/u01/app/oracle, the value from the profile of oracle, and it does not change the alias sql, which stays sqlplus / as sysdba. The notes test the switch only by printing ORACLE_HOME; they do not show a connection to the ASM instance made this way.
Oracle ships a switcher of its own: root.sh of both homes put oraenv, coraenv and dbhome into /usr/local/bin, as its output shows. The two hand-written files were used instead; the notes do not say why.