SQL language for Oracle to view table space usage

Source: Internet
Author: User

Oracle reads the SQL language used to view tablespaces.

  1. SELECT UPPER(F. TABLESPACE_NAME)"Tablespace name",
  2. D. TOT_GROOTTE_MB"Tablespace size (MB )",
  3. D. TOT_GROOTTE_MB-F. TOTAL_BYTES"Used space (M )",
  4. TO_CHAR (ROUND (D. TOT_GROOTTE_MB-F. TOTAL_BYTES)/D. TOT_GROOTTE_MB * 100,
  5. 2 ),
  6. '1970. 99')"Usage ratio",
  7. F. TOTAL_BYTES"Free Space (M )",
  8. F. MAX_BYTES"Maximum block (M )"
  9. FROM(SELECTTABLESPACE_NAME,
  10. ROUND (SUM(BYTES) // (1024*1024), 2) TOTAL_BYTES,
  11. ROUND (MAX(BYTES)/(1024*1024), 2) MAX_BYTES
  12. FROMSYS. DBA_FREE_SPACE
  13. GROUP BYTABLESPACE_NAME) F,
  14. (SELECTDD. TABLESPACE_NAME,
  15. ROUND (SUM(DD. BYTES)/(1024*1024), 2) TOT_GROOTTE_MB
  16. FROMSYS. DBA_DATA_FILES DD
  17. GROUP BYDD. TABLESPACE_NAME) D
  18.  WHERED. TABLESPACE_NAME = F. TABLESPACE_NAME
  19.  ORDER BY4DESC;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.