Unable take automated export thro' crontab
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: Unable take automated export thro' crontab

  1. #1
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588

    Question Unable take automated export thro' crontab

    Hello,

    I want to automate my backup with crontab
    steps followed
    ==============
    1) I created a shell (named expDB.sh,with chmod 777 permission)for taking backup.The content of shell is given below
    /user2/oracle/bin/exp scott/tiger file=/usr/users/oracle/kan/emp.dmp tables=emp
    direct=y

    2)45 6 * * * /usr/users/oracle/kan/exptest > /dev/null
    3) i submitted the job by
    crontab crontest
    4) At 06.45 hrs cron job ran and given following error at /var/spool/mail/oracle
    Message 206 not found; No message file for product=RDBMS, facility=EXP: Release
    8.1.7.0.0 - Production on Mon Oct 1 06:45:00 2001

    (c) Copyright 2000 Oracle Corpor

    Invalid format of Export utility name

    Verify that ORACLE_HOME is properly set

    Export terminated unsuccessfully

    EXP-00000: Message 0 not found; No message file for product=RDBMS, facility=EXP

    *************************************************
    Cron: The previous message is the standard output
    and standard error of the following crontab command:

    /usr/users/oracle/kan/expt > /dev/null

    (I tried the above steps with oracle user as well as with root user, the same error occured.I checked the .profile of oracle user for oracle home and is found to be ok)

    Thanks

    Sameer

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    95% of the time, the problem with crontabs are that you don't have your environment variables set correctly. I believe this is your problem. I would change your crontab file to include:
    45 6 * * * (/bin/ksh ; . .profile; /usr/users/oracle/kan/exptest > /dev/null )
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Dec 2001
    Location
    Brisbane, Australia
    Posts
    28
    I would add '. .profile' inside the exptest script rather than running it inside the crontab.
    By default, /bin/sh will be used and it should be good enough for most shell scripts.

    To sum it all up, you should source the Oracle's .profile or some kind of profiles to make sure you have ORACLE_SID and ORACLE_HOME setup before executing the exp command.

  4. #4
    Join Date
    Mar 2001
    Location
    Ireland/Dublin
    Posts
    684
    Use in cron that command:

    00 01 * * 0 su -l oracle --command="/home/oracle/script.sh"

    and you will not get any problems with invironment settings.
    Best wishes!
    Dmitri

  5. #5
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588

    Unable take automated export thro' crontab

    Hi

    Thanks for the replies.. But even after adding .profile in crontab I get the same error..

    >00 01 * * 0 su -l oracle -->command="/home/oracle/script.sh"
    >and you will not get any problems with invironment settings.

    So I tried above solution...

    It failed because I need to submit password for oracle user.

    <--------------------------------------------------------->
    Your "cron" job on cmsdev2
    su -l oracle --command="export/home/oracle/dekadmp/expDB.sh"

    produced the following output:

    su: Sorry
    <--------------------------------------------------------->

    How do I submit inline password?

    Thanks

    Sameer

  6. #6
    Join Date
    Oct 2001
    Location
    Madrid, Spain
    Posts
    763
    su - oracle - c

    And you don´t need to pass the password

    Hope that helps

    Angel

  7. #7
    Join Date
    Dec 2001
    Location
    Brisbane, Australia
    Posts
    28
    If you have multiple Oracle instance and you probably want a different profile to establish the ORACLE_SID for each instance. If you only have one Oracle instance, you can use the su method and ensure the Oracle profile setup ORACLE_SID.

  8. #8
    Join Date
    Mar 2001
    Location
    Ireland/Dublin
    Posts
    684

    Re: Unable take automated export thro' crontab

    Create crontab as ROOT and use:
    00 01 * * 0 su -l oracle --command="/home/oracle/script.sh"

    I always do that and never care about env.

    Originally posted by Sameer
    Hi
    Thanks for the replies.. But even after adding .profile in crontab I get the same error..
    >00 01 * * 0 su -l oracle -->command="/home/oracle/script.sh"
    >and you will not get any problems with invironment settings.
    So I tried above solution...
    It failed because I need to submit password for oracle user.
    <--------------------------------------------------------->
    Your "cron" job on cmsdev2
    su -l oracle --command="export/home/oracle/dekadmp/expDB.sh"
    produced the following output:
    su: Sorry
    <--------------------------------------------------------->
    How do I submit inline password?
    Thanks
    Sameer
    [Edited by kgb on 01-15-2002 at 04:15 AM]
    Best wishes!
    Dmitri

Posting Permissions

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


Click Here to Expand Forum to Full Width