To move table spaces for partitioned tables and partitioned indexes

Source: Internet
Author: User
Move table space of partitioned table 1) non-grouped partition table
ALTER TABLE RPT_F_STATION_DP move PARTITION sys_p3742 tablespace reportdata;

2) combined partition table:
(1) First move the child partition to another table space:
ALTER TABLE RPT_F_CABECF move subpartition sys_subp8842 tablespace reportdata;

(2) Subpartition has moved away, leaving the father of the subpartition, it does not need move, change the properties of the partition can be.
ALTER TABLE rpt_f_cabecf MODIFY DEFAULT ATTRIBUTES for PARTITION partition_660 tablespace;

Note:
The following error occurs if the direct move contains a partition with a child partition
Ora-14257:cannot move partition The other than a Range or Hash partition

Table space of index on mobile partition table 1) non-partition index
ALTER INDEX pk_rpt_f_nofinish_worksheet REBUILD tablespace reportdata;

2 index without sub-partition
ALTER INDEX idx_rpt_f_station_dp_1 REBUILD PARTITION sys_p3721 tablespace reportdata;

3) sub-partition Index ALTER index idx_rpt_f_cabecf_1 REBUILD subpartition sys_subp8842 tablespace reportdata;
Automatically generate the required scripts
SELECT ' ALTER TABLE '
|| table_name
|| ' Move PARTITION '
|| Partition_name
|| ' Tablespace reportdata; '
From User_tab_partitions
WHERE subpartition_count = 0 and Tablespace_name = ' rmgz '; --Non-grouped partition table

SELECT ' ALTER TABLE '
|| table_name
|| ' Move Subpartition '
|| Subpartition_name
|| ' Tablespace reportdata; '
From User_tab_subpartitions
WHERE subpartition_count > 0 and tablespace_name = ' rmgz '; --Move sub partition SELECT ' ALTER TABLE '
|| table_name
|| ' MODIFY DEFAULT ATTRIBUTES for PARTITION '
|| Partition_name
|| ' Tablespace reportdata; '
From User_tab_partitions
WHERE subpartition_count > 0 and tablespace_name = ' rmgz ';--modifying parent partition Properties

SELECT ' ALTER INDEX ' | | index_name | | ' REBUILD tablespace reportdata; '
From User_indexes
WHERE tablespace_name= ' Rmgz ';


SELECT ' ALTER INDEX '
|| Index_name
|| ' REBUILD PARTITION '
|| Partition_name
|| ' Tablespace reportdata; '
From User_ind_partitions
where Subpartition_count = 0
and Tablespace_name= ' Rmgz '; --Index with no sub partition

SELECT ' ALTER INDEX '
|| Index_name
|| ' REBUILD subpartition '
|| Subpartition_name
|| ' Tablespace reportdata; '
From User_ind_subpartitions
where tablespace_name= ' Rmgz '; --sub-partition index

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.