#!/bin/ksh
. /db/home/oracle/db.env
MAIL_ADDR=TST@TEST.com
sqlplus / as sysdba <<EOF
spool /db/home/oracle/dbms_stats.log
set time on
set timing on
set feedback on
exec dbms_stats.gather_table_stats('EBDS','ACCOUNT',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','ACCOUNT_PRODUCT',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','DEVICE',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','DEVICE_PRODUCT',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','LOGICAL_ENTITY',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','SERVICE',degree => 16);
exec dbms_stats.gather_table_stats('RECON','ENT_ACCOUNT',degree => 16);
exec dbms_stats.gather_table_stats('RECON','ENT_LOGICAL',degree => 16);
spool off
EOF
mailx -s "Gather stats on DSSRPT" $MAIL_ADDR < /db/home/oracle/dbms_stats.log
. /db/home/oracle/db.env
MAIL_ADDR=TST@TEST.com
sqlplus / as sysdba <<EOF
spool /db/home/oracle/dbms_stats.log
set time on
set timing on
set feedback on
exec dbms_stats.gather_table_stats('EBDS','ACCOUNT',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','ACCOUNT_PRODUCT',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','DEVICE',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','DEVICE_PRODUCT',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','LOGICAL_ENTITY',degree => 16);
exec dbms_stats.gather_table_stats('EBDS','SERVICE',degree => 16);
exec dbms_stats.gather_table_stats('RECON','ENT_ACCOUNT',degree => 16);
exec dbms_stats.gather_table_stats('RECON','ENT_LOGICAL',degree => 16);
spool off
EOF
mailx -s "Gather stats on DSSRPT" $MAIL_ADDR < /db/home/oracle/dbms_stats.log