10G以上表空间drop过程
2019-05-31大表空间包含大表,应该用truncate一点一点的收缩空间 ,如果直接drop会引起io卡死。
例如:
#!/bin/bash
#SQL> select 'drop table '||tname||' purge;' from tab where tname like '%20110%' order by tname;
. ~/.bash_profile
#ym=$(date -d -21month +%Y%m)
ym=201511
sqlplus -S abc/123456 << EOF set hea off col SEGMENT_NAME format a30 truncate table VIEWER_${ym}; truncate table VIEWER_PAGE_${ym}; truncate table VIEWER_INVITE_$ym; drop table VIEWER_${ym} purge; drop table VIEWER_PAGE_${ym} purge; drop table VIEWER_INVITE_$ym purge; DROP TABLESPACE VIEWER_DATA_TS_${ym} INCLUDING CONTENTS AND DATAFILES; DROP TABLESPACE VIEWER_PAGE_DATA_TS_${ym} INCLUDING CONTENTS AND DATAFILES; DROP TABLESPACE VIEWER_INVITE_DATA_TS_$ym INCLUDING CONTENTS AND DATAFILES; quit; EOF
分类:数据库 | 标签: |