Results 1 to 2 of 2

Thread: Coraenv

  1. #1
    Join Date
    Mar 2007
    Posts
    14

    Coraenv

    Hello,
    I installed Oracle 10g on Linux RH4
    when i make:
    Code:
    $>coraenv
    /home/oracle/oracle/product/10.2.0/db_1//bin/coraenv: line 46: syntax error near unexpected token `set
    /home/oracle/oracle/product/10.2.0/db_1//bin/coraenv: line 46: `if ("$ORASID" == '' ) set ORASID='*''
    my coraenv contain:
    Code:
    #!/bin/sh
    #
    ###################################
    # 
    # $Header: coraenv.sh.pp 16-jun-2005.10:45:53 mlfallon Exp $ coraenv
    # 
    #
    # Copyright 1987 Oracle Corporation
    #
    # This routine is used to condition a C shell user's environment
    # for access to an ORACLE database.  It should be installed in
    # the system local bin directory.
    #
    # The user will be prompted for the database SID, unless the variable
    # ORAENV_ASK is set to NO, in which case the current value of ORACLE_SID
    # is used.
    # An asterisk '*' can be used to refer to the NULL SID.
    #
    # 'dbhome' is called to locate ORACLE_HOME for the SID.  If
    # ORACLE_HOME cannot be located, the user will be prompted for it also.
    # The following environment variables are set:
    #
    #	ORACLE_SID	Oracle system identifier
    #	ORACLE_HOME	Top level directory of the Oracle system hierarchy
    #	PATH		Old ORACLE_HOME/bin removed, new one added
    #
    # usage: source /usr/local/coraenv
    #
    #####################################
    
    export ORACLE_BASE=/home/oracle/oracle
    export ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1
    export ORACLE_SID=PACV203D
    export ORAENV_ASK=YES
    
    #
    # Set minimum environment variables
    #
    
    if ($?ORACLE_SID == 0) then
    
        set ORASID=$LOGNAME
    else
        set ORASID=$ORACLE_SID
    endif
    if ("$ORASID" == '' ) set ORASID='*'
    
    if ($?ORAENV_ASK == 0 ) then
    	set ORAENV_ASK=YES		#ORAENV_ASK suppresses prompt when set
    endif
    
    if ($ORAENV_ASK != NO ) then
        echo -n "ORACLE_SID = [$ORASID] ? "
        set READ=($<)
    
        if ("$READ" != '') set ORASID="$READ"
    endif
    if ("$ORASID" == '*') set ORASID=""
    setenv ORACLE_SID "$ORASID"
    
    if ($?ORACLE_HOME == 0) then
        set OLDHOME=$PATH		#This is just a dummy value so a null OLDHOME
    else				#can't match anything in the switch below
        set OLDHOME=$ORACLE_HOME
    endif
    
    set ORAHOME=`dbhome "$ORASID"`
    if ($status == 0) then
        setenv ORACLE_HOME $ORAHOME
    else
        echo -n "ORACLE_HOME = [$ORAHOME] ? "
        set NEWHOME=$<
    
        if ($NEWHOME == "") then
    	setenv ORACLE_HOME $ORAHOME
        else
    	setenv ORACLE_HOME $NEWHOME
        endif
    endif
    
    #
    # Reset LD_LIBRARY_PATH
    #
    if ($?LD_LIBRARY_PATH == 0) then
        setenv LD_LIBRARY_PATH $ORACLE_HOME/lib
    else
        switch ($LD_LIBRARY_PATH)
        case *$OLDHOME/lib* :
            setenv LD_LIBRARY_PATH \
    	    `echo $LD_LIBRARY_PATH | sed "s;$OLDHOME/lib;$ORACLE_HOME/lib;g"`
            breaksw
        case *$ORACLE_HOME/lib* :
            breaksw
        case "" :
            setenv LD_LIBRARY_PATH $ORACLE_HOME/lib
            breaksw
        default :
            setenv LD_LIBRARY_PATH $ORACLE_HOME/lib:${LD_LIBRARY_PATH}
            breaksw
        endsw
    endif
    
    #
    # Adjust path accordingly
    #
    
    switch ($PATH)
    case *$OLDHOME/bin* :
        setenv PATH `echo $PATH | sed "s;$OLDHOME/bin;$ORACLE_HOME/bin;g"`
        breaksw
    case *$ORACLE_HOME/bin* :
        breaksw
    case *[:] :
        setenv PATH ${PATH}$ORACLE_HOME/bin:
        breaksw
    case "" :
        setenv PATH $ORACLE_HOME/bin
        breaksw
    default :
        setenv PATH ${PATH}:$ORACLE_HOME/bin
        breaksw
    endsw
    
    unset ORASID ORAHOME OLDHOME NEWHOME READ
    
    #
    # Install local modifications here
    #
    any help..Please

  2. #2
    Join Date
    Jan 2004
    Posts
    370
    You must call coraenv from the C shell using the source command as per the usage comment in the script header:

    #
    # usage: source /usr/local/coraenv
    #
    #####################################
    Also you have inserted four additional export lines.
    The export command is not a C shell command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •