Every time is silly to BASHRC inside write environment variable, feel not wayward. So, after reading this book to understand/etc/oratab this east, refer to the book also wrote a script to set the Oracle environment variable.
Create Oraset under/etc/, with permission set to Chown Oracle:oinstall/etc/oraset
Oraset content:
#!/bin/bash# sets Oracle environment variables.# Setup:1. Put Orasetfile inch/etc (Linux),inch/var/opt/Oracle (Solaris) #2. Ensure/etc Or/var/opt/oracle isinch$PATH # Usage:batch mode:. Oraset<SID># Menu Mode:. oraset#=======================================================if[-f/etc/oratab]; ThenOtab=/etc/Oratabelif[-f/var/opt/oracle/oratab]; ThenOtab=/var/opt/oracle/OratabElse Echo 'oratab file not found.'Exitfi#if[-Z $1]; Thensidlist=$(Egrep-V'#|\*'${otab} |Cut-F1-d:) # PS3 inmdicates the prompt to be used forThe BashSelectcommand. PS3='SID?' SelectSidinch${sidlist}; Do if[-N $sid]; ThenHold_sid=$sid break; fi DoneElse if Egrep-V'#|\*'${otab} |grep-W "${1}:">/dev/NULL; ThenHold_sid=$1 Else Echo "SID: \ found in $OTAB" fi Shiftfi#ORACLE_SID=$HOLD _sidexport oracle_sidexport oracle_home=$(Egrep-V'#|\*'${otab} |grep-W$ORACLE _sid:|Cut-F2-d:) export Oracle_base=${oracle_home%%/product*}export TMP= $ORACLE _base/. /Tmpexport TMPDIR=$TMPexport tns_admin= $ORACLE _home/network/Adminexport adr_base= $ORACLE _base/Diagexport PATH= $PATH: $ORACLE _home/Binexport Ld_library_path= $LD _library_path: $ORACLE _home/lib
Then add it to the Oracle user's. BASHRC:
Source/etc/oraset xxxx
Note:
1. xxxx is the name of your SID.
2. The path is subject to personal installation.
3. Who knows how to add line numbers and odd-even lines to different colors in the live Writer's code brightness plugin?
Report:
System: Red Hat Enterprise Linux7.0
ORACLE:12C Enterprise
Reprint please specify the source
Oracle environment variable Settings script