查看某个用户属于哪个表空间

小流年Moon。。。 2019-10-18 11:06:17
select username,default_tablespace from dba_users where username='用户名'; select * from dba_tablespaces;--查看表空间 --查看表空间文件路径 select tablespace_name,file_id,bytes/1024/1024,file_name    from dba_data_files order by file_id; --查看用户和默认表空间的关系 select username,default_tablespace from dba_users
...全文
299 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lhdz_bj 2019-10-25
  • 打赏
  • 举报
回复
1、你这里理解可能有点问题,用户不会属于任何表空间,但可以授权用户使用哪个表空间,oracle的表空间是公共资源,关键看用户是否有权使用。因此,你只能查到用户的默认表空间是哪个,用户对哪个表空间有权限等。
2、查询用户默认表空间:
select username,default_tablespace from dba_users where username='USER1';
3、查询用户的表空间权限:
select * from dba_sys_privs where username='USER1';
select * from dba_ts_quotas where username='USER1';
Jerry松 2019-10-22
  • 打赏
  • 举报
回复
查看用户下的表空间的语句: select a.tablespace_name, a.bytes / 1024 / 1024 "sum MB", (a.bytes - b.bytes) / 1024 / 1024 "used MB", b.bytes / 1024 / 1024 "free MB", round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "used%" from (select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name, sum(bytes) bytes, max(bytes) largest from dba_free_space group by tablespace_name) b where a.tablespace_name = b.tablespace_name order by ((a.bytes - b.bytes) / a.bytes) desc;

1,617

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧