Tuesday, February 5, 2019

Get Database Size

SELECT b.name,
  ( SELECT SUM(bytes)/1024/1024/1024 DF_size FROM dba_data_files
  ) +
  ( SELECT NVL(SUM(bytes),0)/1024/1024/1024 TF_size FROM dba_temp_files
  ) +
  ( SELECT SUM(bytes)/1024/1024/1024 RLF_size FROM sys.v_$log
  )                     +
  (SELECT SUM(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024/1024 CF_size
  FROM v$controlfile
  ) "Size in GB"
FROM dual,
  (SELECT name FROM v$database
  ) b;

No comments:

Post a Comment