[英]How to create partitioned table based on one Integer column (each value = 1 partition) in Oracle 12c?
There is a non-partitioned table in Oracle 12c, call it 't1' with 10M records that has 3 columns (a,b,c). Oracle 12c 中有一个未分区的表,将其称为“t1”,其中包含 10M 条记录,其中包含 3 列 (a,b,c)。
Column 'a' has 100 distinct integer values.列 'a' 有 100 个不同的整数值。
How to create a second table 't2' that has all the values from 't1' but is partitioned based on column 'a' so that each partition correspond to one distinct value in column 'a'?如何创建第二个表 't2',其中包含来自 't1' 的所有值但基于列 'a' 进行分区,以便每个分区对应于列 'a' 中的一个不同值? (there should be 100 partitions created).
(应该创建 100 个分区)。
Thanks!谢谢!
Create a automatic list partition while creating table t2 and later insert records from table t1 which will create a new partition for each distinct value in the mentioned column 'a'.创建表 t2 时创建一个自动列表分区,稍后从表 t1 插入记录,这将为提到的列 'a' 中的每个不同值创建一个新分区。
Note : While creating automatic list partition you need to specify atleast one partition.注意:创建自动列表分区时,您需要至少指定一个分区。
eg :- CREATE TABLE t2 ( a number,b varchar2(200),c varchar2(200) ) PARTITION BY LIST (a) AUTOMATIC ( PARTITION P_10 VALUES (10) );例如:- CREATE TABLE t2 (a number,b varchar2(200),c varchar2(200)) PARTITION BY LIST (a) AUTOMATIC (PARTITION P_10 VALUES (10) );
insert into t2 select * from t1;插入 t2 select * from t1;
This insert will create partitions automatically for each distinct value.此插入将为每个不同的值自动创建分区。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.