Oracle environment variable Settings script

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.