I wrote a simle SQL script. All user can use Oracle Autotrace after you execute this script. I grant select privilege on some userful view to public, e.g. V$SEESION, V$LATCH and so on. RDBMS_ADMIN_utlxplan.sql was modified from \RDBMS\ADMIN\utlxplan.sql and sqlplus_admin_plustrce.sql was named like this.
Batch File:
SET ORACLE_HM=E:\oracle\product\10.2.0\db_1
SET SYS_PWD=gavin
SET SYSTEM_PWD=%SYS_PWD%
REM create PLAN_TABLE table to get AUTOTRACE working.
sqlplus system/%SYSTEM_PWD% @RDBMS_ADMIN_utlxplan.sql
sqlplus sys/%SYS_PWD% as sysdba @sqlplus_admin_plustrce.sql
RDBMS_ADMIN_utlxplan.sql
create table PLAN_TABLE (
statement_id varchar2(30),
plan_id number,
timestamp date,
remarks varchar2(4000),
operation varchar2(30),
options varchar2(255),
object_node varchar2(128),
object_owner varchar2(30),
object_name varchar2(30),
object_alias varchar2(65),
object_instance numeric,
object_type varchar2(30),
optimizer varchar2(255),
search_columns number,
id numeric,
parent_id numeric,
depth numeric,
position numeric,
cost numeric,
cardinality numeric,
bytes numeric,
other_tag varchar2(255),
partition_start varchar2(255),
partition_stop varchar2(255),
partition_id numeric,
other long,
distribution varchar2(30),
cpu_cost numeric,
io_cost numeric,
temp_space numeric,
access_predicates varchar2(4000),
filter_predicates varchar2(4000),
projection varchar2(4000),
time numeric,
qblock_name varchar2(30),
other_xml clob
);
CREATE OR REPLACE PUBLIC SYNONYM PLAN_TABLE FOR PLAN_TABLE;
GRANT ALL ON PLAN_TABLE TO PUBLIC;
exit
sqlplus_admin_plustrce.sql
drop role plustrace;
create role plustrace;
grant select on v_$sesstat to plustrace;
grant select on v_$statname to plustrace;
grant select on v_$mystat to plustrace;
grant select on v_$session to plustrace;
grant select on v_$latch to plustrace;
grant select on v_$lock to plustrace;
grant select on v_$fixed_table to plustrace;
grant select on v_$parameter to plustrace;
grant plustrace to public;
exit
Recent Comments