<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: corntab sqlplus in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561942#M918951</link>
    <description>You avoid any problem if you try to run as oracle user, not as root user.&lt;BR /&gt;&lt;BR /&gt;To achieve it, modify your crontab line:&lt;BR /&gt;&lt;BR /&gt;su - &lt;ORACLE_USER&gt; -c sqlplus -silent &lt;CONNECTION&gt; @&lt;PL_TO_RUN&gt; &lt;PARAMETERS&gt;&lt;BR /&gt;&lt;BR /&gt;It works.&lt;/PARAMETERS&gt;&lt;/PL_TO_RUN&gt;&lt;/CONNECTION&gt;&lt;/ORACLE_USER&gt;</description>
    <pubDate>Tue, 07 Aug 2001 05:23:27 GMT</pubDate>
    <dc:creator>Manuel P. Ron</dc:creator>
    <dc:date>2001-08-07T05:23:27Z</dc:date>
    <item>
      <title>corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561931#M918940</link>
      <description>Hi guys!&lt;BR /&gt;&lt;BR /&gt;It's me again, the crontab guy.&lt;BR /&gt;Well, after solving most of my problems of the last issue loading the user environment before doing anything, here's my second problem, it is driving me crazy so I need your knowledge.&lt;BR /&gt;&lt;BR /&gt;I'm trying to run an Oracle script from my shell script with this line:&lt;BR /&gt;&lt;BR /&gt;/u1/app/oracle/product/8.1.6/bin/sqlplus -silent &lt;CONNECTION&gt; @&lt;PL_TO_RUN&gt; &lt;PARAMETERS&gt;&lt;BR /&gt;&lt;BR /&gt;The error that it shows is:&lt;BR /&gt;&lt;BR /&gt;Message file sp1&lt;LANG&gt;.msb not found&lt;BR /&gt;Error 6 initializing SQL*Plus&lt;BR /&gt;&lt;BR /&gt;I'm sure the whole ORACLE environment variables are loaded because I loaded .profile variables and checked them with the "env" command. ORACLE_HOME, ORACLE_SID, PATH, SHLIB_PATH, CLASSPATH.&lt;BR /&gt;The shell works fine from the command line but it doesn't work at all when running the same shell from the crontab.&lt;BR /&gt;&lt;BR /&gt;Thanx in advance !&lt;/LANG&gt;&lt;/PARAMETERS&gt;&lt;/PL_TO_RUN&gt;&lt;/CONNECTION&gt;</description>
      <pubDate>Mon, 06 Aug 2001 11:38:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561931#M918940</guid>
      <dc:creator>Eduardo Uribe_1</dc:creator>
      <dc:date>2001-08-06T11:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561932#M918941</link>
      <description>If it runs from the command prompt and does not run from the cron, you can just about bet it is an env variable.  Try this:&lt;BR /&gt;&lt;BR /&gt;In your script, before the sqlplus call do&lt;BR /&gt;env &amp;gt; /tmp/myenv.txt&lt;BR /&gt;&lt;BR /&gt;Kick off the script via cron.  Then check this file for all the variables.  I bet your missing one.&lt;BR /&gt;&lt;BR /&gt;...jcd...</description>
      <pubDate>Mon, 06 Aug 2001 12:03:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561932#M918941</guid>
      <dc:creator>Joseph C. Denman</dc:creator>
      <dc:date>2001-08-06T12:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561933#M918942</link>
      <description>Hi&lt;BR /&gt;To be on the safe side always give the full path to every command and file in your cron entry.&lt;BR /&gt;&lt;BR /&gt;If it works from command like but not from cron I would suggest that is your problem.&lt;BR /&gt;&lt;BR /&gt;Paula&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Aug 2001 12:05:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561933#M918942</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2001-08-06T12:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561934#M918943</link>
      <description>Hi Eduardo,&lt;BR /&gt;&lt;BR /&gt;Try just before your sqlplus command in the cronjob&lt;BR /&gt;&lt;BR /&gt;env &amp;gt; /tmp/oracle.cron.env&lt;BR /&gt;&lt;BR /&gt;login as oracle and type :&lt;BR /&gt;env &amp;gt; /tmp/oracle.interactive.env&lt;BR /&gt;&lt;BR /&gt;diff /tmp/oracle.cron.env      /tmp/oracle.interactive.env&lt;BR /&gt;&lt;BR /&gt;And fetch out what differences are there .&lt;BR /&gt;&lt;BR /&gt;Magdi</description>
      <pubDate>Mon, 06 Aug 2001 12:17:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561934#M918943</guid>
      <dc:creator>Magdi KAMAL</dc:creator>
      <dc:date>2001-08-06T12:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561935#M918944</link>
      <description>Hi there.&lt;BR /&gt;Another chance is to write a shell script to be started as user root. Sample :&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;ORACLE_SID=${1}&lt;BR /&gt;export ORACLE_SID&lt;BR /&gt;DBHOME=/home/dba/oracle/product/${ORACLE_SID}/bin&lt;BR /&gt;export DBHOME&lt;BR /&gt;PATH=$PATH:.:$DBHOME&lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;#  ORACLE_SID=${1}&lt;BR /&gt;#  export ORACLE_SID&lt;BR /&gt;ORAENV_ASK=NO&lt;BR /&gt;export ORAENV_ASK&lt;BR /&gt;#&lt;BR /&gt;. /usr/local/bin/oraenv&lt;BR /&gt;#&lt;BR /&gt;if [ $? != 0 ]; then&lt;BR /&gt; echo "Failure in running oraenv"&lt;BR /&gt; exit 1&lt;BR /&gt;fi&lt;BR /&gt;echo $ORACLE_SID&lt;BR /&gt;#&lt;BR /&gt;$DBHOME/sqlplus system/manager @/u004/alex/dba_data_files.sql $ORACLE_SID -s &amp;amp;&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Next would be the sql-script :&lt;BR /&gt;&lt;BR /&gt;set termout off&lt;BR /&gt;set lines 80&lt;BR /&gt;set pages 65&lt;BR /&gt;column Name format a50&lt;BR /&gt;column TB-Name format a10&lt;BR /&gt;column MB format 99,999&lt;BR /&gt;clear break&lt;BR /&gt;clear compute&lt;BR /&gt;break on TB-Name skip2 nodup on report skip3 nodup&lt;BR /&gt;compute sum of MB on TB-Name&lt;BR /&gt;compute sum of MB on report&lt;BR /&gt;break&lt;BR /&gt;compute&lt;BR /&gt;spool /var/tmp/dba_data_files&amp;amp;1&lt;BR /&gt;select file_name "Name",&lt;BR /&gt;       tablespace_name "TB-Name",&lt;BR /&gt;       bytes/1048576 "MB"&lt;BR /&gt;from dba_data_files&lt;BR /&gt;order by&lt;BR /&gt;         tablespace_name,&lt;BR /&gt;         file_name&lt;BR /&gt;;&lt;BR /&gt;spool off&lt;BR /&gt;&lt;BR /&gt;Now the crontab line :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;00 08 * * * /u001/local/bin/dba_data_files.sh  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Attach the ORACLE_SID to this line and it should work.&lt;BR /&gt;Rgds&lt;BR /&gt;Alexander M. Ermes&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Aug 2001 12:38:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561935#M918944</guid>
      <dc:creator>Alexander M. Ermes</dc:creator>
      <dc:date>2001-08-06T12:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561936#M918945</link>
      <description>I would have to agree with most of the above responses.  It will probably end up being a missing environment var.  I do run these all the time, but I always use&lt;BR /&gt;"su - oracle_user -c &lt;SQL_SCRIPT&gt;&lt;/SQL_SCRIPT&gt;to run this from cron.  That way I get my environment.  I then make sure I set the critical ones in the script also.  Here is an &lt;BR /&gt;&lt;BR /&gt;example eis .profile:&lt;BR /&gt;&lt;BR /&gt;# @(#) $Revision: 72.2 $      &lt;BR /&gt;&lt;BR /&gt;# Default user .profile file (/usr/bin/sh initialization).&lt;BR /&gt;&lt;BR /&gt;############################################################&lt;BR /&gt;# check for a Terminal before running any terminal commands&lt;BR /&gt;# bhp 4-22-99&lt;BR /&gt;############################################################&lt;BR /&gt;tty 1&amp;gt; /dev/null&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;  then&lt;BR /&gt;############################################################&lt;BR /&gt;&lt;BR /&gt;# Set up the terminal:&lt;BR /&gt; if [ "$TERM" = "" ]&lt;BR /&gt; then &lt;BR /&gt;    tset -s -Q -m :dtterm&lt;BR /&gt;#           eval ` tset -s -Q -m ':?dtterm' `&lt;BR /&gt;# else&lt;BR /&gt;#  eval ` tset -s -Q `&lt;BR /&gt; fi&lt;BR /&gt;&lt;BR /&gt;     stty erase "^H" kill "^U" intr "^C" eof "^D"&lt;BR /&gt;     stty hupcl ixon ixoff&lt;BR /&gt;     tabs&lt;BR /&gt;&lt;BR /&gt;############################################################&lt;BR /&gt;fi # end terminal test&lt;BR /&gt;############################################################&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# Set up the search paths:&lt;BR /&gt; PATH=$PATH:.&lt;BR /&gt;&lt;BR /&gt;# Set up the shell environment:&lt;BR /&gt; set -u&lt;BR /&gt; trap "echo 'logout'" 0&lt;BR /&gt;&lt;BR /&gt;# Set up the shell variables:&lt;BR /&gt; export EDITOR=vi&lt;BR /&gt; &lt;BR /&gt;# set oracle environment&lt;BR /&gt;export SAVEPATH=$PATH &lt;BR /&gt;export ORACLE_HOME=/opt/oracle_mp/app/oracle/product/7.3.4&lt;BR /&gt;export ORACLE_SID=jeep&lt;BR /&gt;export ORACLE_TERM=hp&lt;BR /&gt;export PATH=$ORACLE_HOME/bin:$PATH&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;example cron:&lt;BR /&gt;&lt;BR /&gt;30 7 * * 1-5 su - eis -c /usr/local/bin/rfa_report 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt; /sdf/custom_logs/cron.log&lt;BR /&gt;&lt;BR /&gt;Also attatched a script.  &lt;BR /&gt;&lt;BR /&gt;Good Luck&lt;BR /&gt;&lt;BR /&gt;      Brian :)&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Aug 2001 17:25:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561936#M918945</guid>
      <dc:creator>Brian Pyle</dc:creator>
      <dc:date>2001-08-06T17:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561937#M918946</link>
      <description>Also I didn't see any reference to TWO_TASK...are you using that, and is it set right ? :)&lt;BR /&gt;&lt;BR /&gt;Brian</description>
      <pubDate>Mon, 06 Aug 2001 17:27:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561937#M918946</guid>
      <dc:creator>Brian Pyle</dc:creator>
      <dc:date>2001-08-06T17:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561938#M918947</link>
      <description>Hey Eduardo,&lt;BR /&gt;&lt;BR /&gt;I get the exact same error message if I forget to initialize my cron environment.  What I usually do (and I'm sure there's a better way to do this) is create a script that sets up the environment and fires off the sql commands.  Then I just execute that script from cron.  For example:&lt;BR /&gt;&lt;BR /&gt;test.sh:&lt;BR /&gt;export ORACLE_SID&lt;BR /&gt;export ORACLE_HOME&lt;BR /&gt;export SHLIB_PATH&lt;BR /&gt;export ORACLE_TERM&lt;BR /&gt;export PATH=$PATH:$ORACLE_HOME/bin&lt;BR /&gt;export LD_LIBRARY_PATH=$ORACLE_HOME/lib&lt;BR /&gt;export ORA_NLS33=&lt;BR /&gt;export ORACLE_BASE=&lt;BR /&gt;export ORACLE_DOC=$ORACLE_BASE/doc&lt;BR /&gt;export TMPDIR=/tmp&lt;BR /&gt;/path/sqlplus user/pass /home/oracle/test.sql&lt;BR /&gt;&lt;BR /&gt;I also use a sid script that sets up all the above parameters for you, for when I don't want to type all the above in!  Actually, it's a very good way to maintain all the oracle paths in one place.  Just write it so that you can pass in a parameter, then change your code.  For example:&lt;BR /&gt;&lt;BR /&gt;test.sh:&lt;BR /&gt;sid DEV #setup the oracle environment for DEV&lt;BR /&gt;/path/sqlplus user/pass /home/oracle/test.sql&lt;BR /&gt;&lt;BR /&gt;I hope this helps some.  Let me know if you'd like the code for my sid script.&lt;BR /&gt;&lt;BR /&gt;Jared</description>
      <pubDate>Mon, 06 Aug 2001 18:10:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561938#M918947</guid>
      <dc:creator>Jared Westgate_1</dc:creator>
      <dc:date>2001-08-06T18:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561939#M918948</link>
      <description>I am just installing Oracle and on Friday I got that exact same error message - it was because I did not have ORACLE_SID set.</description>
      <pubDate>Mon, 06 Aug 2001 18:29:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561939#M918948</guid>
      <dc:creator>Tracey</dc:creator>
      <dc:date>2001-08-06T18:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561940#M918949</link>
      <description>Hello Edoardo,&lt;BR /&gt;&lt;BR /&gt;try starting your script from Root's crontab with the&lt;BR /&gt;command line like:&lt;BR /&gt;   su - oracle -c sqlplus user/password@tnsname @ script&lt;BR /&gt;&lt;BR /&gt;this should be working - which means, it IS an env var&lt;BR /&gt;thing! So, write a small shell script, where you set the&lt;BR /&gt;variables ORACLE_HOME, and ORACLE_SID, perhaps&lt;BR /&gt;even SHLIB_PATH in case you did not relink oracle on&lt;BR /&gt;your platform, and call your script from within that script&lt;BR /&gt;as you do from the command line.&lt;BR /&gt;That should be it.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;   Wodisch</description>
      <pubDate>Mon, 06 Aug 2001 19:05:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561940#M918949</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2001-08-06T19:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561941#M918950</link>
      <description>Here is the code I use in my cron jobs for Oracle to&lt;BR /&gt;set the environment.  The SID is always the first&lt;BR /&gt;parameter.&lt;BR /&gt;&lt;BR /&gt;PATH=${PATH%:}:/oracle/product/8.1.5/bin&lt;BR /&gt;ORACLE_SID=$1&lt;BR /&gt;ORAENV_ASK=NO&lt;BR /&gt;export ORACLE_SID&lt;BR /&gt;. oraenv&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Aug 2001 21:30:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561941#M918950</guid>
      <dc:creator>Bill Thorsteinson</dc:creator>
      <dc:date>2001-08-06T21:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561942#M918951</link>
      <description>You avoid any problem if you try to run as oracle user, not as root user.&lt;BR /&gt;&lt;BR /&gt;To achieve it, modify your crontab line:&lt;BR /&gt;&lt;BR /&gt;su - &lt;ORACLE_USER&gt; -c sqlplus -silent &lt;CONNECTION&gt; @&lt;PL_TO_RUN&gt; &lt;PARAMETERS&gt;&lt;BR /&gt;&lt;BR /&gt;It works.&lt;/PARAMETERS&gt;&lt;/PL_TO_RUN&gt;&lt;/CONNECTION&gt;&lt;/ORACLE_USER&gt;</description>
      <pubDate>Tue, 07 Aug 2001 05:23:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561942#M918951</guid>
      <dc:creator>Manuel P. Ron</dc:creator>
      <dc:date>2001-08-07T05:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561943#M918952</link>
      <description>Well... tahnx for all your answers... right now I'm doing some testing based on some answers but I would like to clear some things.&lt;BR /&gt;1.- I don't want my script or any part of it to be run as root or as oracle this means forgetting about using "su -" in the script. Because it works fine from the command line using a different user.&lt;BR /&gt;So I discard all answers regarding su command.&lt;BR /&gt;2.- It seems that I'm forgetting an environment variable...&lt;BR /&gt;Here's the list of the variables that command "env" gives in the script ran as a cron job:&lt;BR /&gt;&lt;BR /&gt;SHLIB_PATH&lt;BR /&gt;PATH&lt;BR /&gt;NLS_LANG&lt;BR /&gt;ORACLE_BASE&lt;BR /&gt;CLASSPATH&lt;BR /&gt;ORACLE_SID&lt;BR /&gt;ORATAB&lt;BR /&gt;LD_LIBRARY_PATH&lt;BR /&gt;ORACLE_HOME&lt;BR /&gt;ORACLE_PFILE&lt;BR /&gt;ORAENV_ASK&lt;BR /&gt;&lt;BR /&gt;All of them are set correctly, Am I missing any?&lt;BR /&gt;Any more ideas????</description>
      <pubDate>Tue, 07 Aug 2001 05:30:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561943#M918952</guid>
      <dc:creator>Eduardo Uribe_1</dc:creator>
      <dc:date>2001-08-07T05:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561944#M918953</link>
      <description>Eduardo,&lt;BR /&gt;&lt;BR /&gt;  You must put $ORACLE_HOME/bin in the $PATH env variable. If your script sources a script that establishes the proper oracle environment(ie, shlib,nls_lang etc) then you should have no problems. Try the ~oracle/.profile or ~oracle/.cshrc depending on your account's default shell&lt;BR /&gt;&lt;BR /&gt; good luck</description>
      <pubDate>Tue, 07 Aug 2001 14:59:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561944#M918953</guid>
      <dc:creator>Jack Werner</dc:creator>
      <dc:date>2001-08-07T14:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: corntab sqlplus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561945#M918954</link>
      <description>Eduardo,&lt;BR /&gt;&lt;BR /&gt;    I forgot to mention that the form of sourcing any script in a script is picky; ".  ~oracle/.profile" for instance will assure that the variables set by ~oracle/.profile are inherited by your script, since the "." assures your default shell runs the ~oracle/.profile.&lt;BR /&gt; &lt;BR /&gt;   CIAO</description>
      <pubDate>Tue, 07 Aug 2001 15:04:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corntab-sqlplus/m-p/2561945#M918954</guid>
      <dc:creator>Jack Werner</dc:creator>
      <dc:date>2001-08-07T15:04:02Z</dc:date>
    </item>
  </channel>
</rss>

