Introduction: – In this post covers ORA-1652: unable to extend temp segment by 128 in tablespace TEMP error. Generally, we are facing this ora error while running sql query or concurrent program in our Instance.
How to resolve ORA-1652 unable to extend temp segment.
To check temporary tablespace used and free space.
Basically, we can check how much temp segment can be used by viewing the total_blocks and used_blocks.
SQL> select inst_id, tablespace_name, total_blocks, used_blocks, free_blocks from gv$sort_segment;
Similarly, we can check temp segment by per sql statement.
SELECT S.sid || ‘,’ || S.serial# sid_serial, S.username, Q.hash_value, Q.sql_text, T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace FROM v$sort_usage T, v$session S, v$sqlarea Q, dba_tablespaces TBS WHERE T.session_addr = S.saddr
AND T.sqladdr = Q.address AND T.tablespace = TBS.tablespace_name ORDER BY mb_used;
How to check tempfile.
SQL> select file_name,tablespace_name from dba_temp_files;
Steps to Increase the temporary tablespace size.
1. Add tempfile in existing temp tablespace space.
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE ‘/data01/GSTUAT3/redotempfiles/temp02.dbf’ SIZE 2G;
2. Resize the existing tempfile.
SQL>ALTER DATABASE TEMPFILE ‘/data01/GSTUAT3/redotempfiles/temp01.dbf’ RESIZE 5G;
To check how much temp space using by particular program/module.
SELECT S.sid || ‘,’ || S.serial# sid_serial, S.username, S.osuser, P.spid, S.MODULE,SUBSTR(u.sql_text, 1, 50) as sql_text,
P.program, SUM (T.blocks) * TBS.block_size / 1024 / 1024 mb_used, T.TABLESPACE FROM v$sort_usage T, v$session S, dba_tablespaces TBS, v$process P,v$sqlarea u WHERE T.session_addr = S.saddr
AND S.paddr = P.addr AND T.TABLESPACE = TBS.tablespace_name AND S.sql_id = u.sql_id
GROUP BY S.sid, S.serial#, S.username, S.osuser, P.spid, S.MODULE,u.sql_text, P.program, TBS.block_size, T.TABLESPACE
having SUM (T.blocks) * TBS.block_size / 1024 / 1024 > 1
ORDER BY mb_used;
Output:-
SID_SERIAL USERNAME OSUSER SPID MODULE SQL_TEXT PROGRAM MB_USED TABLESPACE
———- ———- ———- —— ————— ————————- ———————– ———- ———-
1952,8877 APPS applmgr 13120 e:JA:fwk:fnd.cp SELECT * FROM (select req [email protected] 2 TEMP3
.viewreq.server uest_id, program, reques anes.com
.DummyAM
1672,2229 APPS applmgr 2811 fnd.framework.n BEGIN :1:=FND_GLOBAL.USE [email protected] 2 TEMP3
avigate.server. R_ID; :2:=FND_GLOBAL.RES anes.com
OANavigatePortl
:R
Wow! this is Amazing! Do you know your hidden name meaning ? Click here to find your hidden name meaning