A while ago I wrote something about data table compression. Now I feel it is a good way to compress the data and migrate it directly. Now there is a TABLE: www.2cto.com create table TABLE_1
(
MONTH_ID VARCHAR2 (10 ),
AREA_ID VARCHAR2 (10 ),
SERI NUMBER
)
Partition by range (MONTH_ID)
Subpartition by list (AREA_ID)
Subpartition template (
Subpartition subpart_290 values ('20170901 '),
Subpartition subpart_919 values ('20170901 '),
Subpartition subpart_917 values ('20170901 '),
Subpartition subpart_910 values ('20170901 '),
Subpartition subpart_913 values ('20140901 '),
Subpartition subpart_916 values ('20170901 '),
Subpartition subpart_915 values ('20140901 '),
Subpartition subpart_914 values ('20140901 '),
Subpartition subpart_911 values ('20140901 '),
Subpartition subpart_912 values ('20170901 '),
Subpartition subpart_default values (default)
)
(
PARTITION PART_1 values less than ('20140901 '),
PARTITION PART_2 values less than ('20140901 '),
PARTITION PART_3 values less than ('20140901 ')
) The data is as follows: You can now migrate the month_id of this TABLE to the users TABLESPACE: alter table table_1 move partition part_1 tablespace users; error, after checking on the internet, you should first remove the subpartition.
Alter table table_1 move subpartition part_partition subpart_290 tablespace users;
Alter table table_1 move subpartition part_partition subpart_910 tablespace users;
Alter table table_1 move subpartition part_partition subpart_911 tablespace users;
Alter table table_1 move subpartition part_partition subpart_912 tablespace users;
Alter table table_1 move subpartition part_partition subpart_913 tablespace users;
Alter table table_1 move subpartition part_partition subpart_914 tablespace users;
Alter table table_1 move subpartition part_partition subpart_915 tablespace users;
Alter table table_1 move subpartition part_partition subpart_916 tablespace users;
Alter table table_1 move subpartition part_partition subpart_917 tablespace users;
Alter table table_1 move subpartition part_partition subpart_919 tablespace users;
Then execute the following: alter table table_1 modify default attributes for partition part_1
Tablespace users; this is the result: the partition is now transferred to users. What will happen if there are no subpartitions? Re-create this TABLE. Do not subpartition this time, just PARTITION by month_id, and then execute the transfer statement: alter table table_1 move partition part_1 tablespace users; directly succeeded. This shows that when transferring a partitioned table with sub-partitions, the table should be transferred from the lowest level of sub-partitions and then to the upper level of partitions. Www.2cto.com
Then, COMPRESS the part_1 statement of the TABLE above. The statement is as follows: alter table table_1 move partition part_1 COMPRESS. The result is as follows: Create a TABLE with sub-partitions and execute the statement just now: the same problem occurs again. That is to say, we have to compress the sub-partitions first. But today I see a better statement: ALTER TABLE table_1 MODIFY PARTITION part_1 COMPRESS; after execution, the result will be: That's all. I forgot to write the statement when creating table partitions today. This is not correct. Here we record: CREATE TABLESPACE data_warehouse
DATAFILE 'd: \ app \ user \ oradata \ PC1 \ STORAGE2.DBF'
SIZE 50 m autoextend on next 50 M
MAXSIZE 2048 M; change the USER's default tablespace to the created TABLESPACE: alter user wings default tablespace data_warehouse;