ptname=CCC_P$(date +%y%m%d)
#date -d yesterday +%y%m%d
#date +%y%m%d --date '2 days ago'
#date +%y%m%d --date '2 days'
sqlplus -S / as sysdba<< EOF
BEGIN
dbms_stats.gather_table_stats(ownname => 'CCCS',
tabname => 'CCC_CCCNX',
partname => '$ptname',
estimate_percent => dbms_stats.auto_sample_size,
degree => 8,
cascade => true,
granularity => 'PARTITION',
method_opt => 'for all indexed columns');
END;
/
EOF