How to create a tablespace with multiple datafiles? - oracle

I'm using the following script to create a new tablespace with three datafile with 4 MB size for each.
create tablespace homeworkts
datafile 'D:\oradata\orcl\df1.dbf' size 4m ,
datafile 'D:\oradata\orcl\df2.dbf' size 4m,
datafile 'D:\oradata\orcl\df3.dbf' size 4m;
But it keeps giving me the error
invalid file name
for the second datafile.
Why?

Reading create tablespace syntax you should write:
create tablespace homeworkts
datafile 'D:\oradata\orcl\df1.dbf' size 4m,
'D:\oradata\orcl\df2.dbf' size 4m,
'D:\oradata\orcl\df3.dbf' size 4m;
You should write datafile just for once, then all your file specification separated by commas:
Edited on 2018' Still valid for current create tablespace on release 18 oracle version.

It should be like this
create tablespace homeworkts datafile 'D:\oradata\orcl\df1.dbf' size 4m,
'D:\oradata\orcl\df2.dbf' size 4m,
'D:\oradata\orcl\df3.dbf' size 4m;

create tablespace userdata
datafile 'E:\oradata\orcl\df1.dbf' size 100M,
'E:\oradata\orcl\df2.dbf' size 200M,
'E:\oradata\orcl\df3.dbf' size 300M;

CREATE TABLESPACE maximo_data NOLOGGING
DATAFILE 'D:\oracle\product\10.2.0\oradata\maximo\maximo_data_0.ora' SIZE 16G,
'D:\oracle\product\10.2.0\oradata\maximo\maximo_data_1.ora' SIZE 16G
autoextend off
extent management local;

Related

persistent error - unable to extend temp segment by 128 in tablespace TEMP

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!
Dave
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;
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

ora-1653 unable to extend table

I am trying to import an Oracle Schema to a new BBDD:
impdp ******/****** schemas=SCHEMA dumpfile=SCHEMA_2016-09-16_%u.dpdmp
But I get this error:
ORA-39171: Job is experiencing a resumable wait.
ORA-01653: unable to extend table SCHEMA.ELEMENTS by 8192 in tablespace SCHEMA_DAT1
My TABLESPACE and DATAFILES are in "AUTOEXTEND ON" mode:
create tablespace SCHEMA_DAT1 datafile '/ora01/app/oracle/oradata/fgh/DATAFILES/SCHEMA_DAT1.dbf' SIZE 4096M AUTOEXTEND ON;
alter database datafile '/ora01/app/oracle/oradata/fgh/DATAFILES/SCHEMA_DAT1.dbf' autoextend on maxsize unlimited;
The error is very strange and i can't find a solution.
I need a lot more DataFiles because the limit is 32GB per file. Thanks.

Resizing undo tablespace

My Undo tablespace has been utilized 99% and I wanted to resize(increase) the undo tablespace.
Is there anyway that I can resize an Undo tablespace in Oracle?
alter database datafile '<undo datafile name>' autoextend on maxsize XXg;
replace XX with the new datafile size

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.
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
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;

Lucene Indexing from Oracle:ORA-01652: unable to extend temp segment

I met a problem when using Lucene to build full-text index of the data from the Oracle 11g database, with the following information:
"ora-01652 unable to extend temp segment by 128 in tablespace temp, on MDSYS.SDO_RDF_TRIPLE_S", line 608"
The total size of the dataset is about 1.5GB. After the problem occur, I followed some instructions online:
CREATE TEMPORARY TABLESPACE temp01
TEMPFILE 'D:\oracle\oradata\temp01.dbf' SIZE 2048M AUTOEXTEND ON MAXSIZE UNLIMITED;
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp01;
However, the problem is still there. The disk space is enough, though. Can anyone give me some help? Thanks in advance!
What tablespace is MDSYS.SDO_RDF_TRIPLE_S in? That's the tablespace to which space needs to be added. Also, MAXSIZE UNLIMITED doesn't really mean unlimited; on most platforms, that means 32767 MB.
Changing the default temporary tablespace for the database doesn't modify the assigned value for existing users who explicitly had a temporary tablespace set. Check the user you're connecting as, in dba_users, and if it has a different temporary tablespace do alter user <id> temporary tablespace temp01.
You could also have increased the size of the existing temporary tablespace, by increasing the size of its tempfile, setting that to autoextend, or adding an additional tempfile. However, if this is a one-off task then creating a new large tablespace for it and dropping it afterwards may not be a bad idea.

Resources