---删除6个月前的分区(local主键、索引)
[oracle@test ~]$ cat /home/oracle/del_t_test_aa.sh
#!/bin/bash
source /home/oracle/.bash_profile
DEL_DATE=$(date -d '6 month ago' +%Y%m)
#DEL_DATE=$(date +%Y%m)
PARTINAME="P"${DEL_DATE}
echo $PARTINAME
exec >> /home/oracle/del_t_test_aa`date +%y%m%d%H`.log
sqlplus / as sysdba << EOF
set timing on
--select sysdate from dual;
ALTER TABLE test._t_test_aa DROP PARTITION $PARTINAME UPDATE GLOBAL INDEXES PARALLEL 4;
exit;
EOF
[oracle@test ~]$ DEL_DATE=$(date -d '6 month ago' +%Y%m)
[oracle@test ~]$ PARTINAME="P"${DEL_DATE}
[oracle@test ~]$ echo $PARTINAME
P201711
---定时任务
10 3 1 * * sh /home/oracle/del_t_test_aa.sh