Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8616533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:38:36+00:00 2026-06-12T05:38:36+00:00

for some reason when I’m trying to CTAS (create table as select) on a

  • 0

for some reason when I’m trying to CTAS (create table as select) on a large table (40million~ records ) I see in the v$session 18 active sessions with my sql statement.

when i’m trying to hint the optimizer to use less CPUs

create table table_name parallel (degree 2) as 
       select * from large_table;

I see 6 active sessions.

with degree 3 I see 8 active sessions.
I tryed degree default but it created 18 sessions as well.

previously in the code , before executing the CREATE TABLE statement I changed few attributes in my session :

alter session set workarea_size_policy = manual;
alter session set hash_area_size = 1048576000;

I want to create the table in 1 session , how to I do it ?

Thanks !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:38:37+00:00Added an answer on June 12, 2026 at 5:38 am

    Use the
    NO_PARALLEL hint
    in the select clause of the CTAS statement.
    See also Note on Parallel Hints

    create table t as
    select /*+ NO_PARALLEL */ * 
    from large_table;
    

    Investigation & testing:

    SQL*Plus version and Oracle Database version:

    SQL*Plus: Release 11.1.0.6.0 - Production on Fri Sep 21 11:56:58 2012
    
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Testing options
    

    I used two different sqlplus processes to connect to the same database via different service names. One running copy of sqlplus will be used to perform the CTAS. The other copy of sqlplus will be used to to query the number of sessions.

    The query to get session count and results prior to anything else:

    SQL> select service_name, count(*)
      2  from v$session
      3  where username = 'ME'
      4  group by service_name
      5  order by service_name;
    
    SERVICE_NAME                                                       COUNT(*)
    ---------------------------------------------------------------- ----------
    aaaaaa2                                                                   1
    aaaaaa3                                                                   1
    

    Creating large_table:

    SQL> create table LAO as select * from all_objects;
    
    Table created.
    
    SQL> exec dbms_stats.gather_table_stats(user, 'LAO');
    
    PL/SQL procedure successfully completed.
    
    SQL> create table large_table parallel 4 as
      2  select N.N, LAO.*
      3  from LAO
      4  cross join (select level as N from dual connect by level <= 400) N
      5  /
    
    Table created.
    
    SQL> select to_char(count(*), 'fm999,999,999')
      2  from large_table;
    
    TO_CHAR(COUN
    ------------
    42,695,200
    

    Since large_table was created with parallel 4, a simple CTAS defaults to 4 worker processes, CTAS:

    create table t as
    select * from large_table;
    

    Sessions:

    SERVICE_NAME                                                       COUNT(*)
    ---------------------------------------------------------------- ----------
    aaaaaa2                                                                   5
    aaaaaa3                                                                   1
    

    Now, the noparallel table option. (Creating a table that by default won’t have parallel plans for DML, but the parallelism of large_table causes the CTAS to run in parallel.)

    drop table t;
    create table t noparallel as
    select * from large_table;
    

    Sessions (SYS$BACKGROUND showed up towards the end of the last query, then just stuck around. I believe it dies if not needed in a certain amount of time.):

    SERVICE_NAME                                                       COUNT(*)
    ---------------------------------------------------------------- ----------
    SYS$BACKGROUND                                                            1
    aaaaaa2                                                                   5
    aaaaaa3                                                                   1
    

    The NO_PARALLEL hint in the select clause does work:

    drop table t;
    create table t as
    select /*+ NO_PARALLEL */ * from large_table;
    

    Sessions:

    SERVICE_NAME                                                       COUNT(*)
    ---------------------------------------------------------------- ----------
    SYS$BACKGROUND                                                            1
    aaaaaa2                                                                   1
    aaaaaa3                                                                   1
    

    One last CTAS, where a table is created that will use multiple processes by default, but will not during the CTAS:

    drop table t;
    create table t parallel 4 as
    select /*+ NO_PARALLEL */ * from large_table;
    

    Sessions:

    SERVICE_NAME                                                       COUNT(*)
    ---------------------------------------------------------------- ----------
    SYS$BACKGROUND                                                            1
    aaaaaa2                                                                   1
    aaaaaa3                                                                   1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, when I create my project, the .project file is missing. Which
For some reason, exceptions thrown in an __autoload function aren't being caught when trying
For some reason I never see this done. Is there a reason why not?
For some reason when I create a new namespace in Visual Studio 2008 its
For some reason, I stored an input field as serialized data into a table
For some reason this is giving me an error? $result = mysql_query(SELECT wpjb_job.*, wpjb_category.*
For some reason, this line of code is returning undefined for $(this).attr(href) $(a).attr(href, javascript:page('
for some reason when I try to call CocoaAsyncSocket's onSocket:didReadData:withTag method, it's failing and
For some reason I can't detect I can't set a z index for any
For some reason there's a variable called d that is defined immediately after I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.