Monday 19 December 2011

Cron Scheduled script is not running

The SQL script is scheduled in the crontab but it is not giving any output.

Findings:
To investigate the problem we need to check the logs one by one.
1) Check the cron logfile at /var/adm/cron/log

root      : CMD ( /usr/sbin/dumpctrl -k >/dev/null 2>/dev/null ) : PID ( 1917118 ) : Fri Dec 16 16:05:00 2011
Cron Job with pid: 1917118 Successful
root      : CMD ( /usr/sbin/dumpctrl -k >/dev/null 2>/dev/null ) : PID ( 1060890 ) : Fri Dec 16 16:10:00 2011
Cron Job with pid: 1060890 Successful

The Status is Successful it means cron is running at its scheduled time but there is some problem in the called script.

2) Check /usr/spool/mail/orauat file
It shows some error.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified

SP2-0640: Not connected
SP2-0640: Not connected
*****************************************************************
cron: The previous message is the standard output
and standard error of one of the cron commands.

It means the sql called in the script is not able to connect to the database.

Check the script properly.

In my case,i had have two instances running on same host and i did not set the ORACLE_SID in the script.So,i just set the ORACLE_SID in the script and it worked fine.

No comments:

Post a Comment