简体   繁体   中英

Copy partition definitions from one table to another

I have a table USERS with columns USER_ID and NAME, that is partitioned on the USER_ID column.

Say, I want to create another table USER_PHN with columns USER_ID and PHN_NO. This table should have the same partitions on USER_ID as in the USERS table. Is it possible to copy partition definitions from the original table into the new table?

If users and user_phn have a referential constraint, you can use reference partitioning, if you happen to be using Oracle 11g. See Oracle® Database VLDB and Partitioning Guide 11g Release 1 (11.1) for docu.

One of the advantages here is that you have less redundant data because to partitioning key does not need a copy in the child rows. That is already defined in the FK relation.

The child table inherits the partitioning definitions from the parent table.

考虑在过程中编写USERS表脚本,在DDL中找到分区部分,然后用USER_PHN替换表名,然后执行它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM