Tuesday, 7 October 2014

ORA-01119: error in creating database file


After dropping tablespace with including contents, may end up with "ORA-01119: error in creating database file".

Reasons could be
1. Not deleting the datafile with "INCLUDING CONTENTS AND DATAFILES"
2. Provided directory path does not exist
3. Error accessing the directory (read/write permission or misspelling of directory names)
4. Datafile already existing in the current directory


Here is the case with not deleting datafile with drop tablespace,

SQL> DROP TABLESPACE DATATS INCLUDING CONTENTS;
Tablespace dropped.


SQL> CREATE TABLESPACE DATATS LOGGING DATAFILE '/home/database/DATATS1.dbf' SIZE 1G AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
*
ERROR at line 1:
ORA-01119: error in creating database file
'/home/database/DATATS1.dbf'
ORA-27038: created file already exists
Additional information: 1


SQL> DROP TABLESPACE DATATS INCLUDING CONTENTS and datafiles;
DROP TABLESPACE DATATS INCLUDING CONTENTS and datafiles
*
ERROR at line 1:
ORA-00959: tablespace 'DATATS' does not exist


$ ls -lrt
total 63169492
-rw-r----- 1 oracle dbs   359723476 Oct  6 16:59 DATATS1.dbf
-rw-r----- 1 oracle dbs   863962592 Oct  6 23:03 temp01.dbf
-rw-r----- 1 oracle dbs   831239922 Oct  7 10:24 system01.dbf
-rw-r----- 1 oracle dbs   513430411 Oct  7 10:24 sysaux01.dbf
-rw-r----- 1 oracle dbs   108758112 Oct  7 10:24 redo03a.log
-rw-r----- 1 oracle dbs   104858342 Oct  7 10:24 redo02a.log
-rw-r----- 1 oracle dbs   222677423 Oct  7 10:24 INDEXTS1.dbf
.
.
.


$ rm -r DATATS1.dbf

SQL> CREATE TABLESPACE DATATS LOGGING DATAFILE '/home/database/DATATS1.dbf' SIZE 1G AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
Tablespace created.

1 comment: