×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

an Oracle question. I am a newbie in Oracle.

本文发表在 rolia.net 枫下论坛In the following article, how to understand that step 5 should happen prior to step 6? I think the rollback segment should be modified after the commitment, otherwise if another user needs to read that piece of data, how can the system get the original data(please note that the real data in the disk has been modified)?

A Simple Write Operation
This example describes a simple write operation, in which one user is writing to a row in the database. In this example, an HR clerk wants to update the name for an employee. Assume that the HR clerk already has the employee record on-screen. The steps from this point are as follows:

1. The client modifies the employee name on the screen. The client process sends a SQL UPDATE statement over the network to the server process.

2. The server process obtains a System Change Number (SCN) and reads the data block containing the target row.

3. The server records row lock information in the data block.

4. The server process copies the old image of the employee data about to be changed to a rollback segment and then modifies the employee data, which includes writing the SCN to the ORA_ROWSCN pseudocolumn with Oracle Database 10g.

5. The server process records the changes to the rollback segment and the database block in the redo log buffer in the SGA. The rollback segment changes are part of the redo, because the redo log stores all changes resulting from the transaction.

6. The HR clerk commits the transaction.

7. Log Writer (LGWR) writes the redo information for the entire transaction, including the SCN that marks the time the transaction was committed, from the redo log buffer to the current redo log file on disk. When the operating system confirms that the write to the redo log file has successfully completed, the transaction is considered committed.

8. The server process sends a message to the client confirming the commit.更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / an Oracle question. I am a newbie in Oracle.
    本文发表在 rolia.net 枫下论坛In the following article, how to understand that step 5 should happen prior to step 6? I think the rollback segment should be modified after the commitment, otherwise if another user needs to read that piece of data, how can the system get the original data(please note that the real data in the disk has been modified)?

    A Simple Write Operation
    This example describes a simple write operation, in which one user is writing to a row in the database. In this example, an HR clerk wants to update the name for an employee. Assume that the HR clerk already has the employee record on-screen. The steps from this point are as follows:

    1. The client modifies the employee name on the screen. The client process sends a SQL UPDATE statement over the network to the server process.

    2. The server process obtains a System Change Number (SCN) and reads the data block containing the target row.

    3. The server records row lock information in the data block.

    4. The server process copies the old image of the employee data about to be changed to a rollback segment and then modifies the employee data, which includes writing the SCN to the ORA_ROWSCN pseudocolumn with Oracle Database 10g.

    5. The server process records the changes to the rollback segment and the database block in the redo log buffer in the SGA. The rollback segment changes are part of the redo, because the redo log stores all changes resulting from the transaction.

    6. The HR clerk commits the transaction.

    7. Log Writer (LGWR) writes the redo information for the entire transaction, including the SCN that marks the time the transaction was committed, from the redo log buffer to the current redo log file on disk. When the operating system confirms that the write to the redo log file has successfully completed, the transaction is considered committed.

    8. The server process sends a message to the client confirming the commit.更多精彩文章及讨论,请光临枫下论坛 rolia.net
    • I think the description here is not very good one. You can read Oracle document, there is a section about transaction, It is very clear.
    • 文档并没有错误。第5步是说在redo log buffer里记录对data buffer cache和rollback segment的操作,并没有真正的写到日志文件中去。只有commit之后,LGRW立即将Redo Log buffer中的内容写进Redo Log File.
      而DBW0并不一定同步写入。这些是Oracle DBA培训关于Admin第1章的内容。(8i经典版)
      我觉得文章说错的一个地方是,Rollback segment 里记录的是before image.而数据的更新是在Data buffer cache中进行的,并不是直接提交到数据文件中的。