How to enable the sqlplus AutoTrace function execution plan the following methods can grant the Autotrace permission to Everyone. If you need to restrict the Autotrace permission, you can change the public authorization to the specific user authorization. D: \ oracle \ ora92> sqlplus/nologSQL * Plus: Release9.2.0.1.0-Production on Tuesday June 3 15:16:03 2003 Copyright (c) 1982,2002, Oracle Corporation. all rights reserved. SQL> connect sysas sysdba enter the password: connected. SQL> @? The \ rdbms \ admin \ utlxplan table has been created. SQL> createpublic synonym plan_table for plan_table; the synonym has been created. SQL> grant allon plan_table to public; authorization successful. SQL> @? \ Sqlplus \ admin \ plustrceSQL> SQL> drop role plustrace; drop role plustrace * ERROR is on Row 1st: ORA-01919: role 'plustrace 'does not exist SQL> create roleplustrace; the role has created SQL> grant select on v _ $ sesstat to plustrace; authorization successful. SQL> grantselect on v _ $ statname to plustrace; authorization successful. SQL> grantselect on v _ $ session to plustrace; authorization successful. SQL> grantplustrace to dba with admin option; authorization successful. SQL> set echo off DBA users are first granted the plustrace role, and then we can grant plustrace to public so that all users will have the permissions of the plustrace role. SQL> grantplustrace to public; authorization successful. Then we can use the AutoTrace function. SQL> connecteqsp/eqsp is connected. SQL> set autotrace onSQL> set timing onSQL> description of several common Autotrace options: SET AUTOTRACE OFF ---------------- no AUTOTRACE report is generated, this is the default mode set autotrace on explain ------ AUTOTRACE only displays the optimizer execution path report set autotrace on statistics -- only displays the execution statistics set autotrace on ----------------- contains the execution plan and statistical information set autotrace traceonly ------ same as set autotraceon, however, the query output SQL> set autotracetraceonlySQL> select table_name from user_tables; 98 rows have been selected. Used time: 00: 00: 00.04 Execution Plan limit 0 select statement Optimizer = CHOOSE1 0 NESTED LOOPS2 1 nested loops (OUTER) 3 2 nested loops (OUTER) 4 3 nested loops (OUTER) 5 4 nested loops (OUTER) 6 5 NESTED LOOPS7 6 table access (by index rowid) OF 'obj $'8 7 INDEX (range scan) OF 'I _ OBJ2' (UNIQUE) 9 6 table access (CLUSTER) OF 'tab $'10 9 INDEX (unique scan) OF 'I _ OBJ #' (NON-UNIQUE) 11 5 TABLE ACCESS (BY INDEX ROWID) OF 'obj $'12 11 INDEX (unique scan) OF 'I _ obj1' (UNIQUE) 13 4 INDEX (unique scan) OF' I _ obj1' (UNIQUE) 14 3 table access (CLUSTER) OF 'User $'15 14 INDEX (unique scan) OF' I _ USER # '(NON-UNIQUE) 16 2 TABLE ACCESS (CLUSTER) OF 'seg $'17 16 INDEX (unique scan) OF 'I _ FILE # _ BLOCK #' (NON-UNIQUE) 18 1 TABLE ACCESS (CLUSTER) OF 'ts $'19 18 INDEX (unique scan) OF 'I _ TS #' (NON-UNIQUE) statistics limit 0 recursive calls0 db block limit consistent gets0 physical reads0 redo limit bytes sent via SQL * Net to client569 bytes encoded ed via SQL * Net from client8 SQL * Net roundtrips to/from client0 sorts (memory) 0 sorts (disk) 98 rows processedSQL>