iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
  • 775
分享到

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

2024-04-02 19:04:59 775人浏览 泡泡鱼
摘要

今天新建数据库使用hr用户练习的时候,set autotrace on时出现以下错误是因为没有PLUSTRACE权限涉及到@oracle_HOME/sqlplus/admin/plustrce.sql文件内

今天新建数据库使用hr用户练习的时候,set autotrace on时出现以下错误

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

是因为没有PLUSTRACE权限

涉及到@oracle_HOME/sqlplus/admin/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

1.  查找数据库中是否有该角色

SQL> select * from dba_roles where role='PLUSTRACE';  

no rows selected

 2.建立角色  (使用sys用户)

SQL> @?/sqlplus/admin/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

3.查询数据库

SQL> select * from dba_roles where role='PLUSTRACE';

ROLE			       PASSWord AUTHENTICAT
------------------------------ -------- -----------
PLUSTRACE		       NO	NONE

4.授予操作用户改权限

SQL> grant plustrace to hr;

Grant succeeded.

5.使用hr用户测试是否成功

SQL> conn hr/hr
Connected.
SQL> 
SQL> set autotrace on


您可能感兴趣的文档:

--结束END--

本文标题: SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled

本文链接: https://www.lsjlt.com/news/51890.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作