cancel
Showing results for 
Search instead for 
Did you mean: 

RMAN Backup doesn't start

SOLVED
Go to solution
Christian Marquardt_1
Regular Advisor

RMAN Backup doesn't start

Hi Admins,
I've a problem running my rman backup script.
We've to database machines. On one the cronjob for taking hourly archivelog rman backups running fine on the other it returns the error "ORA-07217: sltln: environment variable cannot be evaluated".
Here's the crontab entry (identical on both machines):
0 * * * * su - crime92 -c "/oracle/admin/CRIME92/bin/db2fs_ar.scr" 1>/dev/null 2>&1

The ORACLE_SID Variable is set by the .profile of the crime92 user.

Has anyone a idea where's the problem?

regards
Christian
14 REPLIES
Christian Marquardt_1
Regular Advisor

Re: RMAN Backup doesn't start

PS: If I copy the crontab entry in my shell window and starting it runs fine. If the job is running automatically by crontab the error occurs.
Adisuria Wangsadinata_1
Honored Contributor

Re: RMAN Backup doesn't start

Hi,

Check the thread below :

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=869774

Hope this information can help you.

Cheers,
AW
now working, next not working ... that's unix
Muthukumar_5
Honored Contributor
Solution

Re: RMAN Backup doesn't start

crontab execution to some other with su -c will not read .profile of that specific user. You have to just export ORACLE_SID variable explicitly.

hth.

Easy to suggest when don't know about the problem!
Christian Marquardt_1
Regular Advisor

Re: RMAN Backup doesn't start

Hi,
I understand that the su -c isn't reading the .profile because on the other machine it works fine. The scripts and the crontab entries are identical on both machines.

Christian
Eric Antunes
Honored Contributor

Re: RMAN Backup doesn't start

Hi Christian,

Just to test, try again after adding ORACLE_SID in the oracle/admin/CRIME92/bin/db2fs_ar.scr script...

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Christian Marquardt_1
Regular Advisor

Re: RMAN Backup doesn't start

Hi Eric,
adding the "export ORACLE_SID" command to the script works fine. But my problem is that there's a machine who's working without setting the ORACLE_SID in the script and another machine doesn't. I've no idea what configuration was done on the "good" machine.

regards
Christian
Yogeeraj_1
Honored Contributor

Re: RMAN Backup doesn't start

hi christian,

it could be that ORACLE_SID and other environment variables are already set in the user's profile or /etc/profile

check this out!

regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Eric Antunes
Honored Contributor

Re: RMAN Backup doesn't start

Or you can have in "/oracle/admin/CRIME92/bin/db2fs_ar.scr something like this:

export ORA_ENVFILE="/.../oracle/product/.../.env"

And this /.../oracle/product/.../.env has the export ORACLE_SID=""

Best Regards,

Eric
Each and every day is a good day to learn.
Yogeeraj_1
Honored Contributor

Re: RMAN Backup doesn't start

hi again,

in our environment, we only have the following three line in the Oracle user account's .profile:

export ORACLE_SID=
export ORACLE_HOME=/u01/app/oracle/product/8.1.7
export CLASSPATH=/u01/app/oracle/product/8.1.7/jre:/u01/app/oracle/product/8.1.7/jlib:.


and the crontab has an entry as follows:
00 01 * * * echo "/app/backup/rman.sh" | su - oracle 1>/dev/null 2>&1


good luck

regards
yogeeraj

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Jean-Luc Oudart
Honored Contributor

Re: RMAN Backup doesn't start

Christian,


the problem sometimes with "su - " is that .profile may be interactive then the script won't work.

Therefore, the best way is to have a dedicated cron.profile that set the environment for the script.
Also, you can use a script wrapper that will call the cron.profile before starting the script.
It works for us.

Regards
Jean-Luc
fiat lux
Christian Marquardt_1
Regular Advisor

Re: RMAN Backup doesn't start

Hi Jean-Luc,
I dont know what the cron.profile is. It is a dedicated .profile for the execution of cronjobs?
If yes I cant use this .profile because I run many backup jobs for different databases with different sid's.

regards
Christian
Jean-Luc Oudart
Honored Contributor

Re: RMAN Backup doesn't start

Christian,

to summarise the cron.profile is like your .profile but trimmed down.
Removes all interactive aspects.

The wrapper script will call the cron.profile to initialise the environement variables PATH, SHLIB_PATH, ORACLE_HOME, ...
but obviously some specific parameters will not be set in the cron.profile or (your choice) will be overwritten in you wrapper script

e.g.
#!/bin/sh

# wrapper script : cron<scriptname>.sh

. /home/oracle/cron.profile
export ORACLE_SID=
/oracle/admin/scripts/<scriptname>.sh > /oracle/admin/reports/<scriptname>.out

Regards
Jean-Luc
fiat lux
Yogeeraj_1
Honored Contributor

Re: RMAN Backup doesn't start

hi again,

below a quote from man crontab


cron supplies a default environment for every shell, defining:

HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh

Users who desire to have their .profile executed must explicitly do so in the crontab entry or in a script called by the entry.


which is in line with what jean-luc is describing you above.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
SLIMANI_1
Occasional Advisor

Re: RMAN Backup doesn't start

Hi
Please note that when executing some script from the cron , it doesnt execute the .profile, so environneement variable are not set.
try to insert the "set environnement variable" from . profile in the script executed by the cron.

good luck