关于ORA-01720错误
(2012-10-14 12:54:21)
标签:
oracle杂谈 |
The HR user creates a view with this command:
SQL> CREATE VIEW emp_v AS SELECT * FROM scott.emp;
Now HR wants to grant the SELECT privilege on the EMP_V view to the
JIM user.当HR 用户授权给JIM 用户的视图查询权限的时候,会发生什么呢?
系统会给出ORA-01720错误,错误提示:ORA-01720:不存在“****.****"授权选项。如果想正常给JIM
授予视图的查询权限,需要在此步骤之前,在给SCOTT用户给HR 用户授予表scott.emp查询权限的语句中加上with grant
option. 例如:grant select on scott.emp to hr with
grant option。 所以 HR needs the SELECT privilege on the EMP table with GRANT OPTION from SCOTT for this operation. 这样在用户HR给用户JIM授予视图查询权限的时候才能成功。 而做了一下操作:
SCOTT has to grant the SELECT privilege on the EMP table to JIM before this operation. 会发生什么呢? 当你执行用户HR给用户JIM授予视图查询权限的时候还是收到ORA-01720错误。
原因:当用户B建了关于用户A的表的视图,然后B用户又将视图查询权限授予C用户,那么这意味着C用户必须拥有A用户表的查询权限,否则这个B用户又将视图查询权限授予C用户授权失败。因此在A用户给B用户授予A用户表的查询权限的时候,需要加上with grant option子句,然后在用户又将视图查询权限授予C用户的时候,将A用户表的权限给传递给C用户。
(可在数据库中建立用户test1,test2,test3用户来测试)