Pages

Tuesday, September 6, 2011

"ORA-01652: unable to extend temp segment by 128 in tablespace TEMP" encountered while creating new table using Create Table As Select (CTAS)



Recently, in a SQA database I noticed something... CTAS was using TEMPORARY Tablespace!

In SQA, we have 4 copies of the same database, we call them 'Regions' - namely I,P,Q,R. Each region is used for a different testing stage. In region R, the SQA was testing on a Housekeeping Solution on a large table (85 GB) to purge 6 months data. Something went wrong, and they requested us to get a copy from another Region (Q) where this release was not tested.

It was decided to use the option of CTAS, rather than export/import due to storage space constraints. This was to be done using DB Link to the Q Region's Database. When the command was executed, we ran into
ORA-01652: unable to extend temp segment by 128 in tablespace TEMP. 

12:25:35 SQL> create table GECT
12:25:35   2  TABLESPACE TS_GECT
12:25:35   3  PCTUSED    0
12:25:35   4  PCTFREE    10
12:25:35   5  INITRANS   10
12:25:35   6  MAXTRANS   255
12:25:35   7  STORAGE    (
12:25:35   8              INITIAL          100M
12:25:35   9              NEXT             100M
12:25:35  10              MINEXTENTS       1
12:25:35  11              MAXEXTENTS       UNLIMITED
12:25:35  12              PCTINCREASE      0
12:25:35  13              BUFFER_POOL      DEFAULT
12:25:35  14             )
12:25:35  15  NOLOGGING
12:25:35  16  PARALLEL
12:25:35  17  AS
12:25:35  18  (SELECT * FROM FNSONLP.GECT@GECT_LINK);
create table GECT
*
ERROR at line 1:
ORA-12801: error signaled in parallel query server
ORA-01652: unable to extend temp segment by 128 in tablespace TEMP

It didn't make any sense! CTAS should not use TEMPORARY Tablespace unless some sort was to be performed.
I did a little digging on Blogs and MOS, but the best I could find was:

But the document or blogs only speaks about ORA-1652 on the "data tablespace", not the "temporary tablespace."

Solution: 
I removed the clause "PARALLEL" from my CTAS statement. As soon as I did that, the target tablespace started filling up, and my CTAS was successful.


No comments:

Post a Comment