oracle 重要的等待事件
buffer busy waits等待事件 orcale的等待事件列表可以从v$event_name中查看完整的等待事件列表 buffer busy waits Wait occurs when a session attempts to access a block in memory, is denied and must wait until the buffer becomes available. This ev
buffer busy waits等待事件
orcale的等待事件列表可以从v$event_name中查看完整的等待事件列表
buffer busy waits
Wait occurs when a session attempts to access a block in memory, is denied and must wait until the buffer becomes available. This event happens because a buffer is either being read into the buffer cache by another session (and the session is waiting for that read to complete) or the buffer is in the buffer cache, but in a incompatible mode (that is, some other session is changing the buffer).
--当一个会话需要读取一个数据块,但这个数据块正在被另一个会话读取到内存中时。
--当一个会话视图修改一个数据块,但这个数据块正在被另一个会话修改时。
Solutions
Buffer busy waits often occur in the following cases:
- Inefficient SQL statements read more blocks than necessary. If there are many sessions running these statements, they will attempt to read the same blocks and possibly wait on this event.
- If the FREELISTS parameter for a table is too low, multiple sessions that are attempting to insert rows in the same table and end up waiting for freelists. This problem shows up as contention for the segment header of the table.
- Multiple sessions are attempting to change an index block (possibly do to an insert).
- The INITRANS parameters is too low for a segment. Any DML operation that needs to go into the block needs to lock an Interested Transaction List (ITL). If INITRANS parameter is set too low, then there will be less number of ITLs allocated originally. Oracle can only allocate more ITLs if there is space in PCTFREE area of the block. If, however, there is no space to increase the ITL, the transactions that cannot lock ITLs will have to wait until the previous transactions have completed operations on the block. The waiter will register ‘buffer busy wait’ for the block.
find the table or indexes waited for. Once the database object is known, consider the following causes of contention and their solutions.
Waits on Data blocks
Data blocks are the blocks that actually hold the row data in a table or index.
Problem: Multiple sessions are requesting a block that is either not in cache or in an incompatible mode.
Solution 1: Tune inefficient queries. Inefficient queries read too many blocks into the buffer cache. These queries could flush out blocks that may be useful for other sessions in the buffer cache. By tuning queries, the number of blocks that need to be read into the cache is reduced, reducing aging out of the existing “good” blocks in the cache.
Solution 2: Delete some of the hot rows and insert them back into the table. Most of the time, the rows will be place in a different block. The DBA may need to adjust pctfree and/or pctused to ensure the rows are placed into a different block.
Solution 3: Cache the table or keep the table in the KEEP POOL. When multiple sessions are requesting the blocks that reside in the disk, it takes too much time for a session to read it into the buffer cache. Other session(s) that need the same block will register ‘buffer busy wait’. If the block is already in buffer cache, however, this possibility is eliminated. Another alternative is to increase the buffer cache size. A larger buffer cache means less I/O from disk. This reduces situations where one session is reading a block from the disk subsystem and other sessions are waiting for the block.
Solution 4: Look for ways to reduce the number of low cardinality indexes. A low cardinality index is an index on a column(s) with a relatively low number of unique values such as a U. S. state column that has only fifty unique values. Low cardinality indexes could result in excessive block reads. Concurrent DML operations on low cardinality columns could also cause contention on a few index blocks.
Waits on Segment Header blocks
Each segment has one segment header block.
Problem: At times, this block can be a point of contention which manifests itself as a buffer busy wait. This occurs especially when multiple sessions are attempting to insert into or delete from the same table.
Solution 1: When sessions insert rows into a block, the block must be taken out of the freelist if the PCTFREE threshold reached. When sessions delete rows from a block, the block will be put back in the freelist if PCTUSED threshold is reached. If there are a lot of blocks coming out of the freelist or going into it, all those sessions have to make that update in the freelist map in the segment header. This can cause contention for the segment header block which manifests itself as ‘buffer busy wait’. One solution to this problem is to create multiple freelists. This will allow different insert streams to use different freelists and thus update different freelist maps. This reduces contention on the segment header block. You should also look into optimizing the PCTUSED/PCTFREE parameters so that the blocks don’t go in and out of the freelists frequently.
Solution 2: Increase the size of the extents. If extents are too small, Oracle must constantly allocate new extents causing contention in the extent map
Solution 3: Increase the undocumented database parameter, _bump_highwater_mark_count, from the default of 5. Updating the high water mark on the table can become a bottleneck.
Expanded Definition
Wait until a buffer becomes available. This event happens because a buffer is either being read into the buffer cache by another session (and the session is waiting for that read to complete) or the buffer is in the buffer cache, but in a incompatible mode (that is, some other session is changing the buffer).

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

Oracle 打不开的解决办法包括:1. 启动数据库服务;2. 启动监听器;3. 检查端口冲突;4. 正确设置环境变量;5. 确保防火墙或防病毒软件未阻止连接;6. 检查服务器是否已关闭;7. 使用 RMAN 恢复损坏的文件;8. 检查 TNS 服务名称是否正确;9. 检查网络连接;10. 重新安装 Oracle 软件。

在 Oracle 中删除所有数据需要以下步骤:1. 建立连接;2. 禁用外键约束;3. 删除表数据;4. 提交事务;5. 启用外键约束(可选)。请务必在执行前备份数据库,以防数据丢失。

解决 Oracle 游标关闭问题的方法包括:使用 CLOSE 语句显式关闭游标。在 FOR UPDATE 子句中声明游标,使其在作用域结束后自动关闭。在 USING 子句中声明游标,使其在关联的 PL/SQL 变量关闭时自动关闭。使用异常处理确保在任何异常情况下关闭游标。使用连接池自动关闭游标。禁用自动提交,延迟游标关闭。

Oracle 中,FOR LOOP 循环可动态创建游标, 步骤为:1. 定义游标类型;2. 创建循环;3. 动态创建游标;4. 执行游标;5. 关闭游标。示例:可循环创建游标,显示前 10 名员工姓名和工资。

Oracle 数据库分页利用 ROWNUM 伪列或 FETCH 语句实现:ROWNUM 伪列用于通过行号过滤结果,适用于复杂查询。FETCH 语句用于获取指定数量的第一行,适用于简单查询。

要停止 Oracle 数据库,请执行以下步骤:1. 连接到数据库;2. 优雅关机数据库(shutdown immediate);3. 完全关机数据库(shutdown abort)。

可以通过使用 Oracle 的动态 SQL 来根据运行时输入创建和执行 SQL 语句。步骤包括:准备一个空字符串变量来存储动态生成的 SQL 语句。使用 EXECUTE IMMEDIATE 或 PREPARE 语句编译和执行动态 SQL 语句。使用 bind 变量传递用户输入或其他动态值给动态 SQL。使用 EXECUTE IMMEDIATE 或 EXECUTE 执行动态 SQL 语句。

在CentOS系统上搭建Hadoop分布式文件系统(HDFS)需要多个步骤,本文提供一个简要的配置指南。一、前期准备安装JDK:在所有节点上安装JavaDevelopmentKit(JDK),版本需与Hadoop兼容。可从Oracle官网下载安装包。环境变量配置:编辑/etc/profile文件,设置Java和Hadoop的环境变量,使系统能够找到JDK和Hadoop的安装路径。二、安全配置:SSH免密登录生成SSH密钥:在每个节点上使用ssh-keygen命令
