首先授予用户king权限
SQL>grant connect,resource to king;---连接与资源权限
Grant succeeded.
SQL>grant select on scott.emp to king;-----查询scott用户下的emp表权限
Grant succeeded.
SQL>grant create materialized view to king;---创建物化视图权限
Grant succeeded.
SQL>grant execute on dbms_mview to king;---可以使用dbms_mview包的权限
Grant succeeded.
SQL>
同样要授予scott用户创建物化视图权限
SQL>grant create materialized view to scott;
Grant succeeded.
SQL>
登录king用户确认能访问scott下的emp表
SQL>conn king/oracle
Connected.
SQL>select * from scott.emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- ---------
---------- ------------ ---------- ----------
DEPTNO
----------
7369 SMITH CLERK 7902 17-DEC-80 800
20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300
30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- ---------
---------- ------------ ---------- ----------
…….