04-12-2013
I got these outputs, but seems not clear where the error is coming from.
Code :
*
Error Message: #!/bin/ksh -xv# Mod Date Engineer Change# 000 07/20/04 AM4598 Created dm2_updatetns.ksh based on upda
tetns.ksh for new installs.# 001 01/09/06 EG012557 Modified to default to Oracle 9 path of logic when on Oracle 10# 002 02/16
/06 EG012557 Modify to use : instead of . for chown commands that would run in mode T# 003 06/23/06 EG012557 Modify to use :
instead of . for chown commands that would run in mode A# Modify listener.ora searching for account for O
racle 10# Add export UNIX95=Y when on HPUX# 004 11/17/08 EG012557 Modify to use case-insensitive sear
ch when looking for existing TNS entry# 005 01/29/10 Bg8255 Modifications for Oracle 11.OnError(){ # $* = message to writeech
o "\n$*\n"exit 1}CheckUser(){if [[ $LOGNAME != $1 ]]then OnError "Incorrect user $LOGNAME. Login as $1 and try again."fi}GetPort
(){if [[ `grep -w $NewPort /etc/services | wc -l` -ne 0 ]]then if [[ `grep -w $NewPort /etc/services|egrep -e "oracle|tns"|wc -l`
-eq 0 ]] then OnError "Port Number $NewPort reserved by a non-Oracle process." fielse echo " " echo "Execute the foll
owing commands as the root user to reserve port # $NewPort in the /etc/services file:" echo " chservices -a -v'oracle_tns' -p'tc
p' -n $NewPort -u'# Oracle Listener Port'" echo " chservices -a -v'oracle_tns' -p'udp' -n $NewPort -u'# Oracle Listener Port'"
echo " "fi}#003if [[ `uname` = "HP-UX" ]]then export UNIX95=Yfi+ uname+ [[ AIX = HP-UX ]]#...003CheckUser oracle+ CheckUser oracl
eNODENAME=`hostname`+ + hostnameNODENAME=rtprodapp1if [[ $NODENAME = "localhost" ]]then OnError "Please set the hostname and try
again."fi+ [[ rtprodapp1 = localhost ]]#The dm2_oraver variable is set to indicate if it's running for 8i vs. 9i.#The ORACLE_HOME l
ogical is searched for a "9." to indicate Oracle9, otherwise it defaults to Oracle8 usage.#The commands in protocol.ora need to be
in sqlnet.ora for Oracle9i (dm2_oraver = 9x).if [[ `echo $ORACLE_HOME|grep -ic '8.'` = 1 ]]then dm2_oraver="8x"else dm2_oraver="9
x"fi+ grep -ic 8.+ echo+ [[ 0 = 1 ]]+ dm2_oraver=9xecho "dm2_oraver:" $dm2_oraver+ echo dm2_oraver: 9xdm2_oraver: 9x###############
#################################################################Usage="Usage: dm2_updatetns.ksh -? or dm2_updatetns.ksh -a {a
lias} -n {node} -p {port} -s {sid} -h {home} -m {A|T}where: -a Name for the Sql*Net alias. -n Node name where the d
atabase resides. -p Port number where the listener is running. -s Value of Oracle Sid for the Database. -h
Value of Oracle Home for the Database. -m Mode of operation: A - Update all .ora files (tnsnames, listener, sqln
et, protocol) T - Update only the tnsnames.ora file. "+ Usage=Usage: dm2_updatetns.ksh -? or dm2_updatetns.ksh -a {
alias} -n {node} -p {port} -s {sid} -h {home} -m {A|T}where: -a Name for the Sql*Net alias. -n Node name where the
database resides. -p Port number where the listener is running. -s Value of Oracle Sid for the Database. -h
Value of Oracle Home for the Database. -m Mode of operation: A - Update all .ora files (tnsnames, listener, sql
net, protocol) T - Update only the tnsnames.ora file.###################################################################
############### Process command line argumentsAlias=""+ Alias=Node=""+ Node=Port=""+ Port=OSid=""+ OSid=OHome=""+ OHome=Listener=n+
Listener=nwhile getopts :a:n:p:s:h:m:L:? cmdoptsdo case $cmdopts in a) Alias="$OPTARG";; n) Node=
"$OPTARG";; p) Port="$OPTARG";; s) OSid="$OPTARG";; h) OHome="$OPTARG";; m)
Mode="$OPTARG";; ?) echo "$Usage" exit 0 ;; :) echo "no argument for \"-$OPTARG\"" ;;
esacdone+ getopts :a:n:p:s:h:m:L:? cmdopts+ Alias=remote_GOLD1+ getopts :a:n:p:s:h:m:L:? cmdopts+ Node=miltnd+ getopts :a:n:p:s
:h:m:L:? cmdopts+ Port=1521+ getopts :a:n:p:s:h:m:L:? cmdopts+ OSid=GOLD1+ getopts :a:n:p:s:h:m:L:? cmdopts+ OHome=/u01/oracle/prod
uct/10.2.0.3/db+ getopts :a:n:p:s:h:m:L:? cmdopts+ Mode=T+ getopts :a:n:p:s:h:m:L:? cmdoptslet shiftcnt=$OPTIND-1+ let shiftcnt=13-
1shift $shiftcnt+ shift 12typeset -l Auto+ typeset -l Autoif [[ -z $ORACLE_HOME ]]then ORACLE_HOME=$OHomefi+ [[ -z ]]+ ORACLE_HO
ME=/u01/oracle/product/10.2.0.3/dbif [[ -z $TNS_ADMIN ]]then if [[ ! -z $ORACLE_HOME ]] then TNS_ADMIN=$ORACLE_HOME/networ
k/admin else OnError "Error: $TNS_ADMIN is not defined." fifi+ [[ -z ]]+ [[ ! -z /u01/oracle/product/10.2.0.3/db ]]+ TNS
_ADMIN=/u01/oracle/product/10.2.0.3/db/network/adminif [[ ! -d $TNS_ADMIN ]]then OnError "Error: $TNS_ADMIN is not a directory."
fi+ [[ ! -d /u01/oracle/product/10.2.0.3/db/network/admin ]]if [[ ! -w $TNS_ADMIN ]]then OnError "Error: No write permission to
$TNS_ADMIN."fi+ [[ ! -w /u01/oracle/product/10.2.0.3/db/network/admin ]]dm2_oraver2="GE11"+ dm2_oraver2=GE11if [[ `echo $ORACLE_HOM
E| grep -ic '8.'` > 0 ]]then dm2_oraver2='LT11'fi+ grep -ic 8.+ echo /u01/oracle/product/10.2.0.3/db+ [[ 0 > 0 ]]if [[ `echo $ORA
CLE_HOME| grep -ic '9.'` > 0 ]]then dm2_oraver2='LT11'fi+ grep -ic 9.+ echo /u01/oracle/product/10.2.0.3/db+ [[ 0 > 0 ]]if [[ `ec
ho $ORACLE_HOME| grep -ic '10.'` > 0 ]]then dm2_oraver2='LT11'fi+ grep -ic 10.+ echo /u01/oracle/product/10.2.0.3/db+ [[ 1 > 0 ]]
+ dm2_oraver2=LT11echo "dm2_oraver2:" $dm2_oraver2+ echo dm2_oraver2: LT11dm2_oraver2: LT11NSF=$TNS_ADMIN/sqlnet.ora+ NSF=/u01/orac
le/product/10.2.0.3/db/network/admin/sqlnet.oraNPF=$TNS_ADMIN/protocol.ora+ NPF=/u01/oracle/product/10.2.0.3/db/network/admin/proto
col.oraNLF=$TNS_ADMIN/listener.ora+ NLF=/u01/oracle/product/10.2.0.3/db/network/admin/listener.oraNTF=$TNS_ADMIN/tnsnames.ora+ NTF=
/u01/oracle/product/10.2.0.3/db/network/admin/tnsnames.ora#########################################################################
##### Verify inputsif [[ -z $Alias ]]then OnError "Alias required."fi+ [[ -z remote_GOLD1 ]]if [[ -z $Node ]]then Node=$NODENAM
Efi+ [[ -z miltnd ]]if [[ $Node = $NODENAME ]]then Listener="y"fi+ [[ miltnd = rtprodapp1 ]]if [[ -z $Port ]]then Port=1521fi+
[[ -z 1521 ]]if [[ -z $OSid ]]then OnError "A valid Oracle SID is required in the -s parameter."fi+ [[ -z GOLD1 ]]if [[ -z $Mode
]]then OnError "A valid -m mode (value of A or T) is required."else if [[ $Mode != "T" && $Mode != "t" && $Mode != "A" && $Mode
!= "a" ]] then OnError "The mode specified in the -m parameter must be either T or A." fifi+ [[ -z T ]]+ [[ T != T ]]if [
[ $Listener = "y" && -z $OHome ]]then OHome=$ORACLE_HOMEfi+ [[ n = y ]]if [[ $Listener = "y" ]]then if [[ -a $NLF ]] then
for value in `grep -i port $NLF | sed "s/ //g"` do value=`echo $value | dd conv=lcase 2>/dev/null` value=`ec
ho $value | sed "s/(port=/(port=%/g" | cut -f2 -d"%"` CurPort=`echo $value | awk -F ")" '{print $1}'` done if [[
$Port != $CurPort ]] then echo " " echo "Changing the value of Port" echo " from: $Port" echo
" to: $CurPort" echo " " Port=$CurPort fi else NewPort=$Port if [[ `uname` != "Linux" ]] th
en GetPort fi fifi+ [[ n = y ]]############################################################################## $TNS_AD
MIN/sqlnet.ora############################################################################Only process sqlnet.ora and protocol.ora
files in Mode = Aif [[ $Mode = "a" || $Mode = "A" ]]then if [[ ! -a $NSF ]] then echo "################"
>> $NSF echo "# Filename......: sqlnet.ora" >> $NSF echo "# Node..........: ${NODENAME}.world"
>> $NSF echo "# Date..........: `date`" >> $NSF echo "################" >> $NS
F echo " Created file - $NSF" #003 - mod to use oracle:dba chown oracle:dba $NSF fi # Make sure each required e
ntry exists in the sqlnet.ora if [[ -a $NSF ]] then if [[ `grep -ic trace_level_client $NSF` -eq 0 ]] then ec
ho " Adding trace_level_client parameter to file $NSF" echo "trace_level_client = off" >> $NSF fi
if [[ `grep -ic sqlnet.expire_time $NSF` -eq 0 ]] then echo " Adding sqlnet.expire_time parameter to file $NSF
" if [[ $dm2_oraver2 = "GE11" ]] then echo "sqlnet.expire_time = 10" >> $NSF els
e echo "sqlnet.expire_time = 0" >> $NSF fi fi if [[ `grep -ic names.default_domain $NS
F` -eq 0 ]] then echo " Adding names.default_domain parameter to file $NSF" echo "names.default_domain = w
orld" >> $NSF fi #names.default_zone deprecated in 9.2 if [[ `grep -ic name.default_zone $NSF` -eq 0 && $
dm2_oraver != "9x" ]] then echo " Adding name.default_zone parameter to file $NSF" echo "name.default_zone
= world" >> $NSF fi if [[ `grep -ic tcp.nodelay $NSF` -eq 0 && $dm2_oraver = "9x" ]] then ech
o " Adding tcp.nodelay parameter to file $NSF" echo "# tcp.nodelay moved to sqlnet.ora in Oracle 9x" >> $NSF ec
ho "tcp.nodelay = yes" >> $NSF fi if [[ `grep -ic names.directory_path $NSF` -eq 0 && $dm2_oraver2
= "GE11" ]] then echo " Adding names.directory_path parameter to file $NSF" echo "names.directory_path = (
tnsnames)" >> $NSF fi if [[ `grep -ic bequeath_detach $NSF` -eq 0 && $dm2_oraver2 = "GE11" ]] then
echo " Adding bequeath_detach parameter to file $NSF" echo "bequeath_detach = yes" >> $NSF fi
if [[ `grep -ic sqlnet.inbound_connect_timeout $NSF` -eq 0 && $dm2_oraver2 = "GE11" ]] then echo " Adding sq
lnet.inbound_connect_timeout parameter to file $NSF" echo "sqlnet.inbound_connect_timeout = 0" >> $NSF
fi if [[ `grep -ic adr_base $NSF` -eq 0 && $dm2_oraver2 = "GE11" ]] then echo " Adding adr_base parameter to
file $NSF" echo "adr_base = /u02" >> $NSF fi fi echo "" #########################################
################################## ### $TNS_ADMIN/protocol.ora ### Make sure required entries are in protocol.ora ###########
################################################################ if [[ ! -a $NPF && $dm2_oraver != "9x" ]] then echo "####
############" >> $NPF echo "# Filename......: protocol.ora" >> $NPF echo "# Node.....
.....: ${NODENAME}.world" >> $NPF echo "# Date..........: `date`" >> $NPF echo "################"
>> $NPF echo " Created file - $NPF" #003 - mod to use oracle:dba chown oracle:dba $NPF f
i if [[ -a $NPF ]] then if [[ `grep -ic tcp.nodelay $NPF` -eq 0 ]] then echo " Adding tcp.nodelay paramet
er to file $NPF" echo "tcp.nodelay = yes" >> $NPF fi fifi # end of mode = a or A+ [[ T = a ]]+
[[ T = A ]]############################################################################## $TNS_ADMIN/tnsnames.oraFoundCur="N"+ Fou
ndCur=Nif [[ -a $NTF ]]then for CurAlias in `grep -i ".world" $NTF|grep -vi "tcp.world"|cut -f1 -d"."` do typeset -u TempC
urAlias=$CurAlias typeset -u TempAlias=$Alias if [[ $TempCurAlias = $TempAlias ]] then FoundCur="Y" fi
donefi+ [[ -a /u01/oracle/product/10.2.0.3/db/network/admin/tnsnames.ora ]]+ grep -i .world /u01/oracle/product/10.2.0.3/db/netwo
rk/admin/tnsnames.ora+ grep -vi tcp.world+ cut -f1 -d.+ typeset -u TempCurAlias=admin1+ typeset -u TempAlias=remote_GOLD1+ [[ ADMIN
1 = REMOTE_GOLD1 ]]+ typeset -u TempCurAlias=gold1+ typeset -u TempAlias=remote_GOLD1+ [[ GOLD1 = REMOTE_GOLD1 ]]+ typeset -u TempC
urAlias=cert1+ typeset -u TempAlias=remote_GOLD1+ [[ CERT1 = REMOTE_GOLD1 ]]+ typeset -u TempCurAlias=cprod1+ typeset -u TempAlias=
remote_GOLD1+ [[ CPROD1 = REMOTE_GOLD1 ]]+ typeset -u TempCurAlias=prod1+ typeset -u TempAlias=remote_GOLD1+ [[ PROD1 = REMOTE_GOLD
1 ]]#Don't try to readd it to tnsnames.ora if it already existsif [[ $FoundCur = "N" ]]then if [[ ! -a $NTF ]] then FileSt
at="Created" echo "################" >> $NTF echo "# Filename......: tnsnames.ora" >> $NTF
echo "# Node..........: ${NODENAME}.world" >> $NTF echo "# Date..........: `date`" >> $NTF echo "######
##########" >> $NTF else FileStat="Updated" LastNTF=`ls $NTF.[0-9]* 2>/dev/null | tail -1` La
stNTF=`echo ${LastNTF##*/}` if [[ -z $LastNTF ]] then cp $NTF $NTF.0001 else Nam=`echo $LastNTF | cu
t -f1 -d"."` Ext=`echo $LastNTF | cut -f2 -d"."` Cnt=`echo $LastNTF | cut -f3 -d"."` ((CntNew=Cnt+1))
while [[ ${#CntNew} -lt 4 ]] do CntNew=0$CntNew done cp $NTF $TNS_ADMIN/$Nam.$Ext.$CntNew
fi fi echo "${Alias}.world =" >>$NTF echo " (DESCRIPTION ="
>>$NTF # #community parameter deprecated as of Oracle 9.2 # if [[ $dm2_oraver = "9x" ]] then
echo " (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)" >>$NTF else echo " (ADDRESS_LIST=(ADDRESS=(COMMUNITY=tcp.world)(PROTOCOL
=TCP)" >>$NTF fi echo " (Host=${Node})(Port=${Port})))" >>$NTF echo " (CONNECT_DATA=(SID=${OSid
}))" >>$NTF echo " )" >>$NTF echo " $F
ileStat file - $NTF" #002 - mod to use oracle:dba chown oracle:dba $NTF*fi #$FoundCur = "N"+ [[ N = N ]]+ [[ ! -a /u01/oracle/
product/10.2.0.3/db/network/admin/tnsnames.ora ]]+ FileStat=Updated+ + tail -1+ ls /u01/oracle/product/10.2.0.3/db/network/admin/tn
snames.ora.11MAR13+ 2> /dev/nullLastNTF=/u01/oracle/product/10.2.0.3/db/network/admin/tnsnames.ora.11MAR13+ + echo tnsnames.ora.11M
AR13LastNTF=tnsnames.ora.11MAR13+ [[ -z tnsnames.ora.11MAR13 ]]+ + cut -f1 -d.+ echo tnsnames.ora.11MAR13Nam=tnsnames+ + cut -f2 -d
.+ echo tnsnames.ora.11MAR13Ext=ora+ + cut -f3 -d.+ echo tnsnames.ora.11MAR13Cnt=11MAR13+ (( CntNew=Cnt+1 ))/cerner/w_standard/gold
_wh/install/dm2_updatetns.ksh[385]: 11MAR13: 0403-009 The specified number is not valid for this command.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Probably a very straight forward question but please be easy on me, I am v. new to UNIX!
A script that I have runs the line
tmp=`pwd -H`
It works fine, but I needed to make a couple of other changes to the script, nowhere near this line but now this line reports:
pwd: A specified flag... (2 Replies)
Discussion started by: Paxton
2 Replies
2. Shell Programming and Scripting
Hi
I am getting few messages when trying to run my script from the following lines in the script
if test
then
// SomeCode
fi
The messages are as follows:
testing.sh: OBLIGOR_GROUP_ID: 0403-012 A test command parameter is not valid.
testing.sh:... (5 Replies)
Discussion started by: skyineyes
5 Replies
3. Shell Programming and Scripting
How to find a string which is entered in command promt is a valid unix command or not?.
Thanks in advance
~Saravana (2 Replies)
Discussion started by: tsaravanan
2 Replies
4. Shell Programming and Scripting
Trying to run the following awk command :
export com.mics.ara.server.tools.sch_reports.Runner.num_threads=`awk -F= '!/^#/ && /com.mics.ara.server.tools.sch_reports.Runner.num_threads/{print $2}' $BKUPDIR/env.properties`
-bash: export:... (6 Replies)
Discussion started by: venhart
6 Replies
5. Shell Programming and Scripting
Hello,
Getting error "A test command parameter is not valid" when trying to run the code below under /sbin/sh
AA = "12:00"
CHK=$(date +"%H:%M")
if
then
print "Yes"
fi
Getting 2 errors:
1) "AA: not found"
2) "Specify a parameter with this command"
Thanks,
IS
Please... (5 Replies)
Discussion started by: schureki
5 Replies
6. Shell Programming and Scripting
Hi,
Am using a if condition to match a pattern but I get the following error..
if
then
echo "The value is $hidType"
return 0
elseif -a ]
echo "The value is $hidType"
return 0
fi
I get the following error
+ echo The value is mode
The value is mode
+
./a2: mode:... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
7. Shell Programming and Scripting
Heya fellows
Yes, script-tools and TUI are both my 'children', so i cant go anywhere (else) and ask for help/bugfixes as i need to write them myself.
However i do need help to understand error messages at times (or get hints what else might cause them), so here we go:
Since my new computer... (4 Replies)
Discussion started by: sea
4 Replies
8. Shell Programming and Scripting
My question is how would i loop a read command to keep asking the user for input and eventually print the no. of valid invalid inputs after a specified control input typed i.e. (-3). (1 Reply)
Discussion started by: Flowoftruth
1 Replies
9. Shell Programming and Scripting
Hi
I have Unix shell script that invokes PL/SQL procedure.
The batch job when executed terminated with the error message:-unlimited: The specified number is not valid for this command.Please let me know what is the root cause of the issue and how to fix the issue.
Thanks (1 Reply)
Discussion started by: moonkhan1
1 Replies
10. Shell Programming and Scripting
Hi Experts
I would like to ask if there is a way to validate if the variable passed is in this kind of sample format "06-10" or "10-01". It was really a challenge to me on how to start and echnically the "6-10" stands for "June 10" and "10-01" stands as "October 1", overall it needs to have ... (3 Replies)
Discussion started by: ersan-poguita
3 Replies