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

解决SQL*Plus AUTOTRACE权限问题
本文介绍了解决在Oracle数据库中使用SQL*Plus的AUTOTRACE功能时遇到的权限问题的方法。通过创建PLUSTRACE角色并为用户分配此角色,可以顺利启用AUTOTRACE功能。

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


是因为没有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

-- A start job for unit iscsi.service has finished with a failure. -- -- The job identifier is 2343 and the job result is failed. Apr 01 15:59:31 iscsi systemd[1]: Starting Login and scanning of iSCSI devices... -- Subject: A start job for unit iscsi.service has begun execution -- Defined-By: systemd -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- A start job for unit iscsi.service has begun execution. -- -- The job identifier is 2537. Apr 01 15:59:31 iscsi iscsiadm[22805]: iscsiadm: default: 1 session requested, but 1 already present. Apr 01 15:59:31 iscsi iscsiadm[22805]: iscsiadm: default: 1 session requested, but 1 already present. Apr 01 15:59:31 iscsi iscsiadm[22805]: iscsiadm: default: 1 session requested, but 1 already present. Apr 01 15:59:31 iscsi iscsiadm[22805]: iscsiadm: default: 1 session requested, but 1 already present. Apr 01 15:59:31 iscsi iscsiadm[22805]: iscsiadm: Could not log into all portals Apr 01 15:59:31 iscsi systemd[1]: iscsi.service: Main process exited, code=exited, status=15/n/a -- Subject: Unit process exited -- Defined-By: systemd -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- An ExecStart= process belonging to unit iscsi.service has exited. -- -- The process' exit code is 'exited' and its exit status is 15. Apr 01 15:59:31 iscsi systemd[1]: iscsi.service: Failed with result 'exit-code'. -- Subject: Unit failed -- Defined-By: systemd -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- The unit iscsi.service has entered the 'failed' state with result 'exit-code'. Apr 01 15:59:31 iscsi systemd[1]: Failed to start Login and scanning of iSCSI devices. -- Subject: A start job for unit iscsi.service has failed -- Defined-By: systemd -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- A start job for unit iscsi.service has finished with a failure. -- -- The job identifier is 2537 and the job result is failed.
最新发布
04-02
<think>好的,我现在要解决用户提到的iscsi.service启动失败的问题,错误信息是exit-code 15,并且提示iscsiadm无法登录所有门户。首先,我需要回顾一下用户提供的引用内容,特别是引用[2]和[3],因为它们涉及iscsiadm命令和ACL配置。 首先,引用[2]显示用户曾经成功登出iscsi目标,但问题现在发生在启动时登录失败。可能的原因包括目标不可达、认证问题或配置错误。引用[3]提到不同主机验证不通过时需要将主机的initiatorname.iscsi中的WWNN添加到目标的ACL列表中,这可能是一个关键点。 接下来,我需要考虑可能的原因和对应的检查步骤。首先检查网络连通性,确保iSCSI目标IP和端口可达。然后检查iscsiadm的配置是否正确,包括目标IQN、IP和端口。接着,检查ACL设置,确认initiator的WWNN是否被允许访问目标。此外,查看日志文件,如journalctl或/var/log/messages,以获取更详细的错误信息。 另外,系统单元启动失败可能有依赖性问题,检查iscsi.service的依赖是否正确安装和启动,比如iscsid.service。最后,可能需要重新发现目标或更新节点信息,以确保配置是最新的。 需要逐步指导用户执行这些检查步骤,确保每一步都清晰易懂,并针对可能的错误提供解决方案。同时,结合用户提供的引用内容,强调ACL配置的重要性,并提醒检查initiatorname.iscsi文件中的名称是否正确,以及是否正确添加到目标的ACL中。</think>### iSCSI服务启动失败解决方案 针对iscsi.service启动失败并报错"exit-code 15"的问题,按照以下步骤排查: 1. **检查网络连通性** - 使用命令验证目标端口可达性: ```bash telnet 172.25.254.238 3260 ``` 若连接失败,需检查防火墙规则: ```bash firewall-cmd --list-all | grep 3260 ``` 若未开放端口,需执行: ```bash firewall-cmd --add-service=iscsi-target --permanent firewall-cmd --reload ``` 2. **验证iSCSI配置** - 检查发现门户配置: ```bash iscsiadm -m discovery -t st -p 172.25.254.238 ``` 输出应包含类似内容: ``` 172.25.254.238:3260,1 iqn.2018-06.com.example:storagel ``` 3. **检查ACL配置** 根据引用[3],确认客户端启动器名称已添加到目标服务器ACL: - 查看本机启动器名称: ```bash cat /etc/iscsi/initiatorname.iscsi ``` 输出示例: ``` InitiatorName=iqn.2023-09.com.example:client1 ``` - 在目标服务器配置中添加该IQN到ACL列表 4. **手动登录验证** 使用引用[2]中的命令测试手动登录: ```bash iscsiadm -m node -T iqn.2018-06.com.example:storagel -p 172.25.254.238 -l ``` 若失败,观察具体报错: - CHAP认证失败:检查`/etc/iscsi/iscsid.conf`中的用户名密码 - 目标不存在:确认目标IQN正确性 5. **查看详细日志** ```bash journalctl -u iscsi.service -xe ``` 重点关注包含"Could not log into all portals"的上下文信息 6. **服务依赖检查** 验证依赖服务状态: ```bash systemctl status iscsid.service ``` 若未运行,需先启动: ```bash systemctl start iscsid && systemctl enable iscsid ``` **典型解决方案流程**: ```bash # 刷新节点信息 iscsiadm -m node --op=delete -T iqn.2018-06.com.example:storagel iscsiadm -m discovery -t st -p 172.25.254.238 iscsiadm -m node -T iqn.2018-06.com.example:storagel -p 172.25.254.238 -l # 确认成功后重启服务 systemctl restart iscsi ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值