简体   繁体   中英

ORACLE DB dbf file related to which table?

I have a dbf files like:

undotbs01.dbf           10.16113281 GB
ENABLERS_DATA01.dbf     31.99998474 GB

How can I find that which tables are associated with the dbf files so that I can delete the corresponding data from the tables to reduce my dbf files disk consumption

Tables aren't "associated" with a DBF file, they are associated with a tablespace which in turn is associated to one or more DBF files.

So you need to join the information from each table to the tablespace information, something like this:

select tbl.owner, 
       tbl.table_name, 
       df.tablespace_name,
       df.file_name
from all_tables tbl
  join dba_data_files df on df.tablespace_name = tbl.tablespace_name
order by 1,2;

If a tablespace has more than one datafile, you'll see that table more than once in the result (because of the join to dba_data_files ) You cannot tell in which physical file the table's data actually lies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM