Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

On Oracle, I cannot grant select privilege on v$Session to another user

As the ‘SYS’ user, I can run the following command:

SYS> grant SELECT on V_$SESSION to "SOMEUSER" with GRANT OPTION;

Then, as that user, I can select from V$SESSION:

SOMEUSER> select * from V$SESSION;
 .....  Expected output .....

However, even though the user was given the GRANT option, I cannot GRANT that privilege to anyone else:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

SOMEUSER> grant SELECT on V_$SESSION to "OTHERUSER" with GRANT OPTION;
grant select on V_$SESSION to "OTHERUSER"
                *
ERROR at line 1:
ORA-00942: table or view does not exist

Strangely though, I can do this:

SOMEUSER> grant select on V$SESSION to "OTHERUSER";

Grant succeeded.

Why do I have to specify V_$SESSION when running as the SYS user, but when running as a normal user, I have to specify V$SESSION?

>Solution :

The object is sys.v_$session. If you are logged in as someuser, v_$session would be resolved in the current schema, i.e. someuser.v_$session. That object doesn’t exist, hence the error

grant select on sys.v_$session ...

should work.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading