During the creation of a new Tablespace in Oracle Database, the user has to enter the DBF file name that he (or she) want to use. The DBF file is then created in a specific location.
The user may also specify a path in which the DBF file should be created.
I need to find a way to get the default location of the DBF file.
I know how to do it in MS Sql by using a SQL query:
select substring(physical_name, 1, charindex(N'master.mdf', lower(physical_name)) - 1) from master.sys.master_files where database_id = 1 and file_id = 1;
But I have no idea about how to do it in Oracle. I've tried several things:
all_directories
- didn't find any information therev$datafile
view - realized that this view and the others are accesible to database administrators onlyThere are also several limitations:
Any help is much appreciated.
To determine the default datafiles location, I am using the following query:
SELECT DISTINCT SUBSTR (file_name,
1,
INSTR (file_name,
'/',
-1,
1))
FROM DBA_DATA_FILES
WHERE tablespace_name = 'SYSTEM'
It works for ME because all our datafiles are installed in a the same directory.