[Oracle] SP2-0618: 无法找到会话标识符。启用检查 PLUSTRACE 角色
Posted Jan丶X
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Oracle] SP2-0618: 无法找到会话标识符。启用检查 PLUSTRACE 角色相关的知识,希望对你有一定的参考价值。
一.问题描述
SQL> set autotrace on;
SP2-0618: 无法找到会话标识符。启用检查 PLUSTRACE 角色
SP2-0611: 启用 STATISTICS 报告时出错
二.解决办法
2.1 登录到sys用户,找到$ORACLE_HOME/SQLPLUS/ADMIN/plustrce.sql,执行之,问题自然解决
> sqlplus / as sysdba;
> @$ORACLE_HOME/SQLPLUS/ADMIN/PLUSTRCE.SQL
2.2 我们来看看这plustrace是什么鬼
--
-- 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
以上是关于[Oracle] SP2-0618: 无法找到会话标识符。启用检查 PLUSTRACE 角色的主要内容,如果未能解决你的问题,请参考以下文章