• [ORALCE]SQL 优化案例之 10046事件,查看硬解析


    1.开启10046事件

    drop table TX1 purge;
    create table TX1 (x int);
    set linesize 266
    set pagesize 5000
    alter system flush shared_pool;
    alter system flush buffer_cache;
    alter session set events '10046 trace name context forever,level 12';

    2.批量硬解析操作

    begin
        for i in 1..100000
        loop 
            execute immediate
            'insert into TX1 values ('||i||')';
        end loop;
        commit;
    end;
    /

    3.关闭10046事件

    alter session set events '10046 trace name context off';

    4.查看生成trace 文件

    SQL> select tracefile from v$process where addr in (select paddr from v$session where sid in (select sid from v$mystat));
    
    TRACEFILE
    --------------------------------------------------------------------------------
    /oracle/D4C/diag/rdbms/d4cdb/D4C/trace/D4C_ora_10115.trc

    5.通过tkpro 生成文件

    [oracle@d4cdb trace]$ tkprof D4C_ora_10115.trc hardparasenosys.txt aggregate=yes sys=no waits=yes sort=fchela
    
    TKPROF: Release 19.0.0.0.0 - Development on Fri May 8 21:30:54 2020
    
    Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.
    
    [oracle@d4cdb trace]$ ls -ltr hardparasenosys.txt 
    -rw-r--r-- 1 oracle oinstall 3893 May  8 21:37 hardparasenosys.txt

    6.查看tkpro 生成文件,可以看到由于没有绑定变量产生了很多PARSE.

  • 相关阅读:
    php7.1安装
    nginx 的限制连接模块limit_zone与limit_req_zone
    selinux导致docker启动失败
    docker学习笔记
    kvm虚拟机
    ZooKeeper在线迁移
    启动EMQ(emqtt)时报错找不到libsctp.so.1
    Linux Samba服务主配文件smb.conf中文详解
    python-day7-字符串类型的内置方法
    python-day7-数字类型的内置方法
  • 原文地址:https://www.cnblogs.com/tingxin/p/12853562.html
Copyright © 2020-2023  润新知