. $ENV_FILE
echo “Started Analyze Schema of $SCHEMA_NAME at `date +%D-%T`”
$ORACLE_HOME/bin/sqlplus -s <
execute dbms_stats.gather_schema_stats( ownname => ‘$SCHEMA_NAME’,
degree => DBMS_STATS.DEFAULT_DEGREE,
cascade => TRUE,
granularity=> ‘ALL’ );
EOF
echo “Ended at `date +%D-%T`”
– Script End
Also, configure cron for execution on every sunday 11.00 PM as following.
00 11 * * 0 /export/home/oracle/oraprocs/analyze_schema.ksh /oracle/app/oracle/oraprocs/ora_SID.env CIF > /export/home/oracle/oraprocs/logs/analyze_schema_CIF.log 2> /export/home/oracle/oraprocs/logs/analyze_schema_CIF.err