Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2005
    Posts
    29

    Unanswered: RMAN Script fails to run in cron

    Hello,

    I have this rman script which runs perfectly when I execute from command line but fails to run when I attempt to schedule from cron

    #!/bin/ksh
    PATH=/usr/local/bin:$PATH;export PATH
    ORACLE_SID=dsprd01;export ORACLE_SID
    ORAENV_ASK=NO;export ORAENV_ASK
    LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH
    PATH=/usr/sbin:$PATH; export PATH
    USER=oracle
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
    Today="`date +%d%m%Y`" # month number, day of month, year
    rman target =/ log=/u03/datafiles/dsprd01/rman_backups/dsprd01_backups_$Today.log << EOF
    run {
    backup database plus archivelog;
    }
    EOF
    exit
    Is there anything I can do to get this to run via cron? Am I missing or doing something silly here

    Your thoughts are much appreciated

    Thanks in advance

    tspoon

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Does the cron command send all output to a log file.
    Code:
    00 12 * * * mscript >/tmp/myscript.log 2>&1
    Sometimes its necessary to define the TERM variable, even though there is no output to the terminal.

  3. #3
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    Quote Originally Posted by tspoon View Post
    Is there anything I can do to get this to run via cron?
    Try it something like this to see if anything gets logged(i.e. errors, exceptions, etc):
    Code:
    00 20 * * 1 . .profile; /path/to/script.sh >>/path/to/logs/script.log 2>&1

  4. #4
    Join Date
    Jun 2005
    Posts
    29

    rman script output

    Hello,

    this is an output of the job using the log file

    #!/bin/ksh

    # Declare your ORACLE environment variables

    PATH=/usr/local/bin:$PATH;export PATH
    ORACLE_SID=dsprd01;export ORACLE_SID
    ORAENV_ASK=NO;export ORAENV_ASK
    LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH
    PATH=/usr/sbin:$PATH; export PATH
    USER=oracle
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

    Today="`date +%d%m%Y`" # month number, day of month, year
    rman target =/ log=/u03/datafiles/dsprd01/rman_backups/dsprd01_backups_$Today.log << EOF
    run {
    backup database plus archivelog;
    }
    EOF
    exit
    CRON
    ======
    # Daily Exports
    00 11 * * * ksh /tmp/rman.ksh > /tmp/myscript.log 2>&1
    OUTPUT
    =======

    /tmp/rman.ksh[18]: rman: not found [No such file or directory]

  5. #5
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Thumbs down

    You are missing the Oracle binaries in the PATH variable:
    Code:
     . . . 
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
    PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin; export PATH
    . . .
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  6. #6
    Join Date
    Jun 2005
    Posts
    29

    script runs well

    many thanks,

    my script has been cron'd and now works like a dream

    tspoon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •