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

本文详细解释了在Oracle环境中遇到自动跟踪功能无法启用的问题,包括错误信息解析、角色需求及如何通过手动创建PLUSTRACE角色来解决此问题。提供了具体的SQL脚本操作步骤,以及如何将此角色授权给普通用户,使其能够使用自动跟踪功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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;

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值