当前位置: 首页 > news >正文

set autotrace报错

报错:

SQL> set autotrace traceonly
SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report

原因分析:

根据上面的错误提示“SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled”我们知道是****因为PLUSTRACE角色没有授权给该用户导致的****

解决办法:

重新创建PLUSTRACE用户

SQL> conn / as sysdba
Connected.
SQL> select * from dba_role_privs where granted_role='SQL> conn / as sysdba
Connected.
SQL> select * from dba_role_privs where granted_role='PLUSTRACE';no rows selectedSQL> @?/sqlplus/admin/plustrce.sql
SQL> 
SQL> drop role plustrace;
drop role plustrace*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not existSQL> 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> ';no rows selectedSQL> @?/sqlplus/admin/plustrce.sql
SQL> 
SQL> drop role plustrace;
drop role plustrace*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not existSQL> 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> 

发现sys用户执行成功,但是scott用户执行还是失败

SQL> conn / as sysdba
Connected.
SQL> set autotrace traceonly;
SQL> conn scott/oracle
Connected.
SQL> set autotrace traceonly;
SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
SP2-061

将统计信息视图权限赋予scott

grant select on v_$sesstat to SCOTT;
grant select on v_$statname to SCOTT;
grant select on v_$mystat to SCOTT;

再次执行成功

SQL>  set autotrace traceonly;
SQL> 
http://www.xdnf.cn/news/273907.html

相关文章:

  • K8S的使用(部署pod\service)+安装kubesphere图形化界面使用和操作
  • 【机器学习案列-22】基于线性回归(LR)的手机发布价格预测
  • 【iOS】消息流程探索
  • 基于python的task--时间片轮询
  • 为了结合后端而学习前端的学习日志——【黑洞光标特效】
  • VMware-centOS7安装redis分布式集群
  • 《Java高级编程:从原理到实战 - 进阶知识篇五》
  • 统计学中的p值是什么?怎么使用?
  • Ray开源程序 是用于扩展 AI 和 Python 应用程序的统一框架。Ray 由一个核心分布式运行时和一组用于简化 ML 计算的 AI 库组成
  • 初识 iOS 开发中的证书固定
  • flink常用算子整理
  • QT | 常用控件
  • 个人文章不设置vip
  • MySQL复合查询全解析:从基础到多表关联与高级技巧
  • 【Hive入门】Hive与Spark SQL深度集成:Metastore与Catalog兼容性全景解析
  • 视频转GIF
  • 网狐系列三网通新钻石娱乐源码全评:结构拆解、三端实测与本地部署问题记录
  • ResNet改进(37):DenseBlock模块实现
  • 游戏引擎学习第257天:处理一些 Win32 相关的问题
  • 【Python】一直没搞懂迭代器是什么。。
  • 【Linux】SELinux 的基本操作与防火墙的管理
  • C++负载均衡远程调用学习之上报功能与存储线程池
  • QT对象树
  • C++日志系统实现(二)
  • 三种方式存图分别输出“无向无权图”的“DFS序列”
  • 【PostgreSQL数据分析实战:从数据清洗到可视化全流程】3.2 缺失值检测与处理(NULL值填充/删除策略)
  • Spring MVC设计与实现
  • Win10下安装Linux-Ubuntu24.04双系统
  • 通讯协议开发实战:从零到一打造企业级通信解决方案
  • 第三方组件库:element-uiiviewVant