执行计划查看

查看执行计划的方法:sql

1:set autotrace onit

若是出现错误:须要重建plustrce角色;io

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionstable

SQL> @?/sqlplus/admin/plustrce.sql
SQL>
SQL> drop role plustrace;
drop role plustrace
*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not existselect


SQL> create role plustrace;方法

Role created.统计

SQL>
SQL> grant select on v_$sesstat to plustrace;db

Grant succeeded.tab

SQL> grant select on v_$statname to plustrace;di

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

SQL> drop role plustrce;
drop role plustrce
*
ERROR at line 1:
ORA-01919: role 'PLUSTRCE' does not exist

SQL> create role plustrce;

Role created.

 

SQL> grant select on v_$sesstat to plustrce;

Grant succeeded.

SQL> grant select on v_$statname to plustrce;

Grant succeeded.

SQL> grant select on v_$mystat to plustrce;

Grant succeeded.

SQL> grant plustrce to dba with admin option;

Grant succeeded. 

SQL> set echo off
SQL> grant plustrce to scott;

Grant succeeded.

 

set autotrace on/off  【开启关闭】

set autotrace explain/statistics  【只显示执行计划/只显示统计信息】

set autotrace traceonly  【显示统计信息和执行计划,可是不显示执行结果】

 

2:explain plan for SQL;

select * from table(dbms_xplan.diaplay);

select plan_table_output from table(dbms_xplan.display('plan_table'));

 

3:10046

相关文章
相关标签/搜索