本文共 660 字,大约阅读时间需要 2 分钟。
---删除6个月前的分区(local主键、索引)
[[email protected] ~]$ 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
[[email protected] ~]$ DEL_DATE=$(date -d ‘6 month ago‘ +%Y%m)
[[email protected] ~]$ PARTINAME="P"${DEL_DATE}
[[email protected] ~]$ echo $PARTINAME
P201711
原文:https://www.cnblogs.com/ss-33/p/8989507.html