0

I have a very large table AUD$ that I want to copy it to another empty one with the same structure AUD_BACKUP.

INSERT INTO TEST_USER.AUD_BACKUP 
    SELECT * FROM SYS.AUD$;
COMMIT;

How do I use parallel for INSERT as well as for SELECT ? I can afford to run in 100 parallels. I am on Oracle db 12.2.

1
  • 1
    insert /*+ parallel (100) */ ...?
    – user1822
    Oct 27, 2020 at 10:08

2 Answers 2

-1

You should use direct path INSERT.

For select you can use PARALLEL hint in the same statement. you may use PARALLEL without any parameter or use PARALLEL(n) with n number of thread.

Let me know if you need more explanation on this.

-3

Explanation

I will try to show you an example as MySql because i didn't found an online complier that could help me to run Oracle quary.

Code Section

Create two tables

-- table 1
CREATE TABLE table1(
    int id integer,
    title varchar(100)
);
-- table 1 backup
CREATE TABLE backup_table1(
    int id integer,
    title varchar(100)
);

Insertion

-- insert data into table1
INSERT INTO table1 (id, title)
VALUES (1, "hello world!");
-- table1_backup
INSERT INTO backup_table1 (id, title)
SELECT id, title FROM table1;

OUTPUT

SELECT * FROM backup_table1;

id     title
1      hello world!

REFERENCE

SQL INSERT INTO SELECT Statement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.