在oracle11g下面做一个实验的时候发现包这个错:
SQL> set autotrace on
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report
google 发现当前用户权限不够
SQL> grant all on plan_table to u2;
Grant succeeded.
SQL> grant select any dictionary to u2;
Grant succeeded.
再次执行,ok
SQL> set autotrace on
SQL> set timing on
SQL> select owner, count(*) from my_all_objects group by owner;
OWNER COUNT(*)
------------------------------ ----------
WKSYS 840
MDSYS 4896
WK_TEST 36
U2 192
PUBLIC 160218
CTXSYS 534
OLAPSYS 1056
SYSTEM 54
EXFSYS 480
ORDSYS 12606
ORDPLUGINS 30
OWNER COUNT(*)
------------------------------ ----------
XDB 1212
FLOWS_030000 942
SYS 139512
WMSYS 702
15 rows selected.
Elapsed: 00:00:00.22
Execution Plan
----------------------------------------------------------
Plan hash value: 2509106709
--------------------------------------------------------------------------------
------------------
| Id | Operation | Name | Rows | Bytes | Cost
(%CPU)| Time |
--------------------------------------------------------------------------------
------------------
| 0 | SELECT STATEMENT | | 15 | 90 | 1371
(3)| 00:00:17 |
| 1 | RESULT CACHE | 27vtdg9w24wgcb8d23j5h07m2v | | |
| |
| 2 | HASH GROUP BY | | 15 | 90 | 1371
(3)| 00:00:17 |
| 3 | TABLE ACCESS FULL| MY_ALL_OBJECTS | 323K| 1894K| 1348
(1)| 00:00:17 |
--------------------------------------------------------------------------------
------------------
Result Cache Information (identified by operation id):
------------------------------------------------------
1 - column-count=2; dependencies=(U2.MY_ALL_OBJECTS); parameters=(nls); name=
"select owner, count(*) from my_all_objects group by owner"
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
4869 consistent gets
0 physical reads
116 redo size
863 bytes sent via SQL*Net to client
524 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
15 rows processed
SQL>
看来在oracle 11g中不用再使用($ORACLE_HOME/sqlplus/admin/plustrce.sql)脚本创建 plustrace了
记录一下。
没有评论:
发表评论