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
Oracle: how to check space used by a tablespace when no dba privs
提问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_space
or dba_segments
views you are stuck with your users default tablespace:
不幸的是,如果没有对dba_free_space
或dba_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:
Test with an app tablespace as the default tablespace:
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