Solved

Oracle

Posted on 2013-11-23
9
325 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
  • 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 300 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 200 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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

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…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now