create table t1 ( id number, prov varchar2(10), name varchar2(10) ) partition by list (prov,name) ( partition p1 values(('HU','hubei'),('BJ','beijing')), partition p2 values(('SH','shanghai')), partition pdefault values (DEFAULT) );
insert into t1 values(1,'HU','hubei'); insert into t1 values(2,'BJ','beijing'); insert into t1 values(3,'SH','shanghai'); insert into t1 values(4,'ZJ','zhejiang'); commit;
exec dbms_stats.gather_table_stats(user,'T1');
查看分区表数据的分区情况
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
column table_name format a20 column partition_name format a20 column high_value format a40
select table_name, partition_name, high_value from user_tab_partitions where table_name = 'T1' order by 1, 2;
create table t1 ( id number, prov varchar2(10), name varchar2(10) ) partition by list (prov,name) AUTOMATIC >>>>==== ( partition p1 values(('HU','hubei'),('BJ','beijing')), partition p2 values(('SH','shanghai')) );
insert into t1 values(1,'HU','hubei'); insert into t1 values(2,'BJ','beijing'); insert into t1 values(3,'SH','shanghai'); insert into t1 values(4,'ZJ','zhejiang'); commit;
exec dbms_stats.gather_table_stats(user,'T1');
查看不在分区条件范围内的zhejiang 数据
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
column table_name format a20 column partition_name format a20 column high_value format a40
select table_name, partition_name, high_value from user_tab_partitions where table_name = 'T1' order by 1, 2;