Oracle表空间查询

1、查询数据库中的表空间名称

1)查询所有表空间

select tablespace_name from dba_tablespaces;
select tablespace_name from user_tablespaces; 

2)查询使用过的表空间 

select distinct tablespace_name from dba_all_tables;

select distinct tablespace_name from user_all_tables; 

2、查询表空间中所有表的名称

select table_name from dba_all_tables where tablespace_name = tablespacename

3、查询系统用户

select * from all_users
select * from dba_users

4、查看当前连接用户

select * from v$session

5、查看当前用户权限

select * from session_privs

6、查看所有的函数和存储过程

select * from user_source

其中TYPE包括:PROCEDURE、FUNCTION

7、查看表空间使用情况

select a.file_id "FileNo",
       a.tablespace_name "表空间",
       a.bytes "Bytes",
       a.bytes - sum(nvl(b.bytes, 0)) "已用",
       sum(nvl(b.bytes, 0)) "空闲",
       sum(nvl(b.bytes, 0)) / a.bytes * 100 "空闲百分率"
  from dba_data_files a, dba_free_space b
 where a.file_id = b.file_id(+)
 group by a.tablespace_name, a.file_id, a.bytes
 order by a.tablespace_name;

posted @   伸手不见五趾  阅读(11706)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示