/* 作用:由于经常需要在SQL*PLUS查看执行路径,但oracle默认是不支持查看执行路径的,需要我们手工安装环境。
本脚本的目的就是快速安装查看执行计划的环境,并作相关授权。
安装完毕后,数据库的所有用户都可以在SQL*PLUS中使用set autotrace ……
参数:运行该脚本需要输入两个参数:
第一个是目标数据库的sys密码;
第二个参数是指向目标数据库的tnsname,如果连接的是本地数据库,则该参数留空,注意第二个参数要加”@”
作者:suk
本脚本在oracle 9i测试通过 */
–定义变量define pathstr_table=” define pathstr_plustrce=” define utlxplan=’?/rdbms/admin/utlxplan.sql’ define plustrce=’?/sqlplus/admin/plustrce.sql’ –设置变量的新值 column mypathstr_table new_value pathstr_table column mypathstr_plustrce new_value pathstr_plustrce –从库中查询oracle基于什么操作系统,如果是windows,路径层次之间用”,否则用’/’ select replace(‘&utlxplan’,’/’,decode(sign(instr(lower(banner),’windows’)-1),1,”,’/’)) mypathstr_table from (select banner,rownum rn from v$version ) where rn=4;
select replace(‘&plustrce’,’/’,decode(sign(instr(lower(banner),’windows’)-1),1,”,’/’)) mypathstr_plustrce from (select banner,rownum rn from v$version ) where rn=4; –以sys用户连接数据库 conn sys/&the_sys_password&the_tnsname as sysdba –创建PLAN_TABLE @’&pathstr_table’ –创建ROLE @’&pathstr_plustrce’ –授权 create public synonym plan_table for plan_table; grant all on plan_table to public; grant plustrace to public;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/231499/viewspace-63713/,如需转载,请注明出处,否则将追究法律责任。
主题测试文章,只做测试使用。发布者:布吉卡,转转请注明出处:http://www.cxybcw.com/195737.html