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

今天是2013-09-17,在今天学习sql执行计划的是发现如下问题:
问题描述:
在rhys用户下开启sql语句计划报如下错误:

SQL> set autotrace on
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
问题分析:
由于该rhys账户没有PLUSTRACE角色导致此问题的产生。
解决办法:
1)查看$ORACLE_HOME/sqlplus/admin下的plustrce.sql发现如下内容:
-- Copyright (c) Oracle Corporation 1995, 2002. All Rights Reserved.
--
-- NAME
-- plustrce.sql
--
-- DESCRIPTION
-- Creates a role with access to Dynamic Performance Tables
-- for the SQL*Plus SET AUTOTRACE ... STATISTICS command.
-- After this script has been run, each user requiring access to
-- the AUTOTRACE feature should be granted the PLUSTRACE role by
-- the DBA.
--
-- USAGE
-- sqlplus "sys/knl_test7 as sysdba" @plustrce
--
-- Catalog.sql must have been run before this file is run.
-- This file must be run while connected to a DBA schema.

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
2)执行该sql创建plustrace角色。
SQL> @./plustrce.sql
SQL>
SQL> drop role plustrace;
drop role plustrace
*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist


SQL> create role plustrace;
Role created.
SQL>
SQL> grant select on v_$sesstat to plustrace;
Grant succeeded.
SQL> grant select on v_$statname to plustrace;
Grant succeeded.
SQL> grant select on v_$mystat to plustrace;
Grant succeeded.
SQL> grant plustrace to dba with admin option;
Grant succeeded.
SQL>

SQL> set echo off

SQL>


SQL> grant plustrace to rhys;
Grant succeeded.

3)登录rhys账户在此开启sql语句分析功能。


SQL> conn rhys/amy

Connected.

SQL> set autotrace on

SQL>

发现该问题得到解决。

~

SQL> r
  1  select ename,job,sal,dname from amy_emp,amy_dept where amy_emp.deptno=amy_dept.deptno
  2  and not exists
  3* (select * from amy_salgrade where amy_emp.sal between losal and hisal)

no rows selected

Execution Plan
----------------------------------------------------------
Plan hash value: 2345751609

----------------------------------------------------------------------------------------------
| Id  | Operation                    | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
----------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT             |               |     1 |    42 |     9  (23)| 00:00:01 |
|   1 |  NESTED LOOPS                |               |     1 |    42 |     9  (23)| 00:00:01 |
|   2 |   NESTED LOOPS               |               |     1 |    42 |     9  (23)| 00:00:01 |
|   3 |    MERGE JOIN ANTI           |               |     1 |    29 |     8  (25)| 00:00:01 |
|   4 |     SORT JOIN                |               |    14 |   294 |     4  (25)| 00:00:01 |
|   5 |      TABLE ACCESS FULL       | AMY_EMP       |    14 |   294 |     3   (0)| 00:00:01 |
|*  6 |     FILTER                   |               |       |       |            |          |
|*  7 |      SORT JOIN               |               |     5 |    40 |     4  (25)| 00:00:01 |
|   8 |       TABLE ACCESS FULL      | AMY_SALGRADE  |     5 |    40 |     3   (0)| 00:00:01 |
|*  9 |    INDEX RANGE SCAN          | REVERSE_INDEX |     1 |       |     0   (0)| 00:00:01 |
|  10 |   TABLE ACCESS BY INDEX ROWID| AMY_DEPT      |     1 |    13 |     1   (0)| 00:00:01 |
----------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

6 - filter("AMY_EMP"."SAL"<="HISAL")
   7 - access(INTERNAL_FUNCTION("AMY_EMP"."SAL")>=INTERNAL_FUNCTION("LOSAL"))
       filter(INTERNAL_FUNCTION("AMY_EMP"."SAL")>=INTERNAL_FUNCTION("LOSAL"))
   9 - access("AMY_EMP"."DEPTNO"="AMY_DEPT"."DEPTNO")

Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          4  consistent gets
          0  physical reads
          0  redo size
        530  bytes sent via SQL*Net to client
        512  bytes received via SQL*Net from client
          1  SQL*Net roundtrips to/from client
          2  sorts (memory)
          0  sorts (disk)
          0  rows processed

SQL>

 

SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled的更多相关文章

  1. 【小错误】SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled

    1.今天在scott用户下执行语句跟踪时报了如下错误: SCOTT@ORA11GR2>set autotrace on SP2: Cannot find the Session Identifi ...

  2. Oracle set autotrace 时提示:Cannot find the Session Identifier. Check PLUSTRACE role is enabled

    SQL> set autotrace Usage: SET AUTOT[RACE] {OFF | ON | TRACE[ONLY]} [EXP[LAIN]] [STAT[ISTICS]] SQL ...

  3. 【ORACLE错误】SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled

    执行set autotrace traceonly的时候,报错 SQL> set autotrace traceonly SP2-0618: Cannot find the Session Id ...

  4. Cannot find the Session Identifier. Check PLUSTRACE role is enable

    解决方法: SQL> conn / as sysdbaConnected.SQL> @$ORACLE_HOME/rdbms/admin/utlxplan.sql; Table create ...

  5. 使用普通用户set autotrace on报错SP2-0618: Cannot find the Session Identifier

    普通用户使用 autotrace,出现如下报错: SQL> set autotrace on SP2-0618: Cannot find the Session Identifier.  Che ...

  6. SP2-0618: Cannot find the Session Identifier.

    [oracle@trade1 ~]$ sqlplus  user1/user1 SQL*Plus: Release 11.2.0.3.0 Production on Tue Aug 6 14:31:1 ...

  7. Linux check whether hyperthreading is enabled or not

    There parameters need to be obained: no. of physical CPU; no. of cores on each CPU; no. of all threa ...

  8. Oracle碎碎念~1

    1. 设置SQL*Plus提示符 SQL> set sqlprompt "_user'@'_connect_identifier>" SYS@orcl> 为了对所 ...

  9. SQL*Plus环境下创建PLUSTRACE角色

    普通用户在SQL*Plus中开启AUTOTRACE报告时,遇到SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is ...

随机推荐

  1. C# 堆栈的数据结构 (二)

    堆栈是一种常用的数据结构,并且是线性表操作的子集,即操作受限的线性表.因此需要用到Clist 线性表类 public class CStack { private Clist m_List;//创建链 ...

  2. sed(转)

    第一部分:sed基础 1)简介 sed 是一种在线编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内 ...

  3. 使用jpeglib库实现bmp转jpg

    一.vc编译jpeglib库 1.下载源代码 下载地址:http://www.ijg.org/.注意:一定要下载win32 版本 2.编译源代码. A.解压源代码,修改源代码中jconfig.vc为j ...

  4. 关于 ls 命令的一个小小的缺陷

    linux 的 ls : ls后边加上要显示的路径时:比方 ls /tmp 它会打印一边 /tmp 下的信息 当ls后边跟上多个同样路径的名字是,它会打印多次同样的信息 比方 ls /tmp /tmp ...

  5. HashMap 的遍历key与value的方法

    HashMap最经常使用的使用方法是依据key增删改查value,有时候会须要知道一个HashMap有多少个keys以及这些keys都是什么,能够用以下的代码实现. 方法1: Map map = ne ...

  6. SharePoint 计时器服务无法启动

    摘要: Microsoft SharePoint Server 2010 使用 Windows SharePoint Services 定时 V4 (SPTimerV4) 服务运行大多数系统任务.服务 ...

  7. asp.net BulletedList样式修改 css

    首先编写一段简单的css脚本 然后呢,在asp:BulletedList中通过 CssClass ="style1"将样式作用到控件上.看看运行效果 注意到上下边框的颜色分别是红色 ...

  8. .net通用权限框架B/S (五)--WEB(3)组织机构

    .net通用权限框架B/S 首先我们看导航菜单中,对组织机构的设置 我们设置了组织机构名称,链接(对应的mvc控制器名/orga),图标是个小钥匙,菜单的操作权限设置的是"添加,编辑,删除& ...

  9. VMware vSphere Client为虚拟机制定物理网卡(图文并茂)

    1.首先,查看我的服务器有几张网卡,如下图共3张,接下来我将为虚拟主机制定一张网卡,以及为当中的两台虚拟的CentOS7各制定一张网卡. 2.打开“硬件”---->“网络”,如图,已经启用一张网 ...

  10. C# - 自定义 DataSet 的使用

    -------------------------------------------------  SellProdectManager.cs  -------------------------- ...