I have a file named diario.sh that I run manually using ./diario.sh
The script file contains the following:
#!/bin/bash
cd /home/etapa/Scripts
echo "@CDRS_ETAPATOTAL.sql" | sqlplus -s ooperadores/ooperadores@OOPERADORES | while read output;
do
echo $output
done
When I run it manually works fine but when I try to run it using crontab I get the following error:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
The crontab entry is the following:
10 * * * * /home/etapa/Scripts/diario.sh > /home/etapa/Scripts/diario.log 2>&1
Please help me solve this problem.