Setups Required for the Autotrace Report
To use this feature, the PLUSTRACE role must be granted to the user, such as HR. DBA privileges are required to grant the PLUSTRACE role.Additionally, a PLAN_TABLE table must be created in the user's schema, such as the HR schema. For information on creating the PLAN_TABLE, see "Creating the PLAN_TABLE Output Table".Creating the PLAN_TABLE Output Table
Before issuing an EXPLAIN PLAN statement, you must have a table to hold its output. PLAN_TABLE is the default sample output table into which the EXPLAIN PLAN statement inserts rows describing execution plans. Use the SQL script UTLXPLAN.SQL to create the PLAN_TABLE in your schema. The exact name and location of this script depends on your operating system. On Unix, it is located in the $ORACLE_HOME/rdbms/admin directory.For example, run the commands in Example 9-2 from a SQL*Plus session to create the PLAN_TABLE in the HR schema.Example 9-2 Creating a PLAN_TABLE
CONNECT HR/your_password 
@$ORACLE_HOME/RDBMS/ADMIN/UTLXPLAN.SQL Table created.To create the PLUSTRACE role and grant it to the DBA, run the commands in Example 11-1 from a SQL*Plus session.Example 11-1 Creating the PLUSTRACE Role
CONNECT / AS SYSDBA 
@$ORACLE_HOME/SQLPLUS/ADMIN/PLUSTRCE.SQL drop role plustrace;
Role dropped.
create role plustrace;
Role created.
.
grant plustrace to dba with admin option;
Grant succeeded.
To grant the PLUSTRACE role to the HR user, run the commands in Example 11-2 from a SQL*Plus session.Example 11-2 Granting the PLUSTRACE Role
CONNECT / AS SYSDBA 
GRANT PLUSTRACE TO HR; 
Grant succeeded.