[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

我们创建plustrace这个角色目的很明确了:

我们在SQL*PLUS上用SET AUTOTRACE ... STATISTICS的时候是通过plustrace这个角色来获取动态性能表信息的。当每一个用户要求使用该命令的时候会自动被DBA用户授予plustrace角色的权限。


参考:http://docs.oracle.com/cd/B10500_01/server.920/a96533/autotrac.htm


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值