well I'm not going to debug your ksh syntax cause I don't immediately see what you've done wrong. But, the attached script will do the job for you without advertising your passwords in ps. The instructions are in the script. If that doesn't work then there is something wrong with the path and sid you're getting when you invoke a subshell, and possibly you're getting an alias or wrapper in place of the "real" sqlplus. Typing whence sqlplus and cat'ing that out might show you something. mwf PS: while I copyrighted that back in 1994, everyone on oracle-l can hereby treat that as a copyleft. If you don't know what a copyleft is search it up in your favorite search engine. _____ From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Masha Gurenich Sent: Thursday, November 19, 2009 5:11 PM To: Oracle L Subject: can't run sql script inside ksh script Hi all, This one just drives me nuts.. I have a shell script that works OK while I am running it manually. It runs OK via cron up to the point where sql script should be executed: <<<bla-bla>>> /u01/app/sghe/dw/dwprod/app/scripts/dapstart /u01/app/sghe/dw/dwprod/app/scripts/webstart /u01/app/oracle/product/bin/sqlplus dwmgr/u_pick_it@pds1_PURPLE @/home/dwadmin/scripts/bannerstudents.sql <<SQLPLUS exit SQLPLUS the bannerstudents.sql is not being executed.. this is what i see in log file: <<<bla-bla>>> ===== DegreeWorks Web Message Queue: Key: 513 = 0x201 ===== MsgQ Key MsgId Owner Perms #Bytes #Msgs 0x00000201 2326529 dwadmin 666 0 0 SQL*Plus: Release 10.2.0.4.0 - Production on Thu Nov 19 15:13:08 2009 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ~ that's it!! it connects to sqlplus, but doesn't execute the script. WHY??? Please, help me. I have tons of scripts like that and all of them are working. what is wrong with that one?? thanks beforehand, M
#! /bin/ksh # Copyright (C) 1994 Rightsizing, Inc. # # Used by permission, All Rights Reserved # # runksh1 -- Run a sqlplus script as user/pw # file without showing the password in ps. # # Usage: echo "user/pw" | ksh runksh1 scriptname [parameters] read userpw scriptname=$1 shift 1 parameters=$@ sqlplus << INPUT01 $userpw start $scriptname $parameters exit INPUT01