您的位置:首页 > 数据库 > Oracle

oracle提示SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled

2013-11-23 18:41 393 查看
scott@ORCL> set autotrace on
SP2-0618: Cannot find the Session Identifier. CheckPLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report

sys@ORCL> select * from v$version;

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

PL/SQL Release 11.2.0.1.0 - Production

CORE 11.2.0.1.0 Production

TNS for Linux: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

这是缺少PLUSTRACE 角色的原因,oracle没有自动帮你创建它,但oracle已写好了创建脚本,须要你自己去调用创建。
在$ORACLE_HOME/sqlplus/admin/plustrce.sql
vim $ORACLE_HOME/sqlplus/admin/plustrce.sql

-- the AUTOTRACE feature should be granted thePLUSTRACE role by

-- the DBA.

-- USAGE

-- sqlplus "sys/knl_test7 as sysdba"@plustrce

--

-- Catalog.sql must have been run before this fileis run.

-- This file must be run while connected to a DBAschema.

set echo on

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 plustrace to dba with admin option;

set echo off

所以只要用sys调用一下该脚本便可以
sys@ORCL>@/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/plustrce.sql

现在就可以把该角色授权给普通用户,让他们也能set autotrace on
sys@ORCL> grant plustrace to scott;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: