Posts Tagged ‘SQL statement execution’

As promise in Oracle 9i Architecture post here is new post for how SQL statement processe internaly. This is for them those whi are planning to start career as Oracle DBA. If they want to make clear picture of Oracle Architecture then first of all they need to understand how sql statement procees in oracle.These are the statement which we are going to run.

Sqlplus scott/tiger@prod

SQL>select * from emp;

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


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.    

Hope you guy’s enjoy this post.Very soon I wil come up with Parsing & execution as well.

Experts are always welcome for their valuable comment or suggestion for the above post.

Related Post:


Read Full Post »