Move an Oracle Partition Table

Source: Internet
Author: User

Move an Oracle Partition Table

Moving a partition table is worth further consideration. If the partition table contains the lob field, the difficulty is increased.
For normal tables, the move operation room is a matter of course, and Oracle provides a very direct and fast way. Of course, this command is not highly available. However, data restructuring is very convenient and quick.

In general, if you try to move a partition table, the following error warning is returned.
SQL> alter table charge move tablespace large_data;
Alter table charge move tablespace large_data
*
ERROR at line 1:
ORA-14511: cannot perform operation on a partitioned object

 
In this case, you can use the following SQL statement to generate a dynamic SQL statement for the partition-level move operation.
For example, for the following three large tables, the following SQL statement can generate hundreds of thousands of statements to complete the partition-level move operation.

Select 'alter table' | table_name | 'move partition' | partition_name | 'tablespace large_data; 'from user_tab_partitions where table_name in ('charge', 'memo ', 'charge _ REL ')

If the table contains the lob field, the following problems may occur:

Alter table memo move partition xxxx tablespace large_data;

*
ERROR at line 1:
ORA-01658: unable to create INITIAL extent for segment in tablespace DATAS01

This problem is generally caused by one of the following reasons: Check whether the table space contains sufficient quota.
One is to check whether there is sufficient space for the storage of the tablespace.
If space is limited and some partitions do not have data, you can enable delayed loading. Enable deferred_segment

Expdp/impdp
Using the data pump is a good choice. You can easily dump data structures everywhere, and then directly perform remap_tablespace during import, this function is beyond the reach of exp/imp.
We recommend that you use the remap function of impdp.

Perl/shell
Of course, you can use exp + imp + shell/perl to parse dump files.
You can refer to the following blog posts.

This section details how to parse the dump file.

Dbms_metadata.get_ddl
If the source shema can be accessed at any time, you can directly generate the corresponding creation statement using dbms_metadata when the conditions permit. On this basis, you can perform manual mapping of the tablespace.
This process seems simple, but there are still a lot of details to consider. There are too many partitions, and it is easy to exceed the maximum length. You need to control them by yourself.


Exchange partition
This method may be highly risky, but in some cases it is also a solution that can remap tablespaces in the form of exchange partition.
Use a common table to exchange data with partitions.

However, the above methods are not suitable for high availability, but the downtime also needs to be considered, and the operation time needs to be minimized. After all, in the partitioned table environment, the data is huge, which requires consideration. Table space changes are intended, but data restructuring involves data export, import, and other work. It is easy to understand, but there are too many details, so pay more attention to it.

Introduction to range partitions of Oracle partition tables

Oracle Partition Table migration

Oracle Partition Table instance

Create and manage Oracle Partition tables

Related Article

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.