在Oracle中启用AutoTrace查看SQL执行计划|plsql查看执行计划

通过以下方法可以把Autotrace的权限授予Everyone,

如果你需要限制Autotrace权限,可以把对public的授权改为对特定user的授权。

D:oracleora92>sqlplus /nolog

SQL*Plus: Release 9.2.0.1.0 - Production on 星期二 6月 3 15:16:03 2003

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect sys as sysdba

请输入口令:

已连接。

SQL> [b]@?rdbmsadminutlxplan[/b]

表已创建。

SQL> create public synonym plan_table for plan_table;

同义词已创建。

SQL> grant all on plan_table to public ;

授权成功。

SQL>[b] @?sqlplusadminplustrce[/b]

SQL>

SQL> drop role plustrace;

drop role plustrace

*

ERROR 位于第 1 行:

ORA-01919: 角色"PLUSTRACE"不存在

SQL> create role plustrace;

角色已创建

SQL>

SQL> grant select on v_$sesstat to plustrace;

授权成功。

SQL> grant select on v_$statname to plustrace;