物化视图

[复制链接]
查看11 | 回复6 | 2013-12-31 14:11:39 | 显示全部楼层 |阅读模式
1create materialized view emp_dept
2build immediate
3refresh on demand
4enable query rewrite
5as
6select dept.deptno,dept.dname,count(*)
7from emp,dept
8where emp.deptno=dept.deptno
9* group by dept.deptno,dept.dname
SQL> /
from emp,dept
*
ERROR 位于第 7 行:
ORA-01031: 权限不足
我在创建物化视图时提示权限不足,我在这个用户查 emp,dept 这两个表是没问题的。我给这个用户添加创建视图以及dba的权限,还是一样的错误,请问是哪里有问题。谢谢。
回复

使用道具 举报

千问 | 2013-12-31 14:11:39 | 显示全部楼层
显示声明一下,或者用authid_current user
回复

使用道具 举报

千问 | 2013-12-31 14:11:39 | 显示全部楼层
The privileges required to create a materialized view should be granted directly rather than through a role.
To create a materialized view in your own schema:
You must have been granted the CREATE MATERIALIZED VIEW 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 a materialized view in another user's schema:
You must have the CREATE ANY MATERIALIZED VIEW system privilege.
The owner of the materialized view must have the CREATE TABLE system privilege. The owner must also have access to any master tables of the materialized view that the schema owner does not own (for example, if the master tables are on a remote database) and to any materialized view logs defined on those master tables, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
To create a refresh-on-commit materialized view (ON COMMIT REFRESH clause), in addition to the preceding privileges, you must have the ON COMMIT REFRESH object privilege on any master tables that you do not own or you must have the ON COMMIT REFRESH system privilege.
To create the materialized view with query rewrite enabled, in addition to the preceding privileges:
If the schema owner does not own the master tables, then the schema owner must have the GLOBAL QUERY REWRITE privilege or the QUERY REWRITE object privilege on each table outside the schema.
If you are defining the materialized view on a prebuilt container (ON PREBUILT TABLE clause), then you must have the SELECT privilege WITH GRANT OPTION on the container table.
The user whose schema contains the materialized view must have sufficient quota in the target tablespace to store the master table and index of the materialized view or must have the UNLIMITED TABLESPACE system privilege.
When you create a materialized view, Oracle Database creates one internal table and at least one index, and may create one view, all in the schema of the materialized view. Oracle Database uses these objects to maintain the materialized view data. You must have the privileges necessary to create these objects.
回复

使用道具 举报

千问 | 2013-12-31 14:11:39 | 显示全部楼层
哦,学习了,楼上这么水平还在家呆着啊 ,浪费了
回复

使用道具 举报

千问 | 2013-12-31 14:11:39 | 显示全部楼层
呵呵,可以了,我在 sys 下,grant creatematerialized view to kisa

grant create table to kisa;

grant createSNAPSHOTto kisa;
终于可以了,谢谢两位。。。。。
回复

使用道具 举报

千问 | 2013-12-31 14:11:39 | 显示全部楼层
不用谢,我还得谢谢caizhuoyi 呢,又学习了
回复

使用道具 举报

千问 | 2013-12-31 14:11:39 | 显示全部楼层
真的学习了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行