[20191223]Wait for Java.txt --//链接:https://jonathanlewis.wordpress.com/2019/12/18/wait-for-java/,重复测试. 1.环境: @ ver1 2.测试脚本: --//java_wait_for_cpu.sql rem rem Script: java_wait_for_cpu.sql rem Author: Jonathan Lewis rem Dated: Nov 2019 rem rem Last tested rem 19.3.0.0 rem 12.2.0.1 rem rem Based on an email from Jack van Zanen to Oracle-L rem set time on create or replace procedure milli_sleep(i_milliseconds in number) as language java name 'java.lang.Thread.sleep(int)'; / set pagesize 60 set linesize 132 set trimspool on column sample_time format a32 column event format a32 column sql_text format a60 column sql_id new_value m_sql_id set echo on execute milli_sleep(1e4) select sample_time, sample_id, session_state, sql_id, event from v$active_session_history where session_id = sys_context('userenv','sid') and sample_time > sysdate - 1/1440 order by sample_time ; select sql_id, round(cpu_time/1e6,3) cpu_time, round(elapsed_time/1e6,3) elapsed, sql_text from v$sql where sql_id = '&m_sql_id'; --//输出如下: SCOTT@book> @ n1.txt Procedure created. 08:52:41 SCOTT@book> execute milli_sleep(1e4) PL/SQL procedure successfully completed. 08:52:52 SCOTT@book> 08:52:52 SCOTT@book> select 08:52:52 2 sample_time, sample_id, session_state, sql_id, event 08:52:52 3 from 08:52:52 4 v$active_session_history 08:52:52 5 where 08:52:52 6 session_id = sys_context('userenv','sid') 08:52:52 7 and sample_time > sysdate - 1/1440 08:52:52 8 order by 08:52:52 9 sample_time 08:52:52 10 ; SAMPLE_TIME SAMPLE_ID SESSION SQL_ID EVENT -------------------------------- ---------- ------- ------------- -------------------------------- 2019-12-23 08:52:42.545 5076973 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:43.555 5076974 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:44.555 5076975 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:45.555 5076976 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:46.555 5076977 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:47.555 5076978 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:48.555 5076979 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:49.555 5076980 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:50.555 5076981 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:51.565 5076982 ON CPU 4tbmywxw2ndt1 2019-12-23 08:52:52.565 5076983 ON CPU 6tp6b74pup4jw 11 rows selected. 08:52:52 SCOTT@book> 08:52:52 SCOTT@book> select sql_id, round(cpu_time/1e6,3) cpu_time, round(elapsed_time/1e6,3) elapsed, sql_text from v$sql where sql_id = '&m_sql_id'; old 1: select sql_id, round(cpu_time/1e6,3) cpu_time, round(elapsed_time/1e6,3) elapsed, sql_text from v$sql where sql_id = '&m_sql_id' new 1: select sql_id, round(cpu_time/1e6,3) cpu_time, round(elapsed_time/1e6,3) elapsed, sql_text from v$sql where sql_id = '6tp6b74pup4jw' SQL_ID CPU_TIME ELAPSED SQL_TEXT ------------- ---------- ---------- ------------------------------------------------------------ 6tp6b74pup4jw .04 .04 select sample_time, sample_id, session_state, sql_id , event from v$active_session_history where session_id = sys_context('userenv','sid') and sample_tim e > sysdate - 1/1440 order by sample_time --//最后的输出有点问题: 08:52:52 SCOTT@book> select sql_id, round(cpu_time/1e6,3) cpu_time, round(elapsed_time/1e6,3) elapsed, sql_text from v$sql where sql_id = '4tbmywxw2ndt1'; SQL_ID CPU_TIME ELAPSED SQL_TEXT ------------- ---------- ---------- ------------------------------------------------------------ 4tbmywxw2ndt1 .222 10.656 BEGIN milli_sleep(1e4); END; --//可以发现CPU_TIME仅仅消耗.222.
[20191223]Wait for Java.txt
来源:这里教程网
时间:2026-03-03 14:43:40
作者:
编辑推荐:
- [20191223]Wait for Java.txt03-03
- 2011-12-01 SQL注入的防备03-03
- 修改表名时遇到ORA-14047错误03-03
- S.C.EXPORTS.R.L MCUP-5003-03
- RAC环境单节点启动数据库报ORA-2970203-03
- 2011-11-4 LEAST函数03-03
- 2011-11-8 包变量的初始化03-03
- 2011-11-7 包和包体的删除语法03-03
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- RAC环境单节点启动数据库报ORA-29702
RAC环境单节点启动数据库报ORA-29702
26-03-03 - Oracle 19c和20c新特性最全解密
Oracle 19c和20c新特性最全解密
26-03-03 - 手机APP为什么要获取这3个权限?能不能随意授权呢?看完就知道了
手机APP为什么要获取这3个权限?能不能随意授权呢?看完就知道了
26-03-03 - Serverless 实战 —— 函数计算 + Typescript 实践
- 分布式事务 GTS 的价值和原理浅析
分布式事务 GTS 的价值和原理浅析
26-03-03 - 从零开始入门 | Kubernetes 中的服务发现与负载均衡
从零开始入门 | Kubernetes 中的服务发现与负载均衡
26-03-03 - 原来华为手机不亮屏也能看时间,点击这个按钮,30秒即可开启
原来华为手机不亮屏也能看时间,点击这个按钮,30秒即可开启
26-03-03 - 阿里云视频云正式支持AV1编码格式 为视频编码服务降本提效
阿里云视频云正式支持AV1编码格式 为视频编码服务降本提效
26-03-03 - 等保2.0正式实施,阿里云发布全国首个《阿里公共云用户等保2.0合规能力白皮书》
- 阿里云小程序营收3步曲:一年发展3家加盟+2家直营
阿里云小程序营收3步曲:一年发展3家加盟+2家直营
26-03-03
