LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-09-2019, 07:43 AM   #1
fawaz25
Member
 
Registered: Oct 2018
Posts: 36

Rep: Reputation: Disabled
Oracle 11g database backup is failing as cronjob


Dear All,

I am trying to take backup of database via following command.

Code:
expdp xyz/xyz@orcl schemas=xyz directory=dumps dumpfile=xyz_bk_date.dmp logfile=expdpxyz_bk_date.log
The above command is working fine via command prompt.

But if I make a script and add the above command in it and run it as a cronjob, it is failing.
i am getting the following error:
/home/oracle/scripts/backup.txt: line 6: expdp: command not found
 
Old 07-09-2019, 08:11 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by fawaz25 View Post
Dear All,
I am trying to take backup of database via following command.
Code:
expdp xyz/xyz@orcl schemas=xyz directory=dumps dumpfile=xyz_bk_date.dmp logfile=expdpxyz_bk_date.log
The above command is working fine via command prompt. But if I make a script and add the above command in it and run it as a cronjob, it is failing. i am getting the following error:
/home/oracle/scripts/backup.txt: line 6: expdp: command not found
Again, as you've been asked several times previously, are you paying for Oracle? It is NOT FREE, and you've mentioned RAC in previous threads....have you contacted Oracle support? And what version/distro of Linux are you using???

Past that, your error is fairly plain; the expdp command isn't in the path that's exported via CRON, so specify the full path in the script.
 
Old 07-10-2019, 01:35 AM   #3
fawaz25
Member
 
Registered: Oct 2018
Posts: 36

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Again, as you've been asked several times previously, are you paying for Oracle? It is NOT FREE, and you've mentioned RAC in previous threads....have you contacted Oracle support? And what version/distro of Linux are you using???

Past that, your error is fairly plain; the expdp command isn't in the path that's exported via CRON, so specify the full path in the script.

We are using Oracle Linux 7.5 which is free.

As you mentioned, I mentioned the full path as below in the script:
Code:
/u01/app/oracle/product/12.2.0.1/db_1/bin/expdp

But still it is giving me the follwoing error:

Code:
UDE-00013: Message 13 not found; No message file for product=RDBMS, facility=UDE
UDE-00019: You may need to set ORACLE_HOME to your Oracle software directory
 
Old 07-10-2019, 06:03 AM   #4
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by fawaz25 View Post
But still it is giving me the follwoing error:

Code:
UDE-00013: Message 13 not found; No message file for product=RDBMS, facility=UDE
UDE-00019: You may need to set ORACLE_HOME to your Oracle software directory
There it is in BOLD. If you do not know what ORACLE_HOME is, contact your DBA.
 
Old 07-10-2019, 06:46 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by fawaz25 View Post
We are using Oracle Linux 7.5 which is free.
OEL is **NOT ORACLE DATABASE**, but Oracle Linux. One is free, the other is not. So why are you still not paying for Oracle???
Quote:
As you mentioned, I mentioned the full path as below in the script:
Code:
/u01/app/oracle/product/12.2.0.1/db_1/bin/expdp
But still it is giving me the follwoing error:
Code:
UDE-00013: Message 13 not found; No message file for product=RDBMS, facility=UDE
UDE-00019: You may need to set ORACLE_HOME to your Oracle software directory
...which is a DIFFERENT error than you initially posted. And as dc.901 said, this error (and the first error) are VERY obvious; you haven't set up Oracle correctly, don't have a path set, etc. If your DBA followed the installation instructions, you'd have the ORACLE_HOME environment variable set already. And **AGAIN**, if you contacted Oracle support, they could have told you this as well.
 
Old 07-15-2019, 06:10 AM   #6
fawaz25
Member
 
Registered: Oct 2018
Posts: 36

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
OEL is **NOT ORACLE DATABASE**, but Oracle Linux. One is free, the other is not. So why are you still not paying for Oracle???

...which is a DIFFERENT error than you initially posted. And as dc.901 said, this error (and the first error) are VERY obvious; you haven't set up Oracle correctly, don't have a path set, etc. If your DBA followed the installation instructions, you'd have the ORACLE_HOME environment variable set already. And **AGAIN**, if you contacted Oracle support, they could have told you this as well.

We are paying for Oracle database. The issue is solved. Thanks for help.
 
Old 07-15-2019, 06:11 AM   #7
fawaz25
Member
 
Registered: Oct 2018
Posts: 36

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dc.901 View Post
There it is in BOLD. If you do not know what ORACLE_HOME is, contact your DBA.
DOne. Thank you.
 
Old 07-15-2019, 07:22 AM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by fawaz25 View Post
We are paying for Oracle database. The issue is solved. Thanks for help.
Great; so why don't you post the solution???
 
Old 07-16-2019, 12:33 AM   #9
fawaz25
Member
 
Registered: Oct 2018
Posts: 36

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Great; so why don't you post the solution???
ORACLE_HOME was already set as an environment variable, but still the script was failing.

The problem was that cron was NOT reading any user profile settings, so I had to define it in the cron script.
I had to set the environment variable ORACLE_HOME in my script as below, and then ran the script via cronjob. Its working fine. Checking for all needed variables in .profile and defining it in the beginning of cron script solved the issue.

Code:
export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1
$ORACLE_HOME/bin/expdp xyz/xyz@orcl schemas=xyz directory=dumps dumpfile=xyz_bk_date.dmp logfile=expdpxyz_bk_date.log

Last edited by fawaz25; 07-16-2019 at 04:10 AM.
 
Old 07-16-2019, 10:25 AM   #10
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by fawaz25 View Post
ORACLE_HOME was already set as an environment variable, but still the script was failing.

The problem was that cron was NOT reading any user profile settings, so I had to define it in the cron script.
Thank you for posting the solution. I'm sure it will help others in the future.

Yes, cron runs in its own environment, so setting environment variables and using absolute paths is always the Best Practice in cron jobs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to install Oracle 11g R2 Database server on Centos 6.3 LXer Syndicated Linux News 0 01-03-2013 01:03 PM
Automatically starting oracle 11g database on system startup mlnm Linux - Newbie 6 12-16-2012 06:24 PM
Installing Oracle 11g Database Requirements carlosinfl Linux - Server 2 12-08-2010 12:24 PM
LXer: A First Look at Oracle 11g database on Debian GNU/Linux LXer Syndicated Linux News 0 08-20-2007 01:30 AM
LXer: Oracle names 11g Database price LXer Syndicated Linux News 0 08-15-2007 12:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration