set autotrace on時報SP2-0618錯誤的問題解決案例
登陸了資料庫後,想開啟trace,檢查sql語句的執行計劃.在執行set autotrace on命令報SP2-0618的錯誤,如下:
SQL>conn aidu/aidu
connected.
SQL>set autotrace on
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report[@more@]
二. 問題分析
$ oerr sp2 618
00618, 0, "Cannot find the Session Identifier. Check PLUSTRACE role is enabledn"
// *Cause: Unable to find the session identifier.
// *Action: Check that the PLUSTRACE role has been granted.
OERR工具提示檢查PLUSTRACE角色是否存在,於是做下面的檢查
SQL> select role from dba_roles where role like 'PLUS%';
no rows selected
SQL> select * from dba_role_privs where granted_role = 'PLUSTRACE' ;
no rows selected
發現PLUSTRACE 角色不存在,更不存在給找個角色賦了什麼許可權.
出現SP2-0618錯誤的根本原因找到了,就是PLUSTRACE角色沒有建立,相關trace分析的表的訪問許可權沒有賦予當前使用者(aidu)
三. 問題解決
1. 執行$ORACLE_HOME/sqlplus/admin/plustrce.sql ,建立角色,並賦角色許可權
$more $ORACLE_HOME/sqlplus/admin/plustrce.sql
-- 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
SQL> conn / as sysdba
Connected.
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
2. 執行$ORACLE_HOME/rdbms/admin/utlxplan.sql ,建立plan_table表.
$more $ORACLE_HOME/rdbms/admin/utlxplan.sql
......
create table PLAN_TABLE (
statement_id varchar2(30),
plan_id number,
timestamp date,
remarks varchar2(4000),
operation varchar2(30),
......
time numeric,
qblock_name varchar2(30),
other_xml clob
);
SQL> conn / as sysdba
Connected.
SQL> @?/rdbms/admin/utlxplan.sql
Table created.
3. 建立同義詞和賦plan_table訪問許可權給當前使用者(aidu),賦plustrace角色給當前使用者
SQL> create or replace public synonym plan_table for system.plan_table;
Synonym created.
SQL> grant select,update,insert,delete on plan_table to aidu;
Grant succeeded.
SQL> grant plustrace to aidu;
Grant succeeded.
4. 當前使用者登陸,可以開啟autotrace了,OK,問題解決了.
SQL> conn aidu/aidu
Connected.
SQL> set autotrace on;
SQL> select * from dual;
DUM
---
X
Execution Plan
----------------------------------------------------------
Plan hash value: 272002086
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
--------------------------------------------------------------------------
Statistics
----------------------------------------------------------
24 recursive calls
0 db block gets
6 consistent gets
0 physical reads
0 redo size
407 bytes sent via SQL*Net to client
384 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/32980/viewspace-1058066/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- set autotrace on 時報SP2-0618、SP2-0611的解決方法
- 設定autotrace的報錯問題解決
- Oracle autotrace 報 SP2-0618 PLUSTRACE role 問題解決Oracle
- 設定AUTOTRACE以及SP2-0618錯誤
- 解決 ngrok 的 Domain 錯誤問題AI
- 解決fastjson反序列化時報錯的問題ASTJSON
- 使用普通使用者set autotrace on報錯SP2-0618: Cannot find the Session IdentifierSessionIDE
- Set autotrace命令及解釋
- SP2-0618 0611錯誤解決辦法
- 微信支付錯誤兩個問題的解決:curl出錯,錯誤碼:60
- 解決set newname 極慢的問題
- IDEA啟動時報Failed to create JVM錯誤的解決IdeaAIJVM
- 【原創】autotrace中statistics為0的問題的解決
- Oracle 常見的錯誤問題及解決方法Oracle
- exp時報ORA-29275問題解決
- 11G安裝時報SEVERE: [FATAL] 錯誤的解決方法
- Oracle 錯誤總結及問題解決 ORAOracle
- mysql insert語句錯誤問題解決MySql
- 解決python中文編碼錯誤問題Python
- 案例: 解決ORACLE ORA-27211的錯誤Oracle
- 解決儲存過程擷取錯誤的問題儲存過程
- 解決IE上登陸oracle OEM時報:“證書錯誤,導航已阻止”的錯誤Oracle
- opensips建立資料庫時報database engine not specified錯誤的解決資料庫Database
- python問題:IndentationError:expected an indented block錯誤解決PythonErrorBloC
- set autotrace in SQL*PlusSQL
- MSN messenger登入時報防火牆設定錯誤問題Messenger防火牆
- 執行 PHP artisan migrate 時報長度錯誤的解決辦法?PHP
- [Oracle]startup mount時報ORA-12514錯誤的解決方法Oracle
- 這種錯誤怎麼解決??pojoService問題,反射機制問題嗎?POJO反射
- ORA-00230 錯誤解決案例
- ElasticSearch實戰系列十一: ElasticSearch錯誤問題解決方案Elasticsearch
- dblink建立後訪問提示密碼錯誤問題解決密碼
- iOS請求的json資料解析錯誤問題解決iOSJSON
- 工程make時出現"時鐘錯誤的問題"的解決方案
- 以scott使用者執行set autotrace 出錯
- set autotrace on [configure]
- Larabel遷移檔案時報SQLSTATE[42000]錯誤的解決方法SQL
- FTP時報 GSSAPI error major: Unspecified GSS failure,KERBEROS_V4 錯誤的解決FTPAPIErrorAIROS