Convert user has no select privilege on V $ session

Source: Internet
Author: User
The following error is found when dbms_xplan.display_cursor function is used. SQL> select * from table (dbms_xplan.display_cursor); plan_table_output using user has no select privilege on V $ sessionsql> view the following statements on the official website: this package runs with the privileges of the calling user, not the package owner (sys ). the table functiondisplay_cursor requires to have select privileges on the following fixed views: V $ SQL _plan, V $ Session and V $ SQL _plan_statistics_all. That is to say, you must have the permissions v $ SQL _plan, V $ session, and V $ SQL _plan_statistics_all. SQL> conn sys/root as sysdbaconnected. SQL> grant select on V _ $ SQL _plan to Rhys; grant succeeded. SQL> grant select on V _ $ session to Rhys; grant succeeded. SQL> grant select on V _ $ SQL _plan_statistics_all to Rhys; grant succeeded. SQL> conn Rhys/amyconnected. SQL> select * from table (dbms_xplan.display_cursor); plan_table_output ---------------------------------------------------------------------------- --------------------------------------------------------------------- User has no select privilege on V $ sessionsql> still has an error. Why? Then I read the online manual and found the following sentence: to use the display_cursor functionality, the calling user must haveselect privilege on the fixed views v $ SQL _plan_statistics_all, V $ SQL and V $ SQL _plan, otherwise it shows an appropriate error message. haha. This makes it clear that to use display_cursor, you must have permissions for the four views v $ SQL, V $ SQL _plan_statistics_all, V $ session, and V $ SQL _pan. Let's take a look at the permissions of the Rhys account: SQL> conn sys/root as sysdbaconnected. SQL> grant select on V _ $ SQL to Rhys; grant succeeded. SQL> conn Rhys/amyconnected. SQL> select * from table (dbms_xplan.display_cursor); dyk4dprp70d74, child number 0 ------------------------------------- select decode ('A ', 'A', '1', '2') from dual plan hash value: 1388734953 ------------------------------------------------------------- | ID | operation | Name | rows | cost (% CPU) | time | --------------------------------------------------------------- | 0 | SELECT statement | 2 (100) | 1 | fast dual | 1 | 2 (0) | 00:00:01 | ------------------------------------------------------------------- plan_table_output limit 13 rows selected. SQL>

Convert user has no select privilege on V $ session

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.