Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

How does Update Statement Works in Architecture Level?

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarKiran Dalvi
  • 13 Sep, 2023
  • 0 Comments
  • 1 Min Read

How does Update Statement Works in Architecture Level?

How does Update Statement Works in Architecture Level?

1
2
3
4
Sqlplus sys/oracle@prim
SQL>select * from emp;
SQL>update emp set salary=50000 where empid=40;
SQL>commit;

So now  we will understand How update statement works internally.

  1. Once we hit sqlplus statement client process(user) access sqlnet listener.
  2. Sql net listener confirms that DB is open & 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 salary=50000 where empid=40;

  1. Server process (Via PGA) checks SGA to see if data is already there in buffer cache.
  2. In our situation chances are the data is still in the SGA (DB Cache).
  3. Data updated in DB cache and mark as ‘Dirty Buffer’.
  4. Update employee placed into redo buffer.
  5. Row updated message returned to user
  6. SQL>commit;
  7. New SCN obtained from control file.
  8. Data in DB cache is marked as ‘Updated and ready for saving’.
  9. commit placed into redo buffer.
  10. LGWR writes redo buffer contents to redo log files & remove from redo buffer.
  11. Control file is updated with new SCN.
  12. Commit complete message return to user. 
  13. Update emp table in datafile & update header of datafile with latest SCN.
  14. exit from SQL prompt. 
  15. Unsaved changes are rolled back.
  16. Server process deallocates PGA.
  17. Server process terminates.
  18. After some time redo log are archived by ARCH process. 

Hope it Helps!