#setup the ENV that Perl knows about:
$ENV{ORACLE_HOME}='/opt/local/instantclient_10_2';
$ENV{LD_LIBRARY_PATH}='/opt/local/instantclient_10_2';
my $sqlplus;
$sqlplus=`sqlplus user/password\@DBNAME << END
sql statements here...;
exit
END
`;
open(MAILX, "| mailx -s 'db report' user\@domain ") || die "mailx no work
\n";
print MAILX $sqlplus;
close MAILX;
In addition, remember that to edit your crontab, you may need to: export EDITOR=vi
No comments:
Post a Comment