|
|
|
|
Re: unix script for sql result [message #348651 is a reply to message #348596] |
Wed, 17 September 2008 08:44 |
alanm
Messages: 284 Registered: March 2005
|
Senior Member |
|
|
ok here is the script
select count(*) from dba_users where account_status !='OPEN'
and username not in (
'PROD_HCUST_HK',
'MDSYS',
'SCOTT',
'WMSYS',
'CTXSYS',
'ANONYMOUS',
'OUTLN',
'MGMT_VIEW',
'SI_INFORMTN_SCHEMA',
'ORDSYS',
'EXFSYS',
'DMSYS',
'ORACLE_OCM',
'TSMSYS',
'MDDATA',
'DIP',
'SYSMAN',
'XDB',
'ORDPLUGINS',
'OLAPSYS'
)
;
normally the result of count(*) will be '0'
if the result is 'not 0' then what I would like is a unix script which will be able to send an email to me.
regards
Alan
|
|
|
Re: unix script for sql result [message #348658 is a reply to message #348651] |
Wed, 17 September 2008 08:56 |
|
Michel Cadot
Messages: 68718 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
You can put the result of your query inside a SQL*Plus variable and then use it to set the exit status that you can check in your shell script.
You can also directly mail from database.
Regards
Michel
|
|
|