Welcome to the Oracle community forum and interact with the 2 million technical staff. Normally, after you complete the Select statement, createindex, and other sorting operations using TEMP tablespace, oracle Automatically releases temporary segment. However, if some temporary segments are not released, the TEMP tablespace is almost full, or even we restart the system.
Welcome to the Oracle community forum and interact with 2 million technical staff> normally, after you complete the Select statement, create index, and other sorting operations using TEMP tablespace, oracle Automatically releases temporary segment. However, if some temporary segments are not released, the TEMP tablespace is almost full, or even we restart the system.
Welcome to the Oracle community forum and interact with 2 million technical staff> enter
Normally, after the Select statement, create index, and other sorting operations using the TEMP tablespace are completed, Oracle Automatically releases the temporary segment. However, if some temporary segments are not released, the TEMP tablespace is almost full, and even the database is restarted, the problem remains unsolved. This question is also frequently asked by netizens in the forum. I will summarize it and provide several solutions.
Method 1: restart the database
When the database is restarted, the Smon process will release the temporary segment and clean up the TEMP tablespace. However, in many cases, our database cannot be down, therefore, this method lacks some application opportunities, but it is still very useful.
Method 2: Metalink provides a method
Modify the storage parameters of the TEMP tablespace so that the Smon process can view the temporary segments to clean up and TEMP tablespace.
SQL> alter tablespace temp increase 1;
SQL> alter tablespace temp increase 0;
Method 3: a common method is described as follows:
1. Run the following statement a to check who is using the temporary segment.
SELECT username,
Sid,
Serial #,
SQL _address,
Machine,
Program,
Tablespace,
Segtype,
Contents
FROM v $ session se,
V $ sort_usage su
WHERE se. saddr = su. session_addr
2. processes that are using temporary segments
SQL> Alter system kill session 'sid, serial #';
3. shrink the TEMP tablespace.
SQL> Alter tablespace TEMP coalesce;
Method 4: using event diagnosis is also a method that I think is "killer ".
1. Determine the ts of the TEMP tablespace #
SQL> select ts #, name from sys. ts $;
TS # NAME
-----------------------
0 SYSYEM
1 RBS
2 USERS
3 * TEMP
4 TOOLS
5 INDX
6 DRSYS
2. Perform the cleanup operation.
SQL> alter session set events 'immediate trace name DROP_SEGMENTS level 4 ';
Note:
Temp tablespace TS # is 3 *, So TS # + 1 = 4
Others:
1. I think the reason for the above problem may be that the large sorting exceeds the allowed range of the TEMP tablespace space. It may also contain other causes of exceptions.
2. Observing the states of TEMP and other spaces is one of Dba's daily responsibilities. We can use Toad, Object Browser, and other tools, or use the following statement:
Select upper (F. TABLESPACE_NAME) "tablespace name ",
D. TOT_GROOTTE_MB "tablespace size (M )",
D. TOT_GROOTTE_MB-F. TOTAL_BYTES "used space (M )",
TO_CHAR (ROUND (D. TOT_GROOTTE_MB-F. TOTAL_BYTES)/D. TOT_GROOTTE_MB * 100,
2 ),
'1970. 99') "usage ratio ",
F. TOTAL_BYTES "Idle space (M )",
F. MAX_BYTES "maximum block (M )"
FROM (SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES)/(1024*1024), 2) TOTAL_BYTES,
ROUND (MAX (BYTES)/(1024*1024), 2) MAX_BYTES
From sys. DBA_FREE_SPACE
Group by TABLESPACE_NAME) F,
(Select dd. TABLESPACE_NAME,
ROUND (SUM (DD. BYTES)/(1024*1024), 2) TOT_GROOTTE_MB
From sys. DBA_DATA_FILES DD
Group by dd. TABLESPACE_NAME) D
Where d. TABLESPACE_NAME = F. TABLESPACE_NAME
Order by 4 DESC