Question: I am getting an ORA-01720 error while trying to
grant SELECT privileges to a second user on a view owned by one
user:
ORA-01720: grant
option does not exist for 'SYS.V_$INSTANCE'
I even granted select on sys.v_$instance to the second
user. Still the problem persists. How do I correct this ORA-01720 error?
Answer: To diagnose any error, you start by using the
oerr utility to display the ORA-01720 error:
ORA-01720: grant option does not exist for 'string.string'
Cause: A grant was being performed on a view and the grant option
was not present for an underlying object.
Action: Obtain the grant option on all underlying objects of the
view.
First, you
need to grant SELECT on sys.v_$instance to the first user that owns the
view using the GRANT option. This will
allow the owner to grant SELECT on views based on v_$instance to other users,
which should eliminate the ORA-01720.
Here is another more academic example of this problem and the solution to the
ORA-01720:
- USER "A" has
created a TABLE "table_1"
- USER "B" has created a SYNONYM on "A"."table_1"
- USER "B" has created a VIEW "view_1" based on "table_1"
- USER "B" has created a PUBLIC SYNONYM on VIEW "view_1"
- USER "B" has the right to select "A"."table_1" (grant option NO)
- USER "C" has the right to select "A"."table_1" (grant option NO)
- USER "C" has the right to select "B"."view_1" (grant option NO)
Why does USER "C" have insufficient privileges? Do a little experimenting
and log in as USER "B" and executed the following command.
So it seems that USER "B" is not able to grant something to another user if the
object he wants to grant access to uses some other object from another USER (in
this case USER "A")! The USER to whom we want to grant
access (USER "C") has the SELECT right on "table_1", so the underlying object
("table_1") of the VIEW "view_1" is very well accessible to USER "C".
Here's the solution:
- USER "A" grants USER "B" select rights WITH grant option on
"table_1"
- USER "B" grants USER "C" select on "view_1"
USER "C" then is able to select from "view_1" without problems.
This should help you resolve your ORA-01720 error.