求助!创建物化视图出错

tsj68 2005-11-06 11:41:23
本人在oracle9i中创建引用另一个模式(schema)的表时,总是报ORA-01039 insufficient privileges on underlying objects of the view,但是创建用户有DBA,RESOURCE,CONNECT角色,
并显示地将引用表授权给创建用户,语句如下:

CREATE MATERIALIZED VIEW "SH"."GG"
BUILD IMMEDIATE
REFRESH FORCE
ON DEMAND
ENABLE QUERY REWRITE
AS
select * from otschema.employee
...全文
303 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
boydgmx 2005-12-19
  • 打赏
  • 举报
回复
我遇到这种问题好久了,也知道需要授予 SH 用户 SELECT ANY TABLE 权限,
但是这个权限不能随便授予,于是我在DBA用户下把 otschema.employee 的select权限授予 SH,
然后以SH用户登录,创建MV
w_tsinghua 2005-12-19
  • 打赏
  • 举报
回复
最好不要授予 SH 用户 SELECT ANY TABLE 权限,而是根据自己的应用,进行select授权
mysohu 2005-12-01
  • 打赏
  • 举报
回复
GRANT GLOBAL QUERY REWRITE TO SH;
可以不?
ATGC 2005-11-09
  • 打赏
  • 举报
回复
GRANT GLOBAL QUERY REWRITE TO SH;
KingSunSha 2005-11-09
  • 打赏
  • 举报
回复
最简单的测试方法:

grant select any table to sh;

CREATE MATERIALIZED VIEW "SH"."GG"
BUILD IMMEDIATE
REFRESH FORCE
ON DEMAND
ENABLE QUERY REWRITE
AS
select * from otschema.employee;
KingSunSha 2005-11-09
  • 打赏
  • 举报
回复
From Oracle document:

To create a materialized view in your own schema:
- You must have been granted either the CREATE MATERIALIZED VIEW or CREATE SNAPSHOT system privilege and either the CREATE TABLE or CREATE ANY TABLE system privilege.
- You must also have access to any master tables of the materialized view that you do not own, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.

To create the materialized view with query rewrite enabled, in addition to the
preceding privileges:
- The owner of the master tables must have the QUERY REWRITE system privilege.
- If you are not the owner of the master tables, you must have the GLOBAL QUERY REWRITE system privilege.
- If the schema owner does not own the master tables, then the schema owner must have the GLOBAL QUERY REWRITE privilege.

3,490

社区成员

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

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