unable to extend temp segment by 128 in tablespace TEMP

Greetings, experts!

I was given a query that's running out of space in the TEMP tablespace. (see error-message below) As a quick solution to get the user back up and running, I simply added a TEMPFILE to the tablespace. (see alter statement below)  But, when I ran the query again, it still ran out of space. I can see from querying dba_temp_files that the tablespace is pretty big, and it does contain both datafiles, but I thought the MAXSIZE UNLIMITED clause would have solved my problem by not allowing the new datafile to run out of space.

Besides rewriting the query, what would you recommend?

Thanks!
DaveSlash

SQL Error: ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
01652. 00000 -  "unable to extend temp segment by %s in tablespace %s"
*Cause:    Failed to allocate an extent of the required number of blocks for
           a temporary segment in the tablespace indicated.
*Action:   Use ALTER TABLESPACE ADD DATAFILE statement to add one or more
           files to the tablespace indicated.

ALTER TABLESPACE temp
  ADD TEMPFILE '+DATAC1/cop3/tempfile/temp01.dbf' SIZE 10g
  AUTOEXTEND ON
  NEXT 1g
  MAXSIZE UNLIMITED;

Open in new window


SQL> SELECT substr(tablespace_name,1,4) as tbls,
  2         substr(file_name,1,40) as file_name,
  3         bytes/1000000000 as gigabytes
  4    FROM dba_temp_files
  5   WHERE tablespace_name = 'TEMP'
  6  ;

TBLS FILE_NAME                                 GIGABYTES
---- ---------------------------------------- ----------
TEMP +DATAC1/cop3/tempfile/temp.771.915115045 21.4748365
TEMP +DATAC1/cop3/tempfile/temp01.dbf          34.359722

Open in new window

LVL 18
Dave FordSoftware Developer / Database AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave FordSoftware Developer / Database AdministratorAuthor Commented:
I spent some time to optimize the query. Fortunately, it now returns its results quickly, and it uses FAR less TEMP space. Problem solved.

Thanks!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slightwv (䄆 Netminder) Commented:
>> by not allowing the new datafile to run out of space.

Unless you fill up the actual disk.  I'm not an ASM person so I cannot help with the commands to figure out the volumes free space.

>>Besides rewriting the query, what would you recommend?

If you can't free up more disk space and can't rewrite the query your options seem limited.  You might look at materialized views to remove some of the run time  data collection.  In theory that should make the query run faster?

Can I inquire to why the query cannot be tweaked so it might run with what you have?
0
slightwv (䄆 Netminder) Commented:
>>Problem solved.

Guess it could be tweaked after all!
0
Dave FordSoftware Developer / Database AdministratorAuthor Commented:
I spent some time optimizing the query, and it now behaves appropriately.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.