Remote DBA team-1Z0-042 Oracle Sga In Nutshell Oracle Dba Learn By Presentation


Published on

1z0-042 Oracle database 10g workshop. Learn by presentation series. Oracle sga in nutshell. Oracle dba training courseware.

Published in: Education, Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Remote DBA team-1Z0-042 Oracle Sga In Nutshell Oracle Dba Learn By Presentation

  1. 1. DBAMETRIX Solutions Present Oracle SGA in a Nutshell
  2. 2. DBA Learn by Presentation series  DBA learning by presentation offered by DBAMETRIX Solutions.  This all presentations have been prepared by Gitesh P Trivedi.  Gitesh Trivedi has work excellent 14 years experience in DBA field and as consultant faculty.  For more details please contact to or or
  3. 3. What is SGA  SGA called as Shared Global Area  It populates in Oracle’s memory region  Size of SGA depends on Granule distribution  Sometime it also called as Shared Memory Area  It populates when Oracle database started
  4. 4. Sub Components of SGA SGA Buffer Cache Log Buffer Shared Pool Java Pool Stream Pool Large Pool Dictionary Cache Library Cache Control Structure Shared SQL Area Locks Latches Execution Plan Parse Tree Private Area Persistent Area Runtime Area
  5. 5. Parameters of SGA  Db_cache_size (Buffer Cache)  Log_buffer (Log Buffer)  Shared_pool_size (Shared Pool)  Java_pool_size (Java Pool)  Large_pool_size (Large Pool)  Stream_pool_size (Stream Pool)
  6. 6. What is granules  With dynamic SGA, the unit of allocation is called a granule  Allocation of SGA components, as unit of granule  Granule size is determined by total SGA size  We can check size of granule from v$sgainfo dynamic view
  7. 7. Size of Granules  It depends on operating system and kernel bit version.  In Oracle 9i, if SGA is smaller than 128 MB than size of granule is 4MB. If more than 128MB than size of granule is 16MB.  From Oracle 10g, if SGA is smaller than 1GB than size of granule is 4MB and bigger for 16MB.  For 32bit Windows platform if SGA is bigger than 128MB than size of granule is 8MB  Expanding size of component of SGA depends on multiple of Granule size
  8. 8. SGA Structure Dict Cache Lib Cache Buffer Cache Log Buffer Con Str Sort Ext Pool Shared Pool Stream Pool Java Pool Large Pool
  9. 9. Database Buffer Cache  For fetching data, Oracle first check in Buffer Cache.  If no found data in Buffer Cache then Oracle fetch data from disk and copy in Buffer Cache for avoiding unnecessary disk I/O.  3 types of Buffers available in Buffer Cache.  Those are free buffers, pinned buffers and dirty buffers.  When Oracle don’t find room for pinning new buffers then dirty buffers are flushed and written in to disk.  For managing these all buffers, Oracle utilizes a least recently used algorithm for flushing buffers in Disk.
  10. 10. Type of Buffer Cache  Multiple Buffer Cache  DEFAULT Buffer Cache db_cache_size  KEEP Buffer Cache db_keep_cache_size  RECYCLE Buffer Cache db_recycle_cache_size  Non standard Buffer Cache also available with parameter db_nK_cache_size where n is 2,4,8,16,32.  In Oracle 8i and prior version parameter was db_block_buffers
  11. 11. How Buffers work All are free Buffers in Buffer Cache
  12. 12. How Buffers work Pinned Buffers in Buffer Cache Free Buffers in Buffer Cache
  13. 13. How Buffers work Pinned Buffers Free Buffers Dirty Buffers
  14. 14. How Buffers work No free Buffers available, all occupied.
  15. 15. How Buffers work Now free Buffers available Dirty Buffers flushed to disk
  16. 16. Log Buffers  Redo log buffer is circular buffer that hold data of changes in database.  Each redo entries contain data about dml/ddl operations.  It is usable to reconstruct data from redo entries.  Periodically Log Writer process writes data from redo log buffer to disk.
  17. 17. How Log buffer works LGWR flushes data from buffer to disk Log Buffer Redo Redo Redo Log Log Log group 1 group 2 group 3
  18. 18. Shared Pool  Information of data dictionary views and privileges stores in Dictionary Cache.  Explain plans, Cursors, Bind variables, store procedures store in Library Cache.  Lock and Latches store in Control structure.  Sort Extent Pool contains mapping of sort segment and sorting information.  There is no separate parameter for any sub components.  Parameter of Shared Pool is shared_pool_size.
  19. 19. How Shared Pool works Raw Cache Library Cache Control Structure Sort extent Pool Tracking sort segment Stores Contains dictionary cursors, Hold locks & data, privileges, PL/SQL latches system data
  20. 20. Managing Shared Pool  Shared pool can be flushed using “alter system flush shared_pool” command.  While flushing shared pool, all objects wipe off and cursors become invalidate. Oracle reparse all cursors after reuse.  If object pinned using dbms_shared_pool.keep, would never flush (after using above command).  Default size of shared pool is 8 MB in 32 bit platform and 64 MB in 64 bit platform.
  21. 21. Large Pool  It contains I/O of server process  It contains memory of Backup & Restore operations  It contains memory for shared server process (mts configuration)  It contains parallel server process and buffers  There is no LRU algorithm to manage request in Large Pool  Parameter is large_pool_size
  22. 22. Java Pool  It handles Java related memories  It contains Java class, definitions and JVM components  It handles request for session specific java code  In Oracle 8i can be disable, but from Oracle 9i it can't due to dependencies like feature of data warehousing (SYS.DBMS_CDC_PUBLISH), export and import etc  It determines from following query from database  SELECT name, bytes FROM V$SGASTAT WHERE pool = 'java pool';  Parameter is java_pool_size
  23. 23. Stream Pool  It uses allocation of memory of stream buffers  If size is greater than 0, then allocates stream in pool. If size is 0 then memory will be allocated in shared pool  Parameter is stream_pool_size
  24. 24. SGA_TARGET (Oracle 10g and higher version)  Introduce in 10g as Automatic Shared Memory Management.  If set nonzero value then Oracle automatically determine and adjust SGA size.  Oracle re-distribute memory allocation when found change of workload.  For re-organization of SGA size, responsible background process is called MMAN (Memory Manager).
  25. 25. Components of SGA_TARGET  Buffer Cache (default)  Log Buffer  Shared Pool  Stream Pool  Java Pool  Large Pool  Manual allocation of buffer pools (keep & recyle)  Manual allocation of Non-standard Buffer Cache ((controlled by DB_nK_CACHE_SIZE, n = {2, 4, 8, 16, 32})
  26. 26. New Automatic Memory Management in Oracle 11g  New parameters memory_target and memory_max_target are introduced.  Whole instance memory automatically managed using these parameters.  It overrides sga_target and pga_target.  If both set then it will be treated as lower bound of memory of same region.  Memory_target is dynamic and memory_max_target is static parameter.  V$memory_target_advice dynamic view for more reference and guidance of same new feture.
  27. 27. Oracle SGA in Nutshell Presented by Gitesh P Trivedi DBAMETRIX Solutions