转 Event 'Utl - file I - O' - - CodeAntenna

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

CodeAntenna

转 event 'utl_file I/O':

The ASH report shows tables and data files with wait event 'utl_file I/O':

Utl_file

CHANGES
 No changes.

CAUSE
ASH reports retrieve data from the dba_hist_active_sess_history view. The information in that view is
aggregated from what happened in between each sample from v$active_session_history, which means
that it can potentially include multiple events (such as CPU and I/O events).

In the following example , code is executed that performs CPU and I/O operations in a short period of
time:

alter system flush buffer_cache;


alter system flush shared_pool;

connect system/manager
set time on
set timing on
set serveroutput on
declare
x number;
begin
dbms_output.enable(1000000);
for i in (select s.*,rownum r from dba_source s) loop
 x:=dbms_utility.get_hash_value(i.name,1,163830000);
 if mod(x,99)=0 then 
  dbms_output.put('+');
 else
  dbms_output.put('.');
 end if;
 if mod(i.r,30000)=0 then
  dbms_output.put_line('*');
 end if;
end loop;
end;
/
If we query v$active_session_history, we see:

column event format a30 


column p1p2p3 format a20
select sample_id,NVL(event, 'CPU') AS event,p1||'-'||p2||'-'||p3 p1p2p3,
TM_DELTA_CPU_TIME,TM_DELTA_DB_TIME,DELTA_READ_IO_REQUESTS
from v$active_session_history
where (session_id,SESSION_SERIAL#)=(select sid,serial# from v$session where sid=(select sid from
v$mystat where rownum=1))
order by sample_id
/

  SAMPLE_ID EVENT                          P1P2P3               TM_DELTA_CPU_TIME TM_DELTA_DB_TIME


DELTA_READ_IO_REQUESTS
---------- ------------------------------ -------------------- ----------------- ---------------- ----------------------
    125687 CPU                            1-9720-8                        141978           126117                    311
    125688 CPU                            1-31856-16                     1093833          1105182                    142
    125689 CPU                            1-75808-16                                                                 100
    125690 CPU                            1-77248-16                     2009695          2020332                     66
    125691 CPU                            1-79952-16                                                                  64
Notice that all of the EVENTs listed are CPU events but the PL/SQL must have had to perform I/O. This
I/O is reflected in DELTA_READ_IO_REQUESTS. By looking at the columns p1,p2,p3, it can be found some
residual values from what probably was a 'db file scattered read' where p1 is file_no, p2 block_id , and p3
is blocks.
This is confirmed by looking up those blocks in the data dictionary.

SQL> select segment_name from dba_extents where file_id =1 and 9720 between block_id and
block_id+blocks;

SEGMENT_NAME
---------------------------------------------------------------------------------
SOURCE$

SQL> select segment_name from dba_extents where file_id =1 and 79952  between block_id and
block_id+blocks;
SEGMENT_NAME
---------------------------------------------------------------------------------
SOURCE$
  

SOLUTION
This is expected behavior.

The wait event surfaces when a PL/SQL program is running SQLs and using UTL_FILE in close proximity.
Multiple IOs to the DB and UTL_FILE calls were executed in fast succession and the p1p2p3 sampled
were residual from DB IO events to the datafiles. The "utl_file I/O" event was included as part of the
sample. So when the ASH report is generated, both the "utl_file I/O" event  and the information of
datafiles accessed are present.
转载于 :https://www.cnblogs.com/feiyun8616/p/8329482.html
版权声明:本文为CSDN博主「weixin_34283445」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及
本声明。
原文链接:https://blog.csdn.net/weixin_34283445/article/details/94283938

更多相关推荐

利用UTL_FILE包实现文件I/O操作
数据库 运维 操作系统
摘要:本文主要讨论如何利用Oracle的UTL_FILE包来实现对磁盘文件的I/O操作。 文件I/O对于数据库的开
发来说显得很重要,比如如果数据库中的一部分数据来自于磁盘文件,那么就需要使用I/O接口把数据导
入到数据库中来。...

利用UTL_FILE包实现文件I/O操作
pl/sql 编程 Oracle 应用服务器 SQL Unix F#

文件I/O对于数据库的开发来说显得很重要,比如如果数据库中的一部分数据来自于磁盘文件,那么就需
要使用I/O接口把数据导入到数据库中来。在PL/SQL中没有直接的I/O接口,一般在调试程序时可以使用
Oracle自带的DBMS_OU...
utl_file
[Oracle] - [oracle] file buffer oracle fp object 数据库
这个是从网上看到的,你按这个步骤试下
--
[url=http://ndr666.blog.163.com/blog/static/152991022009103043134903/][/url]Createdirectory 让我们
可以在Oracle数据库中灵活的对文件进行读写操作,极大的提高了Oracle...

UTL_FILE
Oracle UTL_FILE

 createorreplacedirectoryMY_DIRas'E:\javaWP\Ttt';createorreplacedirectoryTO_DIRas'E:\javaWP\Ott'; 查
看目录 select*fromdb...

Oracle UTL_FILE
Oracle oracle file application integer exception dependencies

OracleUTL_FILEVersion10.2 GeneralInformationNote:O/Spermissionsarethoseoftheuser'Oracle'...notthes
chemaownerorconnecteduserSource{ORACLE_HOME}/rdbms/admin/utlfile.sqlFirstAvailability7.3.4Depe
ndencies...

PLSQL UTL_FILE
Oracle PLSQL UTL_FILE

Oracle进行文件夹读写配置1.设定UTL_FILE_DIROracle8i以前oracle\product\10.2.0\admin\AWF\pfile下的
intOracleSid.oraUTL_FILE_DIR='C:/LOG','C:/LOG2' Oracle9i以
后 ALTERSYSTEMSET UTL_FILE_DIR='C:/Log','C:/LOG...

© 2021-2023 All rights reserved by CodeAntenna.com.

You might also like