Register Login

How does Update Statement Works in Architecture Level?

Updated Jun 17, 2018

Hello Experts,

I have this query

How does update statement works in architecture level?

please share your valuable thoughts.

 

 


Comments

  • 21 Jul 2015 12:25 pm Guest Best Answer

    Sqlplus scott/tiger@prod

    SQL>select * from emp;

    SQL>update emp set sallary=30000 where empid=10;

    SQL>commit;

    So we will understand what is happening internaly

    1. Once we hit sqlplus statement as above client process(user) access sqlnet listener.
    2. Sql net listener confirms that DB is open for buisness & create server process.
    3. Server process allocates PGA.
    4. ‘Connected’ Message returned to user.
    5. SQL>select * from emp;
    6. Server process checks the SGA to see if data is already in buffer cache.
    7. If not then data is retrived from disk and copied into SGA (DB Cache).
    8. Data is returned to user via PGA & server process.
    9. Now another statement is   SQL>Update emp set sallary=30000 where empid=10;
    10. Server process (Via PGA) checks SGA to see if data is already there in buffer cache.
    11. In our situation chances are the data is still in the SGA (DB Cache).
    12. Data updated in DB cache and mark as ‘Dirty Buffer’.
    13. Update employee placed into redo buffer.
    14. Row updated message returned to user
    15. SQL>commit;
    16. Newest SCN obtained from control file.
    17. Data in DB cache is marked as ‘Updated and ready for saving’.
    18. commit palced into redo buffer.
    19. LGWR writes redo buffer contents to redo log files & remove from redo buffer.
    20. Control file is updated with new SCN.
    21. Commit complete message return to user.
    22. Update emp table in datafile & update header of datafile with latest SCN.
    23. SQL>exit;
    24. Unsaved changes are rolled back.
    25. Server process deallocates PGA.
    26. Server process terminates.
    27. After some period of time redo log are archived by ARCH process.  
  • 03 Mar 2015 5:53 pm Abhijeet Mudgal Helpful Answer

    First you read DB Architecture..In Architecture read carefully Redo & Undo role...Rest thing you can understand..If you fire Update statement

    1.background process check permission of user,statement syntax.

    2. update database as u fire command.

    3. save old value or New Value with time stamp.

    4. after commit command save your updated data in your Physical storage..I hope u under stand.

  • 21 Jul 2015 12:26 pm ArunKumar A

    Sqlplus scott/tiger@prod

    SQL>select * from emp;

    SQL>update emp set sallary=30000 where empid=10;

    SQL>commit;

    So we will understand what is happening internaly

    1. Once we hit sqlplus statement as above client process(user) access sqlnet listener.
    2. Sql net listener confirms that DB is open for buisness & create server process.
    3. Server process allocates PGA.
    4. ‘Connected’ Message returned to user.
    5. SQL>select * from emp;
    6. Server process checks the SGA to see if data is already in buffer cache.
    7. If not then data is retrived from disk and copied into SGA (DB Cache).
    8. Data is returned to user via PGA & server process.
    9. Now another statement is   SQL>Update emp set sallary=30000 where empid=10;
    10. Server process (Via PGA) checks SGA to see if data is already there in buffer cache.
    11. In our situation chances are the data is still in the SGA (DB Cache).
    12. Data updated in DB cache and mark as ‘Dirty Buffer’.
    13. Update employee placed into redo buffer.
    14. Row updated message returned to user
    15. SQL>commit;
    16. Newest SCN obtained from control file.
    17. Data in DB cache is marked as ‘Updated and ready for saving’.
    18. commit palced into redo buffer.
    19. LGWR writes redo buffer contents to redo log files & remove from redo buffer.
    20. Control file is updated with new SCN.
    21. Commit complete message return to user.
    22. Update emp table in datafile & update header of datafile with latest SCN.
    23. SQL>exit;
    24. Unsaved changes are rolled back.
    25. Server process deallocates PGA.
    26. Server process terminates.
    27. After some period of time redo log are archived by ARCH process.  

×