Re: ksh: @: parameter not set (4979 Views)
Reply
Regular Advisor
wayne_104
Posts: 144
Registered: ‎01-26-2005
Message 1 of 17 (4,979 Views)
Accepted Solution

ksh: @: parameter not set

Hi

I have installed an hpux system. It is in an itanium box. os B.11.31. with the september 2010 patch set.

We have installed oracle 11g the latest download.

when we run . oraenv i get the error

ksh: @: parameter not set.

can anyone tell me what i have done wrong?
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 2 of 17 (4,979 Views)

Re: ksh: @: parameter not set

Hi Wayne:

Does the script require any arguments to be passed?

The $@ variable would hold the argument list. If the script does 'set -u' to treat unset parameters as an error during parameter substitution, then I expect that this is the reason for the error.

Regards!

...JRF...
Honored Contributor
Oviwan
Posts: 692
Registered: ‎11-29-2005
Message 3 of 17 (4,979 Views)

Re: ksh: @: parameter not set

is the content of /etc/oratab emtpy? if yes it should not be empty.
Regular Advisor
wayne_104
Posts: 144
Registered: ‎01-26-2005
Message 4 of 17 (4,979 Views)

Re: ksh: @: parameter not set

not sure if oraenv has a set -u?

when i su to oracle and run . oraenv i get the error

but when i just run oraenv dont get the error?

New to Oracle here as well. BIG learning curve. Got the dba stumped so he passed onto me to look at as he says it is os related.
Honored Contributor
Oviwan
Posts: 692
Registered: ‎11-29-2005
Message 5 of 17 (4,979 Views)

Re: ksh: @: parameter not set

have you execute $ORACLE_HOME/root.sh?
Regular Advisor
wayne_104
Posts: 144
Registered: ‎01-26-2005
Message 6 of 17 (4,979 Views)

Re: ksh: @: parameter not set

YEs have run it.
Honored Contributor
Oviwan
Posts: 692
Registered: ‎11-29-2005
Message 7 of 17 (4,979 Views)

Re: ksh: @: parameter not set

Regular Advisor
wayne_104
Posts: 144
Registered: ‎01-26-2005
Message 8 of 17 (4,979 Views)

Re: ksh: @: parameter not set

(alsmt1):/home/oracle:$ export ORACLE_SID=SMSMG
(alsmt1):/home/oracle:$ export ORAENV_ASK=NO
(alsmt1):/home/oracle:$ . oraenv
ksh: @: parameter not set

/etc/oratab


# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
SMSMG:/orabin/oracle/product/11.2.0/dbhome_1:N





ORAENV

#!/bin/sh
#
# $Header: buildtools/scripts/oraenv.sh /linux32/8 2010/03/25 04:17:55 ashrives Exp $ oraenv.sh.pp Copyr (c) 1991 Oracle
#
# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This routine is used to condition a Bourne 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
# ORACLE_BASE Top level directory for storing data files and
# diagnostic information.
#
# usage: . oraenv
#
# NOTE: Due to constraints of the shell in regard to environment
# ----- variables, the command MUST be prefaced with ".". If it
# is not, then no permanent change in the user's environment
# can take place.
#
#####################################
#
# process aruments
#
SILENT='';
for arg in $@
do
if [ "$arg" = "-s" ]; then
SILENT='true'
fi
done

case ${ORACLE_TRACE:-""} in

T) set -x ;;
esac

#
# Determine how to suppress newline with echo command.
#
N=
C=
if echo "\c" | grep c >/dev/null 2>&1; then
N='-n'
else
C='\c'
fi

#
# Set minimum environment variables
#

# ensure that OLDHOME is non-null
if [ ${ORACLE_HOME:-0} = 0 ]; then
OLDHOME=$PATH
else
OLDHOME=$ORACLE_HOME
fi
case ${ORAENV_ASK:-""} in #ORAENV_ASK suppresses prompt when set

NO) NEWSID="$ORACLE_SID" ;;
*) case "$ORACLE_SID" in
"") ORASID=$LOGNAME ;;
*) ORASID=$ORACLE_SID ;;
esac
echo $N "ORACLE_SID = [$ORASID] ? $C"
read NEWSID
case "$NEWSID" in
"") ORACLE_SID="$ORASID" ;;
*) ORACLE_SID="$NEWSID" ;;
esac ;;
esac
export ORACLE_SID

ORAHOME=`dbhome "$ORACLE_SID"`
case $? in
0) ORACLE_HOME=$ORAHOME ;;
*) echo $N "ORACLE_HOME = [$ORAHOME] ? $C"
read NEWHOME
case "$NEWHOME" in
"") ORACLE_HOME=$ORAHOME ;;
*) ORACLE_HOME=$NEWHOME ;;
esac ;;
esac

export ORACLE_HOME

#
# Reset LD_LIBRARY_PATH
#
case ${LD_LIBRARY_PATH:-""} in
*$OLDHOME/lib*) LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | \
sed "s;$OLDHOME/lib;$ORACLE_HOME/lib;g"` ;;
*$ORACLE_HOME/lib*) ;;
"") LD_LIBRARY_PATH=$ORACLE_HOME/lib ;;
*) LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH ;;
esac

export LD_LIBRARY_PATH

#
# Put new ORACLE_HOME in path and remove old one
#

case "$OLDHOME" in
"") OLDHOME=$PATH ;; #This makes it so that null OLDHOME can't match
esac #anything in next case statement

case "$PATH" in
*$OLDHOME/bin*) PATH=`echo $PATH | \
sed "s;$OLDHOME/bin;$ORACLE_HOME/bin;g"` ;;
*$ORACLE_HOME/bin*) ;;
*:) PATH=${PATH}$ORACLE_HOME/bin: ;;
"") PATH=$ORACLE_HOME/bin ;;
*) PATH=$PATH:$ORACLE_HOME/bin ;;
esac

export PATH

# Locate "osh" and exec it if found
ULIMIT=`LANG=C ulimit 2>/dev/null`

if [ $? = 0 -a "$ULIMIT" != "unlimited" ] ; then
if [ "$ULIMIT" -lt 2113674 ] ; then

if [ -f $ORACLE_HOME/bin/osh ] ; then
exec $ORACLE_HOME/bin/osh
else
for D in `echo $PATH | tr : " "`
do
if [ -f $D/osh ] ; then
exec $D/osh
fi
done
fi

fi

fi

# Set the value of ORACLE_BASE in the environment.
#
# Use the orabase executable from the corresponding ORACLE_HOME, since the ORACLE_BASE of different
# ORACLE_HOMEs can be different. The return value of orabase will be determined based on the value
# of ORACLE_BASE from oraclehomeproperties.xml as set in the ORACLE_HOME inventory.
#
# If orabase can not determine a value then oraenv returns with ORACLE_BASE unset.
#
# The existing value of ORACLE_BASE is only used to inform the user if the script has changed
# the value of ORACLE_BASE.

ORABASE_EXEC=$ORACLE_HOME/bin/orabase

if [ ${ORACLE_BASE:-"x"} != "x" ]; then
OLD_ORACLE_BASE=$ORACLE_BASE
unset ORACLE_BASE
export ORACLE_BASE
else
OLD_ORACLE_BASE=""
fi

if [ -w $ORACLE_HOME/inventory/ContentsXML/oraclehomeproperties.xml ]; then
if [ -f $ORABASE_EXEC ]; then
if [ -x $ORABASE_EXEC ]; then
ORACLE_BASE=`$ORABASE_EXEC`

# did we have a previous value for ORACLE_BASE
if [ ${OLD_ORACLE_BASE:-"x"} != "x" ]; then
if [ $OLD_ORACLE_BASE != $ORACLE_BASE ]; then
if [ "$SILENT" != "true" ]; then
echo "The Oracle base has been changed from $OLD_ORACLE_BASE to $ORACLE_BASE"
fi
else
if [ "$SILENT" != "true" ]; then
echo "The Oracle base remains unchanged with value $OLD_ORACLE_BASE"
fi
fi
else
if [ "$SILENT" != "true" ]; then
echo "The Oracle base has been set to $ORACLE_BASE"
fi
fi
export ORACLE_BASE
else
if [ "$SILENT" != "true" ]; then
echo "The $ORACLE_HOME/bin/orabase binary does not have execute privilege"
echo "for the current user, $USER. Rerun the script after changing"
echo "the permission of the mentioned executable."
echo "You can set ORACLE_BASE manually if it is required."
fi
fi
else
if [ "$SILENT" != "true" ]; then
echo "The $ORACLE_HOME/bin/orabase binary does not exist"
echo "You can set ORACLE_BASE manually if it is required."
fi
fi
else
if [ "$SILENT" != "true" ]; then
echo "ORACLE_BASE environment variable is not being set since this"
echo "information is not available for the current user ID $USER."
echo "You can set ORACLE_BASE manually if it is required."
fi
fi

#
# Install any "custom" code here
#
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 9 of 17 (4,979 Views)

Re: ksh: @: parameter not set

>not sure if oraenv has a set -u?

It appears the user has set -u before invoking oraenv. The script fragment is sloppy and doesn't protect itself from pedantic users.

You can use "set -o" to see if -u is set:
nounset on
You can unset this by: set +u

>JRF: Does the script require any arguments to be passed?

It takes an optional "-s" but it's sloppy:
for arg in $@; do
Regular Advisor
wayne_104
Posts: 144
Registered: ‎01-26-2005
Message 10 of 17 (4,979 Views)

Re: ksh: @: parameter not set

Oraenv

is an oracle supplied or generated script so not sure who wrote it.

Not sure of where the set is supposed to go.
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 11 of 17 (4,979 Views)

Re: ksh: @: parameter not set

Hi:

> Not sure of where the set is supposed to go.

Save a copy of the original 'oraenv' script and then add 'set +u'

...on a new line immediately after the interpreter line so the script looks like:

#!/bin/sh
set +u

Now try running it again.

Regards!

...JRF...
Regular Advisor
wayne_104
Posts: 144
Registered: ‎01-26-2005
Message 12 of 17 (4,979 Views)

Re: ksh: @: parameter not set

Thank you so much that has worked my DBA is now embarassed as I have told him it is actually an oracle problem and not os.

THANK YOU.
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 13 of 17 (4,979 Views)

Re: ksh: @: parameter not set

Hi (again):

Wait. The script should be running the HP_UX POSIX shell since '/bin/sh' should be a link to '/usr/bin/sh'.

Your error report indicates that the Korn ('ksh') shell is running. That tells me that your default shell for your 'oracle' account is 'ksh', *and* in fact you wrongly did:

$ . oraenv

...instead of:

$ ./oraenv

In the first case you simply "sourced" (read) the file into your current shell environment. You need to actually *execute* it as shown in the second line above.

Regards!

...JRF...
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 14 of 17 (4,979 Views)

Re: ksh: @: parameter not set

>JRF: *and* in fact you wrongly did:
$ . oraenv

Why do you think that? The script fragment says it sets up the the environment.
(Remember I suggested you not have "#!" at the start of sourced files. ;-)

>You need to actually *execute* it as shown in the second line above.

That's NOT what the documentation says. Wayne followed directions.
Regular Advisor
wayne_104
Posts: 144
Registered: ‎01-26-2005
Message 15 of 17 (4,979 Views)

Re: ksh: @: parameter not set

set +u in the oreenv solved the problem
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 16 of 17 (4,979 Views)

Re: ksh: @: parameter not set

Hi:

@ Dennis: Why do you think that? The script fragment says it sets up the the environment. (Remember I suggested you not have "#!" at the start of sourced files. ;-)

Oops [egg on face]. I just scanned the code and went right by the documentation :-(

Ad for our discussion (elsewhere) of using or not using an interpreter line in sourced files, I now see why you suggest *not* to do so. I'm changing my thinking :-)

Regards!

...JRF...
Occasional Visitor
Alan S Martin
Posts: 1
Registered: ‎11-30-2010
Message 17 of 17 (4,979 Views)

Re: ksh: @: parameter not set

Yes "set +u" avoids the error, but it is a band-aid. You must always source ". oraenv" the program or the variables set will not be available to your foreground shell. There are many side effects to sourcing oraenv with command arguments:

1) The "#!/bin/sh" at the top is ignored.
2) $@ (no set +u) errors as it is null until the first use of a supplied argument.
3) Once an argument is specified to oraenv, $@ retains that value, even if you call oraenv again without arguments!!!

Note oraenv works on Sun Sparc without modification. I have an SR open with Oracle support to use an env variable instead of cmd line arguments.

Regards,
Alan
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.