用scott用户登录,想打开执行计划,报错
C:\Documents and Settings\Administrator>sqlplus scott/scott
SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 5月 30 14:05:56 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> set autotrace on
SP2-0618: 无法找到会话标识符。启用检查 PLUSTRACE 角色
SP2-0611: 启用 STATISTICS 报告时出错。
解决方法:执行plustrce.sql脚本,建立plustrace角色,并赋权给public.
SQL> conn / as sysdba
已连接。
SQL> @utlxplan
SP2-0310: 无法打开文件 "utlxplan.sql"
SQL> @D:\oracle\product\10.2.0\db_1\sqlplus\admin\plustrce
SQL>
SQL> drop role plustrace;
drop role plustrace
*
第 1 行出现错误:
ORA-01919: 角色 'PLUSTRACE' 不存在
SQL> create role plustrace;
角色已创建。
SQL>
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>
SQL> set echo off
SQL> grant plustrace to public
2 ;
授权成功。
SQL> conn scott/scott
已连接。
SQL> set autotrace on ------可以了
SQL> select * from dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
执行计划
----------------------------------------------------------
Plan hash value: 3383998547
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 4 | 80 | 3 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DEPT | 4 | 80 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------
统计信息
----------------------------------------------------------
192 recursive calls
0 db block gets
42 consistent gets
0 physical reads
0 redo size
644 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)
4 rows processed
==========================end==============