?
Solved

Oracle

Posted on 2013-11-23
9
Medium Priority
?
333 Views
Last Modified: 2013-11-25
Hi,

I want to change the existing table LIST partition to LIST-LIST partition without disturbing the existing data.

Ex. I have
table table1(A varchar2(10), B varchar2(10))
partition by list(A)
( partition data_x values('x'),
  partition data_y values('y')
);

Now I would like to alter the table like below

table table1(A varchar2(10), B varchar2(10))
partition by list(A)
subpartition by list(B)
( partition data_x values('x')
  (subpartition data_x_10 values('10')
   subpartition data_x_20 values('20')
  ),
 partition data_y values('y')
  ( subpartition data_y_10 values('10')
    subpartition data_y_20 values('20')
   )
);

Can you please let me know if this is possible. I mean without dropping the table can I add subpartition? If possible can you please suggest how can I do this?

Also I need to rebuild the index which is existing on the existing list partition as am adding subpartions to it.

Thank you.
0
Comment
Question by:GouthamAnand
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 

Author Comment

by:GouthamAnand
ID: 39672284
And also currently index exists on the List partition
like
CREATE INDEX table1_IDX1 ON table1 (A)
LOCAL (  
  partition data_x,
  partition data_y
)
 
I need to rebuild the index on the newly created list-list partition.
Can you also please suggest how can i rebuild the index also?

Thanks.
0
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 1200 total points
ID: 39673562
It is possible by using the DBMS_REDEFINITION package.

Checkout this article: Zero Downtime Technique to Rebuild Oracle Tables
0
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 800 total points
ID: 39673890
The composite partioning list within list has a different syntax as posted below...

CREATE TABLE composite_list_list (
cust_id     NUMBER(10),
cust_name   VARCHAR2(25),
cust_state  VARCHAR2(2),
time_id     DATE)
PARTITION BY LIST(cust_state)
SUBPARTITION BY LIST (cust_id)
SUBPARTITION TEMPLATE(
SUBPARTITION beg VALUES (1,3,5) TABLESPACE part1,
SUBPARTITION mid VALUES (2,4,6) TABLESPACE part2,
SUBPARTITION end VALUES (7,8,9,0) TABLESPACE part3) (
PARTITION west VALUES ('OR', 'WA'),
PARTITION east VALUES ('NY', 'CT'),
PARTITION cent VALUES ('IL', 'MN'));

Refer to this link for more information : http://psoug.org/reference/partitions.html

first create the new table with the list-list partioning and then insert your data from the existing table into this new table. Once this is done, you can then create indexes/rename etc.

try it out in your dev/test database as i have not tested this approach.

Thanks,
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:GouthamAnand
ID: 39674196
Hi Thank you. I could create a new table with the given syntax ie using (Template syntax).
 
Comparing with your example, currently I have partition like
CREATE INDEX composite_list_list_IDX1 ON composite_list_list (cust_state)
LOCAL (  
  partition west ,
  partition east,
  partition cent)

How this Index creation syntax will get changed when subpartitions also exists.
Do i need to mention the subpartions also for faster execution of the queries.

Can you please suggest?

Thanks.
0
 

Author Comment

by:GouthamAnand
ID: 39674214
I mean I have one b-tree index on cust_state and bitmap index on cust_id currenlty. so I can create the same way after the creation of new table(with subpartions) by mentioning only the patitions and not mentioning the subpartitions?

Thanks.
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 39674233
hi,

I have not used subpartitions in the indexe creations so far - so i cannot comment on this. May be you can await other experts comments. But you can proceed to test your local index with partitions as mentioned in that example for testing right.

Regarding the performance, i would only say the best is to set them up and test it out.

Thanks,
0
 

Author Comment

by:GouthamAnand
ID: 39674370
Ok. Regarding  inserting my data from the existing table into this new table,
my existing table is of having 9 gb data(500,00,000 records). Am currenlty copying like

insert into T1 select * from T2.

But this is taking more time. Is there any better (faster)way to copy from existing table to new table?

Thank you.
0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 39674772
Read the article from the link I posted...
0
 

Author Closing Comment

by:GouthamAnand
ID: 39676686
Thank you for all your help. I could copy the table very quickly with DBMS_REDEFINITION package. Thanks a lot for the information.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question