oracle数据库查看表空间默认大小及使用情况总结

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yin767833376/article/details/84938255

oracle查询数据库的默认表空间情况操作步骤如下:

1. 查询用户对应的表空间,我们可以看到针对不同的数据库用户Oracle


select username, default_tablespace, temporary_tablespace from dba_users;

2. 查询用户的对应的数据文件,以及数据文件大小


select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name;


3. 用户对应的表空间,以及表空间的大小


SELECT a.tablespace_name "表空间名",
total "表空间大小",
free "表空间剩余大小",
(total - free) "表空间使用大小",
total / (1024 * 1024 * 1024) "表空间大小(G)",
free / (1024 * 1024 * 1024) "表空间剩余大小(G)",
(total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name ;

猜你喜欢

转载自blog.csdn.net/yin767833376/article/details/84938255