SP2-0618 SP2-0611 ORA-01919 开执行计划错误oracle12c

sql> SET AUTOTRACE ON
SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
sql> conn system/oracle
Connected.
sql> grant PLUSTRACE to adela;
grant PLUSTRACE to adela
      *
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist

解决

drop role c##plustrace;
create role c##plustrace;
grant select on v_$sesstat to c##plustrace;
grant select on v_$statname to c##plustrace;
grant select on v_$mystat to c##plustrace;
grant c##plustrace to c##adela with admin option;

conn c##adela/oracle
set autotrace on

查看下效果

sql> set line 100
sql> select cname from c where cno in (select cno from sc where sno in (select sno from s where sname='adela'));

CNAME
--------------------
OS
C++
Java
DB


Execution Plan
----------------------------------------------------------
Plan hash value: 2310661688

--------------------------------------------------------------------------------------------
| Id  | Operation             | Name       | Rows  | Bytes | Cost (%cpu)| Time       |
--------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT         |           |     1 |    22 |     5   (0)| 00:00:01 |
|   1 |  nesTED LOOPS             |           |       |       |        |       |
|   2 |   nesTED LOOPS             |           |     1 |    22 |     5   (0)| 00:00:01 |
|   3 |    VIEW              | VW_NSO_1    |     2 |    10 |     4   (0)| 00:00:01 |
|   4 |     HASH UNIQUE          |           |     1 |    48 |        |       |
|   5 |      nesTED LOOPS         |           |     2 |    48 |     4   (0)| 00:00:01 |
|*  6 |       TABLE ACCESS FULL      | S       |     1 |    13 |     3   (0)| 00:00:01 |
|*  7 |       INDEX RANGE SCAN         | SC_PK       |     2 |    22 |     1   (0)| 00:00:01 |
|*  8 |    INDEX UNIQUE SCAN         | SYS_C009862 |     1 |       |     0   (0)| 00:00:01 |
|   9 |   TABLE ACCESS BY INDEX ROWID| C       |     1 |    17 |     1   (0)| 00:00:01 |
--------------------------------------------------------------------------------------------

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

   6 - filter("SNAME"='adela')
   7 - access("SNO"="SNO")
   8 - access("CNO"="CNO")

Note
-----
   - dynamic statistics used: dynamic sampling (level=2)
   - this is an adaptive plan


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

ok!

相关文章

这篇文章主要介绍“hive和mysql的区别是什么”,在日常操作中...
这篇“MySQL数据库如何改名”文章的知识点大部分人都不太理解...
这篇文章主要介绍“mysql版本查询命令是什么”的相关知识,小...
本篇内容介绍了“mysql怎么修改字段的内容”的有关知识,在实...
这篇文章主要讲解了“mysql怎么删除unique约束”,文中的讲解...
今天小编给大家分享一下mysql怎么查询不为空的字段的相关知识...