Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORA-01658: unable to create INITIAL extent for segment in tablespace TS_DATA

When i tried to create a table in my User_DB schema i am getting an error as ORA-01658: unable to create INITIAL extent for segment in tablespace TS_DATA. I run the following query to get all the TABLESPACE_NAME:

SELECT * FROM DBA_DATA_FILES;

But i really dont know which tablespace i am using and how to extend the tablespace to solve this issue.

like image 700
Andrew Avatar asked May 06 '16 11:05

Andrew


People also ask

How do you fix Ora 01658?

Cause: Failed to find sufficient contiguous space to allocate INITIAL extent for segment being created. Action: Use ALTER TABLESPACE ADD DATAFILE to add additional space to the tablespace or retry with a smaller value for INITIAL.

How do I resize a tablespace in Oracle?

Increase the size of the tablespace If you haven't turned on the autoextend feature and want to resize the tablespace, then do the following: For bigfile tablespaces: Resize the tablespace using the ALTER TABLESPACE command. You can specify the size in kilobytes (K), megabytes (M), gigabytes (G), or terabytes (T).

How do I make my initial extent smaller?

Just like you cannot grow and shrink in size allocated next extents, you cannot modify the initial. You would have to recreate the object (using alter table MOVE for example) in order to modify the initial extent.

What is Autoextend in Oracle for tablespace?

6.4 Autoextend Tablespace. You can set a tablespace to automatically extend itself by a specified amount when it reaches its size limit. If you do not enable autoextend, then you are alerted when the tablespace reaches its critical or warning threshold size.


2 Answers

As the error message indicates, you're using the TS_DATA tablespace. You can extend it by either enlarging one of the existing data files:

ALTER DATABASE 
DATAFILE 'C:\ORACLEXE\APP\ORACLE\ORADATA\XE\TS_DATA.DBF' 
RESIZE 3000M;

Or by adding a second datafile to the tablespace:

ALTER TABLESPACE ts_data 
ADD DATAFILE 'C:\ORACLEXE\APP\ORACLE\ORADATA\XE\TS_DATA2.DBF' 
SIZE 1000M;

Or just allow the datafile to auto extend:

ALTER DATABASE 
DATAFILE 'C:\ORACLEXE\APP\ORACLE\ORADATA\XE\TS_DATA2.DBF'
AUTOEXTEND ON
MAXSIZE UNLIMITED; -- Or some reasonable cap
like image 168
Mureinik Avatar answered Sep 23 '22 01:09

Mureinik


To check existing table spaces data file and size by following sql

select a.file_id,b.file_name,b.autoextensible,b.bytes/1024/1024,sum(a.bytes)/1024/1024
from dba_extents a , dba_data_files b
where a.file_id=b.file_id
group by a.file_id,b.file_name,autoextensible,b.bytes/1024/1024

Then run following sql, it would to make auto extend data file size.

ALTER DATABASE 
DATAFILE '/u01/app/oracle/oradata/XE/TS_DATA.dbf'
AUTOEXTEND ON
MAXSIZE UNLIMITED;
like image 45
Julfiker Avatar answered Sep 22 '22 01:09

Julfiker