db file parallel write

In Oracle8i Database, the db file parallel write wait event parameters according to the V$EVENT_NAME view are files, blocks, and requests. Starting in Oracle9i Database, the parameters are requests, interrupt, and timeout. However, according to event 10046 trace, the first parameter has always been the block count or the DBWR write batch size. In Oracle Database 10g, this wait event falls under the System I/O wait class. Keep the following key thoughts in mind when dealing with the db file parallel write wait event.

The db file parallel write event belongs only to the DBWR process.

A slow DBWR can impact foreground processes.

Significant db file parallel write wait time is most likely an I/O issue.

Common Causes, Diagnosis, and Actions
The DBWR process performs all database writes that go through the SGA. When it is time to write, the DBWR process compiles a set of dirty blocks and issues system write calls to the operating system. The DBWR process looks for blocks to write at various times, including once every three seconds, when posted by a foreground process to make clean buffers, at checkpoints, when the _DB_LARGE_DIRTY_QUEUE, _DB_BLOCK_MAX_DIRTY_TARGET, and FAST_START_MTTR_TARGET thresholds are met, etc.

Although user sessions never experience the db file parallel write wait event, this doesn’t mean they will not be impacted by it. A slow DBWR process can cause foreground sessions to wait on the write complete waits or free buffer waits events. DBWR write performance can be impacted by, among other things, the type of I/O operation (synchronous or asynchronous), storage device (raw partition or cooked file system), database layout, and I/O subsystem configuration. The key database statistics to look at are the systemwide TIME_WAITED and AVERAGE_WAIT of the db file parallel write, free buffer waits, and write complete waits wait events as they are interrelated.

select event, time_waited, average_wait from   v$system_event where  event in ('db file parallel write','free buffer waits', 'write complete waits');
EVENT                     TIME_WAITED AVERAGE_WAIT------------------------- ----------- ------------free buffer waits              145448   69.8597502write complete waits           107606   101.228598db file parallel write        4046782   13.2329511

Note  Don’t be surprised if the db file parallel write event is absent in your instance. Most likely this is because the DISK_ASYNCH_IO is FALSE. This scenario is normally seen in the HPUX and AIX platforms. Oracle does not consider this to be a bug. However, in the absence of db file parallel write event, Oracle also could not show where the DBWR process is charging its wait time to when waiting for writes to complete. Just because the db file parallel write event is missing, doesn’t mean the DBWR process has no waits.

If the db file parallel write average wait time is greater than 10 centiseconds (or 100ms), this normally indicates slow I/O throughput. You can improve the average wait time in a number of ways. The main one is to use the right kind of I/O operation. If your data files are on raw devices and your platform. supports asynchronous I/O, you should use asynchronous writes. But if your database is on file systems, you should use synchronous writes and direct I/O (this is the operating system direct I/O). There is more discussion on asynchronous and direct I/O later in this section. Besides making sure you are using the right kind of I/O operation, check your database layout and monitor I/O throughput from the operating system using commands such as sar –d or iostat –dxnC. Make sure there is no hot spot.

When the db file parallel write average wait time is high and the system is busy, user sessions may begin to wait on the free buffer waits event. This is because the DBWR process can’t catch up with the demand for free buffers. If the TIME_WAITED of the free buffer waits event is high, you should address the DBWR I/O throughput issue before increasing the number of buffers in the cache. Chapter 7 has more details on the free buffer waits event.

Another repercussion of high db file parallel write average wait time is high TIME_WAITED on the write complete waits wait event. Foreground processes are not allowed to modify the blocks that are in transit to disk. In other words, the blocks that are in the DBWR write batch. They must wait for the blocks to be written and for the DBWR process to clear the bit in the buffer header. The foreground sessions wait on the write complete waits wait event. So the appearance of the write complete waits event is a sure sign of a slow DBWR process. You fix this latency by improving the DBWR I/O throughput.

Note  Beginning in Oracle8i Database, a new cloning algorithm clones the current buffers that are in the DBWR write batch. The newly cloned buffers can be modified while the originals become consistent read (CR) buffers and are written to disk. This reduces the write complete waits latency.

select * from   v$sysstatwhere  name in ('write clones created in foreground',                'write clones created in background');
STATISTIC# NAME                                CLASS   VALUE---------- ----------------------------------- ----- -------        82 write clones created in foreground      8  241941        83 write clones created in background      8    5417

Note  A larger DBWR write batch can also increase the foreground waits on the write complete waits event. This is because the DBWR process will need more time to write a larger batch of blocks, and when this is coupled with poor I/O performance, the result is a high write complete waits. Prior to Oracle8i Database, DBAs tweaked the DB_BLOCK_WRITE_BATCH parameter, which sets the DBWR write batch size. The value can also be seen in the X$KVII view. It is listed as DB writer IO clump. Oracle drastically improved the checkpointing architecture in Oracle8i Database, and DBAs shouldn’t have to mess with the DBWR write batch anymore. Beginning in Oracle8i Database, the write batch size is controlled by the _DB_WRITER_CHUNK_WRITES parameter, and the maximum number of outstanding DBWR I/Os is controlled by the _DB_WRITER_MAX_WRITES parameter. The DBWR write batch size is also revealed by the P1 parameter of the db file parallel write event.

-- Prior to Oracle8i Databaseselect * from x$kvii where kviitag = 'kcbswc';ADDR        INDX  INST_ID  KVIIVAL KVIITAG    KVIIDSC-------- ------- -------- -------- ---------- ----------------------------00E33628       6        1     4096 kcbswc     DB writer IO clump
-- Beginning in Oracle8i Databaseselect * from x$kvii where kviitag in ('kcbswc','kcbscw');ADDR        INDX  INST_ID  KVIIVAL KVIITAG    KVIIDSC-------- ------- -------- -------- ---------- ----------------------------01556808       4        1     4096 kcbswc     DBWR max outstanding writes01556818       6        1      204 kcbscw     DBWR write chunk

Some initialization parameters can increase DBWR checkpoint activities. While a more active DBWR process is beneficial for reducing the number of free buffer waits events, it will not improve the db file parallel write average wait time if the I/O throughput remains slow. It may not even reduce the write complete waits latency. You still need to improve the DBWR average write time. Check the settings of LOG_CHECKPOINT_TIMEOUT, LOG_CHECKPOINT_INTERVAL, FAST_START_IO_TARGET, _DB_BLOCK_MAX_DIRTY_TARGET, and FAST_START_MTTR_TARGET parameters. Starting in Oracle9i Database, you can see if the target recovery time is causing excessive DBWR checkpoint activity (CKPT_BLOCK_WRITES) by querying the V$INSTANCE_RECOVERY view.

So, how can you improve DBWR average write time?

The quick answer is to turn on asynchronous writes if the hardware supports it; if it doesn’t, use synchronous writes and multiple database writer processes. Unfortunately, enabling asynchronous I/O is not as simple as setting the DISK_ASYNCH_IO parameter to TRUE. This means nothing if the operating system does not support asynchronous I/O. The HP-UX operating system supports asynchronous I/O on raw devices only. The Solaris operating system supports asynchronous I/O on both raw devices and file systems. However, on raw devices, it uses the kernel asynchronous I/O (KAIO) system call, but on file systems, it spawns several light-weight processes (LWP) that make synchronous I/O calls (read(), write(), pwrite(), pread(), pwrite64(), pread64()) to simulate asynchronous I/O. The AIX operating system also supports asynchronous I/O on both raw devices and file systems. On raw devices, asynchronous I/O is handled by the kernel (also known as the fastpath AIO), but on file systems, it is handled by AIO servers through kprocs kernel processes. It is beyond the scope of this book to cover what is and is not supported and how to implement asynchronous I/O, as there are many peculiarities. You can get the details from your system administrator, the system engineer of the hardware vendor, or Oracle Support.

It is important to point out that asynchronous I/O is not always faster and better. Asynchronous I/O operations are unstable on some platforms. Synchronous I/O is more reliable. If you see high TIME_WAITED on the async disk IO wait event in the V$SYSTEM_EVENT view or many AIOWAIT in a truss output, it is a good sign that asynchronous I/O is not working well for you. The async disk IO wait event is instrumented in Oracle9i Database. If your entire database is on file systems, you may get better DBWR I/O performance in synchronous mode. The following shows the db file parallel write AVERAGE_WAIT time with and without asynchronous I/O.

-- database on file systems, disk_asynch_io = trueEVENT                          AVERAGE_WAIT------------------------------ ------------db file parallel write          12.8993168
-- the same database on file systems, disk_asynch_io = false,-- db_writer_processes = 4EVENT                          AVERAGE_WAIT------------------------------ ------------db file parallel write          .000908619
Following are our recommendations if your database is on file systems. Before you shut down the database to make the changes, make sure you take a snapshot of the V$SYSTEM_EVENT as a baseline.

Set DISK_ASYNCH_IO parameter to FALSE.

If the operating system supports direct I/O to file systems, set the FILESYSTEMIO_OPTIONS parameter to DIRECTIO, otherwise set it to NONE. This parameter is exposed in Oracle9i Database but hidden in Oracle8i Database.

For vxfs (Veritas file system), ask your system administrator to mount the file system with the MINCACHE=DIRECT option. For ufs (Unix file system), mount the file system with the FORCEDIRECTIO option. Check with your system administrator for the specific direct I/O mount option for your file system.

Spawn multiple DBWR processes with the DB_WRITER_PROCESSES parameter.

Note  If your redo logs are on raw devices but the datafiles are on file systems, you can set the FILESYSTEMIO_OPTIONS to DIRECTIO and DISK_ASYNCH_IO to TRUE. With this, you can get kernel asynchronous I/O to the raw devices and direct I/O to the file systems.

时间: 2024-08-25 16:44:17

db file parallel write的相关文章

消除11.2上的db file parallel read

客户在11.2.0.3环境中进行压力测试,发现出现大量的db file parallel read等待事件.     这个等待是11g以后才出现的,而在11g以前,一般这个等待事件发生在数据文件的恢复过程中.而11g新增了prefetch的特性,也可能导致这个等待事件的产生. 当运行压力测试时,后台的等待事件如下: SQL> select event, count(*) from v$session where username = user group by event order by 2;

ORACLE等待事件: log file parallel write

log file parallel write概念介绍 log file parallel write 事件是LGWR进程专属的等待事件,发生在LGWR将日志缓冲区(log_buffer)中的重做日志信息写入联机重做日志文件组的成员文件,LGWR在该事件上等待该写入过程的完成.该事件的等待表示重做日志所处的磁盘设备缓慢或存在争用.下面看看官方一些资料是如何解释log file parallel write等待事件的.   log file parallel write   Writing red

详解 db file sequential read 等待事件

db file sequential read (本文由thomaswoo_dba翻译,转载请注明出处) db file sequential read 事件有三个参数:file#,first block#, block count, 在oracle 10g里,此等待事件在归于 User I/O wait class 下面的. 处理db file sequential read 事件要牢牢把握下面三个主要思想: 1)oracle 进程需要访问的block不能从SGA 中获取,因此oracle 进

db file async I/O submit 等待事件优化

db file async I/O submit 等待事件优化   一.数据发生db file async I/O submit 我们从数据库awr报告中经常会看到很高db file async I/O submit的等待事件: SQL> select event,wait_class,wait_time from v$session_wait where wait_class<>'Idle' EVENT WAIT_CLASS WAIT_TIME --------------------

db file sequential read 详解

db file sequential read (本文由thomaswoo_dba翻译,转载请注明出处) db file sequential read 事件有三个参数:file#,first block#, block count, 在oracle 10g里,此等待事件在归于 User I/O wait class 下面的. 处理db file sequential read 事件要牢牢把握下面三个主要思想:1)oracle 进程需要访问的block不能从SGA 中获取,因此oracle 进程

常识之外:全表扫描为何产生大量 db file sequential read 单块读?

原创 2016-07-05 熊军 Oracle   编辑手记:在理解Oracle技术细节时,我们不仅应该读懂概念,还要能够通过测试验证细节,理解那些『功夫在诗外』的部分,例如全表扫描和单块读. 开发人员在进行新系统上线前的数据校验测试时,发现一条手工执行的 SQL 执行了超过1小时还没有返回结果.SQL 很简单: 下面是这条 SQL 的真实的执行计划: 很显然,在这个表上建 billing_nbr 和 start_date 的复合索引,这条 SQL 就能很快执行完(实际上最后也建了索引).但是这

db file sequential read及优化

db file sequential read:直接路径读:   官方说明如下: This event signifies that the user process is reading a buffer into the SGA buffer cache and is waiting for a physical I/O call to return. A sequential read is a single-block read. Single block I/Os are usuall

Resolving Issues Where Application Queries are Waiting Too Frequently for &#039;db file sequential read&#039;

昨天有篇"db file sequential read"的介绍,还有一篇类似的:Resolving Issues Where Application Queries are Waiting Too Frequently for 'db file sequential read' Operations (文档 ID 1475825.1) 诊断"db file sequential read"的步骤: 简述: 低效的SQL会引起不同节点间非常多的块读. 问题确认: 花

High Waits on &#039;Db File Sequential Read&#039; Due to Table Lookup Following Index Access

最近某些系统AWR的top 5中"Db File Sequential Read"占据的时间百分比非常大,通常这种等待事件是一种正常的.但当前系统性能是有些问题的,并发量大,有些缓慢,因此需要判断这种等待事件是否能够减少.MOS有几篇关于这种等待事件的介绍,这是其中一篇. High Waits on 'Db File Sequential Read' Due to Table Lookup Following Index Access (文档 ID 875472.1) 即使执行计划已经