Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Unix script
Basis of a script added into yours below. Note I am only checking to see if there is a PMON proces up - maybe best to make a sqlplus connection and read v$instance or something and exit if it fails.
Really very poor but will give you something to work on.
What I don't see from your sample script is the end marker for the << ! command I normally use << EOF and then at the end of the sql statements I have a line with EOF in. I do not see your ! marker
To get a log file call the shell script and > to log_file or set that up in your cron routine
HTH John
-----Original Message-----
From: Roland.Skoldblom_at_ica.se [mailto:Roland.Skoldblom_at_ica.se]
Sent: 28 January 2002 14:31
To: Multiple recipients of list ORACLE-L
Subject: Unix script
Hallo,
I have this unix script. I would like to include code which checks if the oracle database is up and running so the procedure konto.fillbotables.anrop doesnt start at all.. I also want an errorlog file to be created. Please tell me how to write the
code and where to include it in this shell script.
#!/bin/sh . /usr/bin/orasetup.sh . /d31/appl/konto/bat/movefiles.sh
numberOfLines=`ps -ef|grep pmon wc -l` grep for sid or ora_pmon_sid or whatever
if [ $numberOfLines -lt 2 ] # ie database not running
then
cat dummy_file |mailx -s "No database running loader not started" roland_at_xxx.com
else
fi
sqlldr userid=konto/icakort control=/d31/appl/konto/bat/ehbgrupp.ctl
log=/d31/appl/konto/log/ehbgrupp.log
sqlplus -s konto/icakort << !
set heading off
set verify off
set feedback off
set termout off
set pages 0
begin
konto.fillbilbotables.anrop;
END;
/
EXIT
fi
sqlldr userid=konto/icakort control=/d31/appl/konto/bat/ehbgrupp.ctl
log=/d31/appl/konto/log/ehbgrupp.log
sqlplus -s konto/icakort << !
set heading off
set verify off
set feedback off
set termout off
set pages 0
begin
konto.fillbilbotables.anrop;
END;
/
EXIT
Thanks in advance
Roland
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Roland.Skoldblom_at_ica.se Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). ========================================================= This electronic message contains information from the mmO2 plc Group which may be privileged or confidential. The information is intended to be for the use of the individual(s) or entity named above. If you are not the intended recipient be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this electronic message in error, please notify us by telephone or email (to the numbers or address above) immediately. =========================================================Received on Mon Jan 28 2002 - 10:37:19 CST
![]() |
![]() |