System Administration
Showing results for 
Search instead for 
Did you mean: 

Error in script when use cron

Griselda Sanchez
Frequent Advisor

Error in script when use cron

One of our developers that use oracle, try to run one script, and by session runs ok, but when he try to run by cron or at, it doesn’t run properly and this appear

11:21:28 SQL> BEGIN
11:21:28 3 OwnName => 'CPTSWEB'
11:21:28 4 ,IndName => 'IDX_N_C_C_ARTICULO_CCDY_ID'
11:21:28 5 ,Degree => NULL
11:21:28 6 ,No_Invalidate => FALSE);
11:21:28 7 END;
11:21:28 8 /
ERROR at line 1:
ORA-01116: error in opening database file 7
ORA-01110: data file 7: '/cpt6/oradata/DPHCPTPD/idx/DPHCPTPD_idx0101.dbf'
ORA-27092: skgfofi: size of file exceeds file size limit of the process
Additional information: 262143
Additional information: 281601
ORA-06512: at "SYS.DBMS_STATS", line 7989
ORA-06512: at "SYS.DBMS_STATS", line 8009
ORA-06512: at line 2

He did some research and find this

“The batch is scheduled by crontab. Due to feature of 'at', the job is executed
in a separate invocation of the shell, i.e., '/usr/bin/sh'. By default, the
ulimit set by sh shell is 4194303, which means not unlimited (4194303 * 512 bytes
of block size = 2Gb). No matter what shell is being used, the 'at' always set
that limit to 2Gb. The error then occurs because some operation accessed the data
in the datafile beyond 2GB.
If you need to use the 'at', then it is recommended to edit file
'/var/adm/cron/.proto' and modify the string 'ulimit $l' for 'ulimit unlimited'.
This garantees that the value 4194303 will no longer be used by the 'at'. “

I saw my file .proto but I had ulimit $l instead of 1.

What does .proto do ?

Honored Contributor

Re: Error in script when use cron

The default .proto file from an 11.00 system is:

# cat /var/adm/cron/.proto
# @(#) $Revision: 27.1 $
cd $d
ulimit $l
umask $m

look more in man pages of proto....

man 4 proto

Good Luck..
Honored Contributor

Re: Error in script when use cron

AT command, in order to simulate the current environment while executing the job, adds all the environment settings and copies the contents of the /var/adm/cron/.proto file to the job file, except by replacing special variables with values.

From the man page of proto

$l Replaced by the current file size
limit (see ulimit(2))

Learn What to do ,How to do and more importantly When to do ?