TABLESPACE creation error
-
01-01-2021 - |
Question
I have an error "ORA-01537" when I create a tablespace.
create tablespace "VOLUMT" datafile 'VOLUMT.dbf' size 250M autoextend on;
Then, it shows like following.
ERROR at line 1: ORA-01537: cannot add file 'VOLUMT.dbf' - file already part of database
I just change the tablespace name of VOLUMT to TEST01, and it works..
Tablespace created.
So, I get into the directory of db and searched the related tablespace..
${HOME}/oracle/db/oradata/ORAC12
However, I can't find any.. Coudl you help me to solve this problem? Also I need to use "VOLUMT" for tablespace creation.. not TEST01..
-- Additional --
select TABLESPACE_NAME from DBA_DATA_FILES; TABLESPACE ---------- SYSTEM SYSAUX USERS TEST01
I can see TEST01 Tablespace, but I can't find any datafiles in the directory. Also I can't find any VOLLMT tablespace in it..
Thank you.
Solution
The solution to your issue can be:
create the tablespace named as VOLUMT
, but for the file name change it a bit like VOLUMT1.dbf
or else specify a different directory path to save the file in.
create tablespace "VOLUMT" datafile 'VOLUMT1.dbf' size 250M autoextend on;
please check and tell me if it worked fine.
OTHER TIPS
all the guys..
First of all, really appreciate to you all for replying...
When I input the follwing
select file_name, file_id, tablespace_name, status,online_status from dba_data_files order by tablespace_name;
The output is
FILE_NAME -------------------------------------------------------------------------------- FILE_ID TABLESPACE STATUS ONLINE_ ---------- ---------- --------- ------- /home/oracle/db/oradata/ORAC12/ID/sysaux01.dbf 28 SYSAUX AVAILABLE ONLINE /home/oracle/db/oradata/ORAC12/ID/system01.dbf 27 SYSTEM AVAILABLE SYSTEM /home/oracle/db/oradata/ORAC12/ID/ID_user01.dbf 29 USERS AVAILABLE ONLINE
There is no such as "VOLUMT" tablespace. When I re-try to create a "TEST01" tablespace, eventhough it's already deleted, it shows 'the file exists already'..
When I get into the directory, there are other SID's as well. And, one of them has "VOLUMT". However, they are different "SID" so they can have same name of tablespace, isn't it?
The error you get indicates that there is an existing data file with the same name specified VOLUMT.dbf
.
Check if there is an existing file with the same name.
SELECT FILE_NAME, TABLESPACE_NAME FROM DBA_DATA_FILES WHERE LOWER(FILE_NAME) LIKE '%volumt.dbf';
To find the data file path for TEST01 you can easily query it through the following statement
SELECT FILE_NAME, TABLESPACE_NAME FROM DBA_DATA_FILES WHERE TABLESPACE_NAME LIKE 'TEST01';
You are only looking at the tablespaces and not at the database files.
Try querying the dba_data_files
Data Dictionary View.
Here an example command:
set pages 50
set lines 230
column file_name format a60
select file_name, file_id, tablespace_name, status,online_status
from dba_data_files order by tablespace_name;
This should list all the database files and show you to which tablespace they belong.
In response to your comment:
You might have to switch the SID and run the query for each SID in order to determine which database files names have already been used.
You can't have the same database file (name) for a different SID and a different tablespace in the same directory.
Possible Solutions
You will either have to delete the database file
VOLUMT.dbf
from the tablespace it is currently attached to, to be able to re-create the tablespaceVOLUMT
with the `VOLUMT.dbf database file.You will have to create the tablespace
VOLUMT
using the database fileVOLUMT.dbf
in a different directory.
Your issue isn't the tablespace VOLUMT
, but the database file VOLUMT.dbf
that already exists for a different SID and a different tablespace.
delete the offending tablespace and it's contents. use
DROP TABLESPACE 'the tablespace name' INCLUDING CONTENTS;
for your case;
DROP TABLESPACE VOLUMT INCLUDING CONTENTS;