Solved

Oracle

Posted on 2013-11-23
9
329 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
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: 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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
passing parameters to sql script oracle 4 62
sort a spool into file output in oracle 1 46
Oracle SQL - Query help 7 68
oracle forms question 22 42
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many‚Ķ
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 take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

820 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