生成执行计划

Posted by wukaiqiang; tagged with none

在sql导致的数据库故障中,一般如果需要立即恢复。

需要快速分析执行计划,绑定合理的执行计划,下面是快速操作的记录。

根据v$active_session_history 查看event和sql_id

1、在SecureCRT中启用log跟踪,选择保存的日志文件(后缀html)

在SQLPLUS 中执行

set trimspool on

set arraysize 512

set trim on

set pagesize 0

set linesize 1000

set long 1000000

set longchunksize 1000000

spool sqlmon.html

select /+ noparallel / dbms_sqltune.report_sql_monitor (sql_id=>'input your SQL ID', report_level=>'ALL', type=>'html') from dual;

spool off

cat sqlmon.html

2、spm来绑定合理的执行计划
3、分析执行计划