Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1690
  • Last Modified:

Non-Partitioned to Partition Table

Hello All,

Two questions :

1) Is there a way to convert a non-partitioned table
to a partitioned table

2) I have a table which has 8 million rows and its
growth rate is fast. Currently the size of data
in this table is around 12MB and its index is around
6MB. Is it advisable to partition this table. Will I
gain performance by partitioning.

Thanks in advance


0
freddymac
Asked:
freddymac
1 Solution
 
sunrock_inCommented:
No u can't change a Ordinary table to Partitioned table directly u have to follow some steps to change this table to Partitioned table.

A table can be partitioned, provided that:

It is not part of a cluster.

It does not contain LONG or LONG RAW datatypes.

the procedure to convert
1. Export this table.
2.Drop the table.
3.Recreate the table with partitions the sybtax for creating partitioned table is here with an example

CREATE TABLE sales
    ( invoice_no NUMBER,
      sale_year  INT NOT NULL,
      sale_month INT NOT NULL,
      sale_day   INT NOT NULL )
  PARTITION BY RANGE (sale_year, sale_month, sale_day)
    ( PARTITION sales_q1 VALUES LESS THAN (1997, 04, 01)
        TABLESPACE tsa,
      PARTITION sales_q2 VALUES LESS THAN (1997, 07, 01)
        TABLESPACE tsb,
      PARTITION sales_q3 VALUES LESS THAN (1997, 10, 01)
        TABLESPACE tsc,
      PARTITION sales_q4 VALUES LESS THAN (1998, 01, 01)
        TABLESPACE tsd );

4. Import the data to the new table

U can add partitions to ur table after creating the partitoned table in future by
Alter table add partition

U can merge two adjecent partitons if u want by
Alter Table Merge partition

U can also create index according to these partions
That is called partitioned indexing

Hope this will solve ur problem for more information on this post a new question.

Thanks
0
 
raid5Commented:
there is one other way in this can be carried out which is much easier and less time consuming. the syntax for that would be alter table...exchange partition.... you can find more details in the oracle8i administrator's guide. do let me know in case you need the entire syntax with an example.

as far as your second question is concerned, yes ....your table does seem to be a likely candidate for partitioning. however, we need to look at the table more carefully.
just one tip on that would be for you to ensure that you create local indexes for the partitions as well so as to improve performance.
0
 
freddymacAuthor Commented:
Sunrock in, your proposed answer was quite informative,
pls let me have some more feedback from others.

Raid5, I have tried exchange partition. I did not
work. Have you actually tried, if so pls let me know
the syntax.

0
 
MindphaserCommented:
Please update and finalize this old, open question. Please:

1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.

EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.

Thanks,

** Mindphaser - Community Support Moderator **

P.S.  Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
0
 
MindphaserCommented:
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now