Oracle:当没有 dba privs 时如何检查表空间使用的空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28476780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:44:11  来源:igfitidea点击:

Oracle: how to check space used by a tablespace when no dba privs

oraclespacetablespace

提问by user840930

I need to check space used by a tablespace but I have no dba privs. Is there a way to do this?

我需要检查表空间使用的空间,但我没有 dba 权限。有没有办法做到这一点?

回答by mmmmmpie

Unfortunately without explicit permissions to the dba_free_spaceor dba_segmentsviews you are stuck with your users default tablespace:

不幸的是,如果没有对dba_free_spacedba_segments视图的明确权限,您就会被用户默认表空间困住:

SELECT
  ts.tablespace_name,
  TO_CHAR(SUM(NVL(fs.bytes,0))/1024/1024, '99,999,990.99') AS MB_FREE
FROM
  user_free_space fs,
  user_tablespaces ts,
  user_users us
WHERE
  fs.tablespace_name(+)   = ts.tablespace_name
AND ts.tablespace_name(+) = us.default_tablespace
GROUP BY
  ts.tablespace_name;

If you need to check the size of a tablespace for which you don't have a user with that as their default tablespace you're stuck with going back to your DBA.
Test with the system tablespace as default:
enter image description here
Test with an app tablespace as the default tablespace:
enter image description here
This schema does not have query on the dba views:

如果您需要检查没有用户将其作为默认表空间的表空间的大小,您将不得不回到 DBA。
使用系统表空间作为默认进行
在此处输入图片说明
测试:使用应用程序表空间作为默认表空间进行测试:
在此处输入图片说明
此架构在 dba 视图上没有查询:

select * from dba_free_space;
ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:    
*Action:
Error at Line: 13 Column: 15