Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

imp error

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi, I have imp.sh script to run import, it works fine manually, but failed in cronjob. Here is the script:

$ more imp.sh
ORACLE_HOME=/u01/app/oracle/product/8.1.6; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID

imp usr/pwd parfile=/u04/pro/params.dat log=/u04/pro/imp.log

$ crontab -l
30 17 9 9 0 /u04/pro/imp.sh

When I put it in cronjob I got mail:

From oracle Sun Sep 9 17:31:01 2001
Date: Sun, 9 Sep 2001 17:31:01 -0400 (EDT)
From: oracle
Message-Id: <200109092131.RAA00569@kids01>
To: oracle
Subject: Output from &quot;cron&quot; command
Content-Length: 107

Your &quot;cron&quot; job on kids01
/u04/pro/imp.sh

produced the following output:

/u04/pro/imp.sh: imp: not found

Any ideas? Thanks!


 

which user are you using on this crontab? If you are running the crontab using root for example, but in your imp.sh you should be oracle user, then you must revise imp.sh to become:

su - oracle &quot;-c export ORACLE_SID=orcl; imp usr/pwd parfile=/u04/pro/params.dat log=/u04/pro/imp.log &quot;


The problem with your script is that he can not see the imp utility, maybe bec it's not in the the ORACLE_HOME/bin is not in the PATH of the user who calls the crontab.
 
I login as oracle, should I specify ORACLE_HOME/bin for the path? But it works fine manually. Thanks.
 
When you login and run it manually your PATH is set up via your .profile.

When cron runs it doesn't use a .profile, so all the environment variables that it will use must be specified
in the script.


Modify the final line in imp.sh, to read

$ORACLE_HOME/bin/imp usr/pwd parfile=/u04/pro/params.dat log=/u04/pro/imp.log

Steve
 
You can always read a .profile with this:
Code:
. path/.profile
 

In your case, Steve is right, include the absolute path of the imp in your script instead.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top