在Oracle数据库中,您可以使用以下查询来查看数据库的总大小和表空间的使用情况:
- 查看数据库的总大小:
SELECT SUM(bytes)/1024/1024 AS "Database Size (MB)" FROM dba_data_files;
- 查看每个表空间的使用情况:
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;
- 查看每个表的大小:
SELECT table_name, SUM(bytes)/1024/1024 AS "Table Size (MB)"
FROM dba_segments
GROUP BY table_name;
请注意,以上查询需要具有适当的权限才能成功运行。