温馨提示×

oracle如何查看数据库大小

小亿
923
2024-05-06 20:57:56
栏目: 云计算

在Oracle数据库中,您可以使用以下查询来查看数据库的总大小和表空间的使用情况:

  1. 查看数据库的总大小:
SELECT SUM(bytes)/1024/1024 AS "Database Size (MB)" FROM dba_data_files;
  1. 查看每个表空间的使用情况:
SELECT tablespace_name, SUM(bytes)/1024/1024 AS "Tablespace Size (MB)", SUM(bytes)/1024/1024 - SUM(blocks)/1024/1024 AS "Tablespace Used (MB)" 
FROM dba_data_files 
GROUP BY tablespace_name;
  1. 查看每个表的大小:
SELECT table_name, SUM(bytes)/1024/1024 AS "Table Size (MB)" 
FROM dba_segments 
GROUP BY table_name;

请注意,以上查询需要具有适当的权限才能成功运行。

0