List Info

Thread: crontab job loosing the Oracle env settings




crontab job loosing the Oracle env settings
user name
2007-07-24 03:31:50
Hi All 

 

I am trying  to create a shell script   that will restart 
the Listener
process   in case the  listener was shutdown unexpectedly .


 

My   shell script will be run successfully once invoked from
 prompt
(logged  as  oracle)   BUT  once as a crontab job I am
loosing ALL
oracle related environment  settings (my guess ) . 

if  my shell script  would  Just   if..  then ...   lsnrctl
start   then
in my ORACLE  mail message  it will say "program can
not  found .. )
but   if I will add   the  full path to my script ,
/opt/oracle/prosuct/10.1.0/db_1/bin/lsnrctl start 

 

Then I will get different  error message in my mail 

 

 

LSNRCTL for  Linux .... 

 

Message 1070 not  found ..  No message  file  for  product
... 
TNS-12560 
TNS-00515  message 515 not  found 

 

 

In other  words , The  shell script does  not  know how  ot
get  to
TNSNAMES.ORA

 

 

My theory as  of  the above  two examples   is  that   once 
the  shell
script  is  invoked from within crontab  (although the 
crontab job was
created while  logged  as  Oracle ) 

 

The  whole  oracle environment is  somehow lost . 

 

 

QUESTION - Do I have   to add something to the crontab job
to facilitate
the oracle  environment ?  Have  I missed something  else 
here ? 

 

 

Thank you  for  your  help 

 

Yoav

 

 

 

 

 

 

 

Re: crontab job loosing the Oracle env settings
user name
2007-07-24 03:49:42
Dear Yoav,

Am Dienstag, den 24.07.2007, 10:31 +0200 schrieb Yoav
Givon:

> ...
> QUESTION - Do I have   to add something to the crontab
job to facilitate
> the oracle  environment ?  Have  I missed something 
else  here ? 

you should perform the script as oracle user of course and
in addition
to that you should set your environment parameters as well.

E.G.:

crontab
========
# Oracle Script - once a day
00 23 * * *      oracle  /opt/bin/ora-script.sh

Beginning of the Script
========================

#!/bin/bash

export ORACLE_BASE=/opt/oracle
export ORACLE_SID=SID
export ORACLE_HOME=$ORACLE_BASE/OraHome

## starting the script ...

Hope it helps,

Maurice



-- 
OpenIT GmbH                             tel   +49 211 239
577-0
Maurice Kemmann                         fax   +49 211 239
577-10
Jahnstr. 18                             email kemmannopenit.de
D-40215 Düsseldorf                      http://www.openit.de
____________________________________________________________
____
HRB 38815 Amtsgericht Düsseldorf    USt-Id DE 812951861
Geschäftsführer:
Susanne Schultz, Oliver Haakert, Maurice Kemmann



-- 
To unsubscribe, email: suse-oracle-unsubscribesuse.com
For additional commands, email: suse-oracle-helpsuse.com
Please see http://www.suse.com/oracl
e/ before posting


Re: crontab job loosing the Oracle env settings
user name
2007-07-24 03:53:32
HI,

ALTERNATIVELY, DEPENDING ON YOUR OS, YOU MAY WANT TO SOURCE
THE GLOBAL 
ENVIRONMENT FILE, FOR LINUX E.G. /ETC/PROFILE.

AM DIENSTAG 24 JULI 2007 10:49 SCHRIEB MAURICE KEMMANN:
> DEAR YOAV,
>
> AM DIENSTAG, DEN 24.07.2007, 10:31 +0200 SCHRIEB YOAV
GIVON:
> > ...
> > QUESTION - DO I HAVE   TO ADD SOMETHING TO THE
CRONTAB JOB TO FACILITATE
> > THE ORACLE  ENVIRONMENT ?  HAVE  I MISSED
SOMETHING  ELSE  HERE ?
>
> YOU SHOULD PERFORM THE SCRIPT AS ORACLE USER OF COURSE
AND IN ADDITION
> TO THAT YOU SHOULD SET YOUR ENVIRONMENT PARAMETERS AS
WELL.
>
> E.G.:
>
> CRONTAB
> ========
> # ORACLE SCRIPT - ONCE A DAY
> 00 23 * * *      ORACLE  /OPT/BIN/ORA-SCRIPT.SH
>
> BEGINNING OF THE SCRIPT
> ========================
>
> #!/BIN/BASH
>
> EXPORT ORACLE_BASE=/OPT/ORACLE
> EXPORT ORACLE_SID=SID
> EXPORT ORACLE_HOME=$ORACLE_BASE/ORAHOME
>
> ## STARTING THE SCRIPT ...
>
> HOPE IT HELPS,
>
> MAURICE
>
>
>
> --
> OPENIT GMBH                             TEL   +49 211
239 577-0
> MAURICE KEMMANN                         FAX   +49 211
239 577-10
> JAHNSTR. 18                             EMAIL
KEMMANNOPENIT.DE
> D-40215 DüSSELDORF                     
HTTP://WWW.OPENIT.DE
>
____________________________________________________________
____
> HRB 38815 AMTSGERICHT DüSSELDORF    UST-ID DE
812951861
> GESCHäFTSFüHRER:
> SUSANNE SCHULTZ, OLIVER HAAKERT, MAURICE KEMMANN

-- 
FREUNDLICHE GRüßE

I.A.
MARTIN KLIER
SYSTEMADMINISTRATION/DATENBANKEN
------------------------------------------------------------
------
A.T.U AUTO-TEILE-UNGER
HANDELS GMBH & CO. KG
DR.-KILIAN-STR. 4 
92637 WEIDEN I.D. OPF.

TEL.: +49 961 306-5663
FAX : +49 961 306-5982

MARTIN.KLIERATU.DE
WWW.ATU.EU

SITZ: WEIDEN I. D. OPF., AMTSGERICHT WEIDEN I. D. OPF., HRA
2012
UST-ID NR. DE814195392, WEEE-NR. DE53789710
PERSöNLICH HAFTENDE GESELLSCHAFTERIN:
AFM AUTOFAHRERFACHMARKT GESCHäFTSFüHRUNGS GMBH
SITZ: WEIDEN I. D. OPF., AMTSGERICHT WEIDEN I. D. OPF., HRB
2842
GESCHäFTSFüHRER: KARSTEN ENGEL, DIRK MüLLER, MANFRED RIES
RE: crontab job loosing the Oracle env settings
user name
2007-07-24 03:59:21
Thank you Maurice and Martin . 

I thought   that as Crontab jobs are created BY the running
user and run on his user account this will preserve his
environment ... 

Have a nice day and thank you again !. 

Yoav 

-----Original Message-----
From: Martin Klier [mailto:martin.klieratu.de] 
Sent: Tuesday, July 24, 2007 10:54 AM
To: suse-oraclesuse.com
Cc: Maurice Kemmann; Yoav Givon
Subject: Re: [suse-oracle] crontab job loosing the Oracle
env settings

Hi,

alternatively, depending on your OS, you may want to source
the global 
environment file, for Linux e.g. /etc/profile.

Am Dienstag 24 Juli 2007 10:49 schrieb Maurice Kemmann:
> Dear Yoav,
>
> Am Dienstag, den 24.07.2007, 10:31 +0200 schrieb Yoav
Givon:
> > ...
> > QUESTION - Do I have   to add something to the
crontab job to facilitate
> > the oracle  environment ?  Have  I missed
something  else  here ?
>
> you should perform the script as oracle user of course
and in addition
> to that you should set your environment parameters as
well.
>
> E.G.:
>
> crontab
> ========
> # Oracle Script - once a day
> 00 23 * * *      oracle  /opt/bin/ora-script.sh
>
> Beginning of the Script
> ========================
>
> #!/bin/bash
>
> export ORACLE_BASE=/opt/oracle
> export ORACLE_SID=SID
> export ORACLE_HOME=$ORACLE_BASE/OraHome
>
> ## starting the script ...
>
> Hope it helps,
>
> Maurice
>
>
>
> --
> OpenIT GmbH                             tel   +49 211
239 577-0
> Maurice Kemmann                         fax   +49 211
239 577-10
> Jahnstr. 18                             email
kemmannopenit.de
> D-40215 Düsseldorf                      http://www.openit.de
>
____________________________________________________________
____
> HRB 38815 Amtsgericht Düsseldorf    USt-Id DE
812951861
> Geschäftsführer:
> Susanne Schultz, Oliver Haakert, Maurice Kemmann

-- 
Freundliche Grüße

i.A.
Martin Klier
Systemadministration/Datenbanken
------------------------------------------------------------
------
A.T.U Auto-Teile-Unger
Handels GmbH & Co. KG
Dr.-Kilian-Str. 4 
92637 Weiden i.d. OPf.

Tel.: +49 961 306-5663
Fax : +49 961 306-5982

martin.klieratu.de
www.atu.eu

Sitz: Weiden i. d. Opf., Amtsgericht Weiden i. d. OPf., HRA
2012
UST-ID Nr. DE814195392, WEEE-Nr. DE53789710
Persönlich haftende Gesellschafterin:
AFM Autofahrerfachmarkt Geschäftsführungs GmbH
Sitz: Weiden i. d. OPf., Amtsgericht Weiden i. d. OPf., HRB
2842
Geschäftsführer: Karsten Engel, Dirk Müller, Manfred Ries

--
To unsubscribe, email: suse-oracle-unsubscribesuse.com
For additional commands, email: suse-oracle-helpsuse.com
Please see http://www.suse.com/oracl
e/ before posting


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )