set autotrace on; SP2-0618: 無法找到會話標識符。啟用檢查 PLUSTRACE 角色 SP2-0611: 啟用 STATIST..."/>
溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

【Oracle】SP2-0618: 無法找到會話標識符。啟用檢查 PLUSTRACE 角色

發(fā)布時間:2020-07-05 02:24:20 來源:網(wǎng)絡(luò) 閱讀:938 作者:yongjian1092 欄目:關(guān)系型數(shù)據(jù)庫

一.錯誤描述



SQL> set autotrace on;
SP2-0618: 無法找到會話標識符。啟用檢查 PLUSTRACE 角色
SP2-0611: 啟用 STATISTICS 報告時出錯


二.解決辦法



2.1 登錄到sys用戶,找到$ORACLE_HOME/SQLPLUS/ADMIN/plustrce.sql,執(zhí)行之

> sqlplus / as sysdba
> @$ORACLE_HOME/SQLPLUS/ADMIN/PLUSTRCE.SQL

2.2 我們打開plustrce.sql看看里面是個什么鬼

--
-- 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

我們創(chuàng)建plustrace這個角色目的很明確了:

我們在SQL*PLUS上用SET AUTOTRACE ... STATISTICS的時候是通過plustrace這個角色來獲取動態(tài)性能表信息的。當每一個用戶要求使用該命令的時候會自動被DBA用戶授予plustrace角色的權(quán)限。


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


向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI