Operating System - HP-UX
1833381 Members
3626 Online
110052 Solutions
New Discussion

Re: not an identifier ???

 
SOLVED
Go to solution
Kamran Hussain_1
Occasional Contributor

not an identifier ???

I have a script that runs fine from a prompt, but generates this error when scheduled thru cron:

/usr/users/oracle/dba/utils/run_statspack_snap.ksh: ORACLE_SID=tad: is not an identifier

##------Start script-----
#!/usr/bin/ksh
export ORACLE_SID="$1"$member

sqlplus -s perfstat/pass < set feedback off
exec statspack.snap
EOF
##------End script-------
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: not an identifier ???

Hi:

'cron' provides a sparse environment for any task. This consists of the HOME, LOGNAME, SHELL and PATH variables. Your '.profile' is *not* sourced so this environment differs radically from the one you come to expect following a normal login. This is the reason for the behavior you see.

A good approach is to setup a file of the environmental variables you want to provide, specically including a PATH statement. Then, in your '.profile' source (read) this file. For crontasks, do the same; read the variables from the environmental file. For example, to source 'home/oracle/env' do:

# . /home/oracle/env

Regards!

...JRF...
Darren Prior
Honored Contributor

Re: not an identifier ???

Hi,

The post above contains some good info on setting up your environment for your cron jobs.

In your script, where does $member get set?

I also wondered if there's anything strange about your shell identifier line, eg if you wrote the script on a PC and it had a control character within it.

regards,

Darren.
Calm down. It's only ones and zeros...
Zafar A. Mohammed_1
Trusted Contributor

Re: not an identifier ???

Kamran,

Always running any Oracle/Informix Database scripts from CRON, export all the Oracle/Informix environment variables with their home directories and configuration files also.

Thanks
Zafar
Kamran Hussain_1
Occasional Contributor

Re: not an identifier ???

Thank you gentlemen, I have run into this before...thanks for the reminder.

Always appreciate the prompt and accurate responses in this forum :-)