1.
第一次接触表分区,做了些练习,遇到一个超级恶心的问题。
--查看某个表的表分区
select TABLESPACE_NAME,partition_name, High_value from user_tab_partitions where
table_name='TEST';
--表分区定义
select dbms_metadata.get_ddl('TABLE','TEST','DBUSER') from dual;
--添加表分区
alter table TEST add
PARTITION "PAR_201608" VALUES LESS THAN (201608)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOLOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "BS_TS_REPORTS" NOCOMPRESS
以上为增加表分区的过程。
查看修改后的表分区
select TABLESPACE_NAME,partition_name, High_value from user_tab_partitions where
table_name='TEST';
BS_TS_REPORTS acct_one_prestore_201608 201608
BS_TS_REPORTS acct_one_prestore_201609 201609
BS_TS_REPORTS ACCT_ONE_PRESTORE_201201 201202
BS_TS_REPORTS ACCT_ONE_PRESTORE_201111 201112
发现成小写了,想到删了重建
alter table BS_TB_RPT_ACCT_ONE_PRESTORE truncate partition acct_one_prestore_201608
*
ERROR at line 1:
ORA-02149: Specified partition does not exist
TMD 一直报不存在,真是日了狗了
最后发现分区这货,不仅区分大小写,而且把引号也给加了进去。
alter table BS_TB_RPT_ACCT_ONE_PRESTORE drop partition "acct_one_prestore_201608";
Table altered.
终于修成正果。。。。。。。。