Oracle Partition Table exchange principles

Source: Internet
Author: User

Oracle Partition Table exchange principle oracle partition exchange operation is very fast, then what is the principle? Let's create an experiment:

SQL> create table test (id number (3); the table has been created. SQL> insert into test values (1); 1 row has been created. SQL> commit; submitted completely. SQL> select object_id, data_object_id from user_objects s where s. object_name = 'test'; OBJECT_ID DATA_OBJECT_ID ---------- -------------- 180148 180148SQL> create table test_part (id number (3) partition by range (id) 2 (partition p1 values less than (10 ), 3 partition p2 values less than (20); the table has been created. SQL> col object_name format a20SQL> col subobject_name format a20SQL> select object_name, s. subobject_name, object_id, data_object_id 2 from user_objects s 3 where s. object_name = 'test _ part'; OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID contains bytes ---------- -------------- TEST_PART P1 180150 180150TEST_PART P2 180151 180151TEST_PART 180149SQL> select * from TEST; ID ---------- 1SQL> select * from test_part; unselected row SQL> alter table test_part exchange partition p1 with table test; the table has been changed. SQL> select * from test; select * from test_part; ID ---------- 1SQL> select * from test_part partition (p1); ID ---------- 1SQL> select object_id, data_object_id from user_objects s where s. object_name = 'test'; OBJECT_ID DATA_OBJECT_ID ---------- -------------- 180148 180150SQL> select object_name, s. subobject_name, object_id, data_object_id 2 from user_objects s 3 where s. object_name = 'test _ part'; OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID -------------------- ------------------ -------------- TEST_PART P1 180150 180148TEST_PART P2 180151 180151TEST_PART 180149

 

Exchange only modifies the partition and table structure in the oracle Data dictionary. Data has not been modified, so the speed is fast. In more detail, we only exchanged the data_object_id corresponding to different object_ids, but the segment itself has not changed and has nothing to do with the physical storage location. However, it must be between a partition table and a non-partition table.

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.