1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

SQLPLUS and CRONTAB

Discussion in 'SQL PL/SQL' started by santoshpayal, Jun 18, 2010.

  1. santoshpayal

    santoshpayal Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    Hi,
    Can someone please help me here with this one.

    This is my script:

    Code:
    # more tosh.sh
    #!/usr/bin/ksh
    clear
    . /home/oracle/.profile
    echo "Good morning, world."
    export ORACLE_HOME=/u01/app/oracle/product/9.0.1
    export PATH=$ORACLE_HOME/bin:/usr/local/bin
    export ORACLE_SID=xxxx

    /u01/app/oracle/product/9.0.1/bin/sqlplus -s xxxx/xxxx @/home/ivbbuild/rec.sql > /home/ivbbuild/rech.txt
    However when I run it from crontab I dont get anything. What am I missing here.

    My CRONATAB entry:

    Code:
    0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/ivbbuild/tosh.sh > /home/ivbbuild/tile.txt 2>&1
    The tile.txt file is produced with just "Good morning, world.". The file with SQL output is not produced (/home/ivbbuild/rech.txt)
    Tosh.
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    The cron output is going here: /home/ivbbuild/tile.txt. Have you checked that file?
     
  3. santoshpayal

    santoshpayal Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    Hi zargon,

    I just get Good morning, world. in the tile.txt

    Apart from that there is nothing.

    regards,
    Santosh.
     
  4. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    Do you get any output when you run this script from the shell prompt? What, exactly, do you see in that case? How does your shell environment differ from what you've set in the script to run from cron?