What is the best way to insert 6000000 records from one table to another table in ORACLE?

Saul Da Silva

Hello guys i need to copy 6000000 rows from TMP_DATA to DATA what is the best way to do this?

I was thinking of doing INSERT INTO DATA SELECT * FROM TMP_DATA. But i think it will take ages to do the insert.

What do you suggest?

Kind Regards,

Mark Stewart

To expand a bit on Anders' answer and mathguy's comments, do the following:

alter table data nologging;
alter session enable parallel dml;
-- disable any triggers on `data` and temporarily drop any indexes

insert /*+ append */ * into data 
select /*+ parallel (4) */ * from tmp_data
--sample (10)  -- if tmp_data has 60 million rows: 10 means 10%
-- where rownum < 6000001 
-- pick one of the two prior clauses if tmp_table has > 6 million rows

after the insert is done:

alter table data nologging;  
-- enable triggers and recreate indexes

and have the dba do a backup as the data table will not be able to be recovered if there was any issue after the load.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Insert records into one table using key from another table

Insert records from one table to another and then delete inserted records

Insert record from one table to another table - Oracle

How to loop over records and then search into another table and if not found then insert it after fetching records from another table in oracle?

PSQL query to insert the records from one table to another based on condition

What is an efficient way to create records in one table that first rely on outputs from another?

best way to select data from one table or another

How to insert random values from one table to another (oracle sql)?

MySQL: Is there a way to insert values from one table to another?

What is the best way for selecting 2 row from table in one row?

Oracle Procedure to insert all records from one staging table into main table

Extract one column from sql table and insert into another table as multiple records coupled with different values

How to insert multiple records from one table into another on update of third table in MySQL

How to insert the selected data columns from one oracle database table into another oracle database table in real time

Select from one table if no records found in another

Randomly Assign Records From One Table to Another

How to do INSERT into a table records extracted from another table

How to insert into a table new records based on info from another table?

How insert records into a table from another table with conditions

Oracle trigger change value of column/row from one table during insert of another table

insert into table from two another tables - oracle

Select from a table based on another table Number of records Oracle

Is there a way to insert record from another table

How Insert Many Records In One ExecuteNonQuery Oracle Table by C#

Insert one table into another

After inserted selected fields from one table to another, how to insert/update new records?

Insert records from one table to another with and user data..SQL server

Insert records from one table to another without violating any constraint in SQL Server database

Insert Data From One Table To Another - MySQL