求关于dba_free_space和dba_data_files的创建视图语句

tulipcaicai 2013-07-08 11:09:01
我在新创建的用户下执行以下语句可以通过并得到结果

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) "percent_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


但我执行创建视图语句却提示 ORA-01031:权限不足
创建视图语句如下:
create or replace view v_tssum as
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) "percent_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
...全文
262 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
tulipcaicai 2013-07-12
  • 打赏
  • 举报
回复
大家还有什么高招没?
tulipcaicai 2013-07-09
  • 打赏
  • 举报
回复
引用 8 楼 u010412956 的回复:
monitor大写啊
用大写来查,果然有好多行,其中有“CREATE ANY VIEW”这一个结果
u010412956 2013-07-09
  • 打赏
  • 举报
回复
引用 7 楼 tulipcaicai 的回复:
[quote=引用 6 楼 u010412956 的回复:]
select privilege from dba_sys_privs where grantee='SYSTEM'
union 
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='SYSTEM');
这个sql 会是0行?????
这个有好多行。我是说我执行这个语句(monitor是我创建的用户),用system和monitor登录后,执行该脚本结果为0行。

select privilege from dba_sys_privs where grantee='monitor'
union 
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='monitor');
[/quote] monitor大写啊
sych888 2013-07-08
  • 打赏
  • 举报
回复
赋予创建视图的权限
wangchangming 2013-07-08
  • 打赏
  • 举报
回复
grant create view to 新建用户
tulipcaicai 2013-07-08
  • 打赏
  • 举报
回复
引用 6 楼 u010412956 的回复:
select privilege from dba_sys_privs where grantee='SYSTEM'
union 
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='SYSTEM');
这个sql 会是0行?????
这个有好多行。我是说我执行这个语句(monitor是我创建的用户),用system和monitor登录后,执行该脚本结果为0行。

select privilege from dba_sys_privs where grantee='monitor'
union 
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='monitor');
u010412956 2013-07-08
  • 打赏
  • 举报
回复
select privilege from dba_sys_privs where grantee='SYSTEM'
union 
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='SYSTEM');
这个sql 会是0行?????
tulipcaicai 2013-07-08
  • 打赏
  • 举报
回复
引用 4 楼 u010412956 的回复:
sys都不行? 2个USER_NAME改成对面的用户名,看下啥结果
select privilege from dba_sys_privs where grantee='USER_NAME'
union 
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='USER_NAME');
在system、和我创建的用户下,执行结果都是 0 行
u010412956 2013-07-08
  • 打赏
  • 举报
回复
sys都不行? 2个USER_NAME改成对面的用户名,看下啥结果
select privilege from dba_sys_privs where grantee='USER_NAME'
union 
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='USER_NAME');
tulipcaicai 2013-07-08
  • 打赏
  • 举报
回复
我赋予了用户创建视图的权限,而且用户还有DBA权限。同样的语句,我在system和sys下执行,都报权限不足。
一、DBA最常用的数据字典 dba_data_files:通常用来查询关于数据库文件的信息 dba_db_links:包括数据库中的所有数据库链路,也就是databaselinks。 dba_extents:数据库中所有分区的信息 dba_free_space:所有表空间中的自由分区 dba_indexs:关于数据库中所有索引的描述 dba_ind_columns:在所有表及聚集上压缩索引的列 dba_objects:数据库中所有的对象 dba_rollback_segs:回滚段的描述 dba_segments:所有数据库段分段的存储空间 dba_synonyms:关于同义词的信息查询 dba_tables:数据库中所有数据表的描述 dba_tabespaces:关于表空间的信息 dba_tab_columns:所有表描述、视图以及聚集的列 dba_tab_grants/privs:对象所授予的权限 dba_ts_quotas:所有用户表空间限额 dba_users:关于数据的所有用户的信息 dba_views:数据库中所有视图的文本 二、DBA最常用的动态性能视图 v$datafile:数据库使用的数据文件信息 v$librarycache:共享池中SQL语句的管理信息 v$lock:通过访问数据库会话,设置对象锁的所有信息 v$log:从控制文件中提取有关重做日志组的信息 v$logfile有关实例重置日志组文件名及其位置的信息 v$parameter:初始化参数文件中所有项的值 v$process:当前进程的信息 v$rollname:回滚段信息 v$rollstat:联机回滚段统计信息 v$rowcache:内存中数据字典活动/性能信息 v$session:有关会话的信息 v$sesstat:在v$session中报告当前会话的统计信息 v$sqlarea:共享池中使用当前光标的统计信息,光标是一块内存区域,有Oracle处理SQL语句时打开。 v$statname:在v$sesstat中报告各个统计的含义 v$sysstat:基于当前操作会话进行的系统统计 v$waitstat:出现一个以上会话访问数据库的数据时的详细情况。当有一个以上的会话访问同一信息时,可出现等待情况。

17,377

社区成员

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

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