本文发表在 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
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