同事创建了role plustrace,使用system登录可以使用autotrace。
但以普通用户test登录时,报错:
SQL> connect test/test
Connected.
SQL> set autotrace on
SP2-0613: Unable to verify PLAN_TABLE format or existence
SP2-0611: Error enabling EXPLAIN report
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
检查角色设置
SQL> select * from user_role_privs;
USERNAME GRANTED_ROLE ADM DEF OS_
------------------------------ ------------------------------ --- --- ---
TEST CONNECT NO YES NO
TEST PLUSTRACE NO YES NO
TEST RESOURCE NO YES NO
检查表
SQL> select synonym_name,table_name,table_owner from all_synonyms where synonym_name = 'PLAN_TABLE';
no rows selected
应是表PLAN_TABLE没有赋予plustrace select权限。
SQL> connect system/manager as sydba
Connected.
SQL> create public synonym plan_table for plan_table;
Synonym created.
SQL> grant all on plan_table to public;
Grant succeeded.
再试:
SQL> connect test/test
Connected.
SQL> set autotrace on
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
网上查找,tom说了:
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:5671636641855
Followup:
look up a couple of reviews.
I believe you have slightly mismatched versions of SQLPlus and database.
9203 and up use v$mystat
9202 and before use v$session
9201 client and lower queries v$session
9203 client and higher queries v$mystat
make sure plustrace has select on v$mystat and v$session or use the same version
of sqlplus as database.
我的Oracle server和SQL*Plus的版本都是9.0.2.4.0,找到原因了
SQL> connect system/manager as sydba
Connected.
SQL> grant select on v_$mystat to plustrace;
Grant succeeded.
SQL> connect test/test
Connected.
SQL> set autotrace on
成功!
但以普通用户test登录时,报错:
SQL> connect test/test
Connected.
SQL> set autotrace on
SP2-0613: Unable to verify PLAN_TABLE format or existence
SP2-0611: Error enabling EXPLAIN report
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
检查角色设置
SQL> select * from user_role_privs;
USERNAME GRANTED_ROLE ADM DEF OS_
------------------------------ ------------------------------ --- --- ---
TEST CONNECT NO YES NO
TEST PLUSTRACE NO YES NO
TEST RESOURCE NO YES NO
检查表
SQL> select synonym_name,table_name,table_owner from all_synonyms where synonym_name = 'PLAN_TABLE';
no rows selected
应是表PLAN_TABLE没有赋予plustrace select权限。
SQL> connect system/manager as sydba
Connected.
SQL> create public synonym plan_table for plan_table;
Synonym created.
SQL> grant all on plan_table to public;
Grant succeeded.
再试:
SQL> connect test/test
Connected.
SQL> set autotrace on
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
网上查找,tom说了:
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:5671636641855
Followup:
look up a couple of reviews.
I believe you have slightly mismatched versions of SQLPlus and database.
9203 and up use v$mystat
9202 and before use v$session
9201 client and lower queries v$session
9203 client and higher queries v$mystat
make sure plustrace has select on v$mystat and v$session or use the same version
of sqlplus as database.
我的Oracle server和SQL*Plus的版本都是9.0.2.4.0,找到原因了
SQL> connect system/manager as sydba
Connected.
SQL> grant select on v_$mystat to plustrace;
Grant succeeded.
SQL> connect test/test
Connected.
SQL> set autotrace on
成功!