Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Oracle

Posted on 2013-11-23
9
Medium Priority
?
334 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

650 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