建立一个用户jhq,使jhq用户只具备访问视图jhq_view的权限
1.登陆管理员用户shz,创建用户jhq,密码password,表空间jhq_tablespace
create user jhq identified by password default tablespace jhq_tablespace;
2.赋权限-创建session,创建view,查询table
grant create session,create any view,select any table to jhq;
3.通过users表,创建视图to_jhq_view
create or replace view to_jhq_view as (select * from users) with read only;
4.为用户jhq对于视图to_jhq_view赋查询的权限
grant select on to_jhq_view to jhq;
如果需要更新插入权限可以增加
grant select,insert,update on to_jhq_view to jhq;
5.登陆被创建的用户jhq,通过shz为jhq建立的视图to_jhq_view来创建自己账号下的视图jhq_view
create or replace view jhq_view as (select * from shz.to_jhq_view) with read only;
6.查询视图jhq_view
select * from jhq_view;