最为常见的直接路径写,多数因为磁盘排序导致。对于这一写入等待,我们应该找到I/O操作最为频繁的数据文件(如果有过多的排序操作,很有可能就是临时文件),分散负载,加快写入操作
SYS@ orcl> select tablespace_name, extent_management from dba_tablespaces;
TABLESPACE_NAME EXTENT_MAN
------------------------------ ----------
SYSTEM LOCAL
SYSAUX LOCAL
UNDOTBS1 LOCAL
TEMP LOCAL
USERS LOCAL
磁盘排序与临时文件
10g中,为了区分特定的对于临时文件的直接读写操作,Oracle对direct path read/write进行了分离,将这类操作分列出来:
SYS@ orcl> select event#, name, wait_class from v$event_name where name like 'direct%';
EVENT# NAME WAIT_CLASS
---------- ---------------------------------------- ---------------
15 direct path sync User I/O
194 direct path read User I/O
195 direct path read temp User I/O
196 direct path write User I/O
197 direct path write temp User I/O
SYS@ orcl> select * from dba_synonyms where synonym_name = 'V$TEMPSEG_USAGE';
OWNER SYNONYM_NAME TABLE_OWNE TABLE_NAME DB_LINK
---------- ------------------ ---------- ---------------- --------
PUBLIC V$TEMPSEG_USAGE SYS V_$SORT_USAGE
为了分离临时文件号和数据文件号,Oracle对临时文件的编号以db_files为起点,所以临时文件的绝对文件号应该等于db_files + file#。
SYS@ orcl> select indx, tfnum, tfafn, tfcsz from x$kcctf;
INDX TFNUM TFAFN TFCSZ
---------- ---------- ---------- ----------
0 1 201 2560
SYS@ orcl> show parameter db_files;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_files integer 200
SYS@ orcl> select file#, rfile#, name from v$tempfile;
FILE# RFILE# NAME
---------- ---------- ----------------------------------------
1 1 /oradata/orcl/temp01.dbf
日志文件相关等待
SYS@ orcl> select name from v$event_name where name like '%log%';
NAME
--------------------------------------------------------------------------------
logout restrictor
LNS ASYNC archive log
LNS ASYNC end of log
log file sequential read
log file single write
log file parallel write
log buffer space
log file switch (checkpoint incomplete)
log file switch (private strand flush incomplete)
log file switch (archiving needed)
switch logfile command
log file switch completion
log file sync
simulated log write delay
LogMiner reader: log (idle)
flashback log file write
flashback log file read
flashback log file sync
Streams capture: waiting for archive log
ges RMS0 retry add redo log
gcs log flush sync
ARCH wait for archivelog lock
MRP wait on archivelog delay
MRP wait on archivelog arrival
MRP wait on archivelog archival
log switch/archive
log file switch (clearing log file)
enq: XR - database force logging
recovery area: computing applied logs
enq: FL - Flashback database log
enq: FD - Flashback logical operations
flashback free VI log
flashback log switch
log write(odd)
log write(even)
log file switch
log file switch主要包含两个子事件log file switch(archiving needed)和log file switch(checkpoint incomplete)。
og file switch(archiving needed),这个等待事件出现时通常是因为日志组循环写满以后,在需要覆盖先前日志时。
log file switch(checkpoint incomplete)。当所有日志组都写满之后,LGWR试图覆盖某个日志文件,如果这时数据库没有完成写出由这个日志文件所保护的脏数据时(检查点未完成),该等待事件出现,这两种情况数据库都会陷于停顿状态。
更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
