SP2-0611 and SP2-0618報錯解決

                        SP2-0611 and SP2-0618sql

      今天在作SQL優化器調優準備工做的時候,剛一進去,就碰到一個報錯,成功解決以後整理了下解決思路和解決方法,如今整理成文檔寫出來,以便後面碰到這個問題的技術朋友可以更快的解決問題。若是不正確的地方,還望不吝賜教 。數據庫

 報錯提示: ide

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

 報錯緣由: 測試

  SQL> set autotrace on; 優化

  SP2-0618: 沒法找到會話標識符。啓用檢查 PLUSTRACE 角色 spa

  SP2-0611: 啓用STATISTICS報告時出現錯誤 orm

  該錯誤的的主要緣由是因爲當前用戶下沒有相應的PLUSTRACE角色和相應的權限 ip

 解決方法: 文檔

1.    建立plustrace用戶 get

2.    授予plustrace權限

3.    再次測試set autotrace on是否OK 

詳細步驟:

SQL> conn / as sysdba            <#現以sysdba的角色登陸>

SQL> drop role plustrace;        <#若是數據庫中沒有plustrace這個角色,那麼drop的時候就會報錯,          Role dropped.                             提示沒有這個用戶,那你就新建一個plustrace用戶>

SQL> create role plustrace;

Role created.

SQL> grant select on v_$sesstat to plustrace;

SQL> grant select on v_$statname to plustrace;

SQL> grant select on v_$mystat to plustrace;

SQL> grant plustrace to dba with admin option;

SQL> set echo off;

SQL> grant plustrace to public;

 SQL> conn scott/scott;

Connected.

SQL> set autotrace on;

 

測試結果:

SQL> select * from emp;

      EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO

---------- ---------- --------- ---------- --------- ---------- ---------- ----------

      7369 SMITH      CLERK           7902 17-DEC-80        800                    20

      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30

      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30

      7566 JONES      MANAGER         7839 02-APR-81       2975                    20

      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30

      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30

      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10

      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20

      7839 KING       PRESIDENT            17-NOV-81       5000                    10

      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30

      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20

      EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO

---------- ---------- --------- ---------- --------- ---------- ---------- ----------

      7900 JAMES      CLERK           7698 03-DEC-81        950                    30

      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20

      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10

 14 rows selected.

 Execution Plan

----------------------------------------------------------

Plan hash value: 3956160932

 --------------------------------------------------------------------------

| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |

--------------------------------------------------------------------------

|   0 | SELECT STATEMENT  |      |    14 |   518 |     3   (0)| 00:00:01 |

|   1 |  TABLE ACCESS FULL| EMP  |    14 |   518 |     3   (0)| 00:00:01 |

--------------------------------------------------------------------------

 Statistics

----------------------------------------------------------

        205  recursive calls

          0  db block gets

         46  consistent gets

          0  physical reads

          0  redo size

       1415  bytes sent via SQL*Net to client

        385  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          5  sorts (memory)

          0  sorts (disk)

         14  rows processed

相關文章
相關標籤/搜索