二十五、SET AUTOTRACE ON 报 CAN NOT SET AUTOTRACE ON错误

版权声明:本文为博主原创文章,未经博主允许欢迎转载,请注明原文链接。一起交流,共同进步。 https://blog.csdn.net/newbie_907486852/article/details/84893393

SET AUTOTRACE ON 报 CAN NOT SET AUTOTRACE ON错误

以下操作建议在sqlPlus中运行。

1、创建plan表

      登陆sys用户,并执行utlxplan.sql脚本,创建plan表

SQL> @F:\OracleServerAndClinet\Server\app\yang\product\11.2.0\dbhome_1\RDBMS\ADMIN\utlxplan.sql

Table created

2、创建plustrace角色

      还是在sys用户下,执行plustrce.sql脚本,数据库启用autotrace功能的安装脚本,主要是创建plustrace角色,并且授权 ,拥有plustrace最主要的目的是为了访问下面几个VIEW :

v_$sesstat;
v_$statname;
v_$mystat;

SQL> @F:\OracleServerAndClinet\Server\app\yang\product\11.2.0\dbhome_1\sqlplus\admin\plustrce.sql
drop role plustrace;
drop role plustrace

ORA-01919: 角色 'PLUSTRACE' 不存在
create role plustrace;

Role created

grant select on v_$sesstat to plustrace;

Grant succeeded

grant select on v_$statname to plustrace;

Grant succeeded

grant select on v_$mystat to plustrace;

Grant succeeded

grant plustrace to dba with admin option;

Grant succeeded

set echo off

3、plustrace角色授予用户

SQL> grant plustrace to scott;

Grant succeeded

SQL> grant all on plan_table to scott; 

Grant succeeded

4、设置自动追踪

set timing on                     #显示执行SQL操作的时间
set linesize 1000                 #输出一行字符个数为100
set autotrace on 		         #设置自动追踪

猜你喜欢

转载自blog.csdn.net/newbie_907486852/article/details/84893393