hi,
creat a script something like this and set up the cron job
#!/bin/sh
#user=${1}
#pass=${2}
#sid=${3}
user="cognos"
pass="focus"
sid=gdmprd
ORACLE_HOME=/app/oracle/product/8.1.7
${ORACLE_HOME}/bin/sqlplus -s ${user}@${sid}/${pass}<<__eof__ > /tmp/am.log 2>&1
spool /tmp/ind.sql
select 'Alter index' || object_name || 'rebuild'
from all_objects
where trunc(created) < trunc(sysdate - 180)
and object_type like'%INDEX%'
order by owner;
spool off
@/tmp/ind.sql
__eof__
There is always a better way to do the things.