Ora-01652:unable to extend temp segment by num in Tablespace name
Reason: There is not enough space in the Oracle Temporary segment table because Oracle always allocates contiguous space as much as possible, as long as there is not enough unallocated space or the distribution is discontinuous.
Workaround: We know that because Oracle takes tablespaces as logical structures-cells, and the physical structure of tablespaces is data files, data files are physically created on disk, and all the objects in the table space are on disk, the data files must be added in order to add space to the tablespace. Look at the free space in the specified table space, using the view sys.dba_free_space, each record in the view represents the size of the free space fragment:
Sql>select file_id,block_id,blocks,bytes from Sys.dba_free_space where tablespace_name= ';
The returned information can initially determine the maximum block of free space, see if it is smaller than the size mentioned in the error message, and then look at the default table space parameters:
Sql>select initial_extent,next_extent,min_extents,pct_increase from SYS. Dba_tablespaces WHERE Tablespace_name=name;
Modify the default storage value for the temporary segment table space by using the following SQL command:
Sql>alter tablespace name DEFAULT STORAGE (INITIAL XXX NEXT YYY);
Appropriately increasing the size of the default value may resolve the error problem, or you can fix the problem by modifying the user's temporary table space size:
Sql>alter USER username temporary tablespace new_tablespace_name;
Using the Alter TABLESPACE command, once completed, the increased space can be used without exiting the database or taking the tablespace offline, but note that once you have added a data file, you cannot delete it, and to delete it, you delete the tablespace.
An example of an error is as follows:
Ora-1652:unable to extend temp segment by 207381 in Tablespace tempspace
The corresponding English is as follows:
Cause:failed to allocate extent for temp segment in tablespace
Action:use the ALTER tablespace ADD datafile statement to the specified tablespace or create the Object in another tablespace.
Add:
Rebuild Temp Table Space Startup-Start databaseCreate TemporaryTablespace TEMP2 tempfile '/home2/oracle/oradata/sysmon/temp02.dbf 'SIZE512M Reuse Autoextend on NEXT640K MAXSIZE Unlimited; --Create transit temporary table spaceAlter Database default TemporaryTablespace Temp2; --Change the default temp table space to the new temporary table space just created TEMP2DropTablespaceTempincluding contents and datafiles; --Delete the original temporary table spaceCreate TemporaryTablespaceTEMPTempfile '/home2/oracle/oradata/sysmon/temp01.dbf 'SIZE512M Reuse Autoextend on NEXT640K MAXSIZE Unlimited; --Recreate temporary table spaceAlter Database default TemporaryTablespaceTemp; --Resets the default temp table space to the newly created temp table spaceDropTablespace temp2 including contents and datafiles; --Remove transit with temporary table space