Oracle中查詢表或索引實際存放的物理檔案__Oracle

來源:互聯網
上載者:User

今天有朋友問我能查詢到表或者索引實際存放的物理檔案嗎。

表、索引都有對應的Segment。Segment是實體儲存體上的概念,表、索引是邏輯上的概念。

一個Segments由多個Extents組成,每個Extent只能屬於一個DataFile,但同一個Segment的不同Extend可以屬於不同的Datafile。

可以尋找每個Extent屬於哪個DataFile的。那麼也就應該能查詢到表或索引屬於哪個DataFile了

SQL> select a.owner, a.segment_name, a.segment_type, c.file_name  2    from dba_segments a  3   inner join dba_extents b on a.segment_name = b.segment_name  4    left join dba_data_files c on b.file_id = c.file_id  5   where a.owner = 'SCOTT'  6     and a.segment_type in ('TABLE', 'INDEX');OWNER  SEGMENT_NAME  SEGMENT_TYPE  FILE_NAME------ ------------- ------------- ----------------------------------------SCOTT  SALGRADE      TABLE         /u01/app/oracle/oradata/MBBN/users01.dbfSCOTT  PK_EMP        INDEX         /u01/app/oracle/oradata/MBBN/users01.dbfSCOTT  PK_DEPT       INDEX         /u01/app/oracle/oradata/MBBN/users01.dbfSCOTT  EMP           TABLE         /u01/app/oracle/oradata/MBBN/users01.dbfSCOTT  DEPT          TABLE         /u01/app/oracle/oradata/MBBN/users01.dbfSCOTT  BONUS         TABLE         /u01/app/oracle/oradata/MBBN/users01.dbf6 rows selected.




 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.