Basic Oracle Concepts and Programming Question:
How To View the Data Files in the Current Database?
Answer:
If you want to get a list of all tablespaces used in the current database instance, you can use the DBA_TABLESPACES view as shown in the following SQL script example:
SQL> connect SYSTEM/globalguideline
Connected.
SQL> col tablespace_name format a16;
SQL> col file_name format a36;
SQL> SELECT TABLESPACE_NAME, FILE_NAME, BYTES
2 FROM DBA_DATA_FILES;
<pre>TABLESPACE_NAME FILE_NAME BYTES
--------------- ------------------------------- ---------
USERS ORACLEXEORADATAXEUSERS.DBF 104857600
SYSAUX ORACLEXEORADATAXESYSAUX.DBF 461373440
UNDO ORACLEXEORADATAXEUNDO.DBF 94371840
SYSTEM ORACLEXEORADATAXESYSTEM.DBF 356515840</pre>
SQL> connect SYSTEM/globalguideline
Connected.
SQL> col tablespace_name format a16;
SQL> col file_name format a36;
SQL> SELECT TABLESPACE_NAME, FILE_NAME, BYTES
2 FROM DBA_DATA_FILES;
<pre>TABLESPACE_NAME FILE_NAME BYTES
--------------- ------------------------------- ---------
USERS ORACLEXEORADATAXEUSERS.DBF 104857600
SYSAUX ORACLEXEORADATAXESYSAUX.DBF 461373440
UNDO ORACLEXEORADATAXEUNDO.DBF 94371840
SYSTEM ORACLEXEORADATAXESYSTEM.DBF 356515840</pre>
Previous Question | Next Question |
What Are the Predefined Tablespaces in a Database? | How To Create a new Oracle Data File? |