简体   繁体   English

如何对从另一个架构复制的表进行分区?

[英]How to partition a table copied from another schema?

I want to copy a table from one schema into another. 我想将表从一种模式复制到另一种。 Then I want to partition the table. 然后我要对表进行分区。 How do I partition a table that I've copied from another schema? 如何对从其他架构复制的表进行分区?

From what I understand about partitioning, this should work, but I keep getting the missing left parenthesis error - which means probably that the syntax is incorrect? 据我对分区的了解,这应该可以工作,但是我不断收到丢失的左括号错误-这可能意味着语法不正确?

DROP TABLE SS_CUSTOMER;
CREATE TABLE SS_Customer AS SELECT * FROM WL.CUSTOMER
 PARTITION BY HASH(CUST_ID),
   PARTITIONS 4 
   STORE IN (USERS, USERS, CUSTOMER, CUSTOMER);

I believe your only option is to do this in multiple steps. 我相信您唯一的选择是分多个步骤进行。 First, create the partitioned table. 首先,创建分区表。 Then, run an INSERT statement that selects data from the source table. 然后,运行INSERT语句,该语句从源表中选择数据。 I don't believe it is possible to do a CREATE TABLE AS SELECT that creates a partitioned table. 我不认为可以创建创建分区表的CREATE TABLE AS SELECT

As an aside, I can't believe that your partition names are correct. 顺便说一句,我不敢相信您的分区名称是正确的。 If you're going to name your hash partitions, you'd have to use different names-- creating two partitions named USERS and two named CUSTOMER is not going to work. 如果要命名哈希分区,则必须使用不同的名称-创建两个名为USERS分区和两个名为CUSTOMER分区是行不通的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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