Skip to Main Content
  • Questions
  • how to insert millions of records may be more in partitions.

Breadcrumb

Dev Live Dev Intro

This month we are celebrating Developers at AskTOM. We welcome Developers of all levels of experience to join us at our FREE Developer Live events coming in August. Just click on the left to register today! If you are brand new to Database Technology, then we also have got you covered. Just click on the right for your comprehensive FREE training program to kick start your Oracle Database Development journey!

Question and Answer

Connor McDonald

Thanks for the question, Pinky.

Asked: January 10, 2020 - 9:29 pm UTC

Answered by: Connor McDonald - Last updated: January 13, 2020 - 4:03 am UTC

Category: Database Administration - Version: 12.1.0.2

Viewed 1000+ times

You Asked

how to insert millions of records may be more in partitions.

select partition_name, compression, num_rows / nullif(blocks,0) rows_per_blk
from dba_tab_partitions
where table_name = 'SALES_P'
order by partition_position; 2 3 4

PARTITION_NAME COMPRESSIO ROWS_PER_BLK
-------------------- ---------- ------------
SALES_P_JAN ENABLED
SALES_P_FEB ENABLED
SALES_P_MAR ENABLED
SALES_P_DEC ENABLED


This is my table (sales_p) with 4 partitions , i need to insert millions of rows in each one
please send me any sql code to do to so.

and we said...

Am I missing something obvious here? Isn't this just


insert into sales_p partition ( SALES_P_JAN  )
select ...

insert into sales_p partition ( SALES_P_FEB )
select ...

insert into sales_p partition ( SALES_P_MAR )
select ...

insert into sales_p partition ( SALES_P_DEC )
select ...


and you rated our response

  (1 rating)

Is this answer out of date? If it is, please let us know via a Review

Reviews

On Exchange partitions

January 13, 2020 - 7:29 am UTC

Reviewer: Rajeshwaran, Jeyabal

....
insert into sales_p partition ( SALES_P_JAN )
select ...
....


If the result set to be loaded in a partition - exists completely in another table - then Exchange partition would be a way to go then the above insert statements, (just swapping the extents between the segments)

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database