1 / 71

Oracle Database Workshop 1

Oracle Database Workshop 1. Presented to IBRI CAS 27-Nov-2011 By Abdullah Alkalbani. Workshop Objectives. Describe Oracle Database (10g). Identify high-level architectural components of an Oracle Database. Identify Oracle Database internal data structures.

kenna
Download Presentation

Oracle Database Workshop 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Oracle DatabaseWorkshop 1 Presented to IBRI CAS 27-Nov-2011 By Abdullah Alkalbani

  2. Workshop Objectives • Describe Oracle Database (10g). • Identify high-level architectural components of an Oracle Database. • Identify Oracle Database internal data structures. • Define the mechanisms used when processing Insert/Update/Delete statements. • Describe DBMS programs used with Oracle Database.

  3. 10g provides better ways to administer your database. “It takes the mountain out of the mole hill”.

  4. 9i Mountains = More effort and resources to accomplish similar tasks in 10g • 10g Mole Hills = Less effort and resources to accomplish similar tasks in 9i.

  5. Popular Features • Automatic Shared Memory Management (ASMM) • Data Pump • SQL Tuning Advisor • Flashback Database • RMAN - Backupset Compression

  6. Most people call it a “Database” Technically an Oracle Database is broken into two high-level components • INSTANCE – Non-persistent, memory-based processes and structures • DATABASE – Persistent, disk-based data and control files

  7. Instance Database So Why Differentiate? Most Oracle installations consist of only a single “Instance” and single “Database”…

  8. Instance 1 Instance 2 Instance 3 Database Oracle RAC is Different Oracle “Real Application Clusters” allow multiple “Instances” to interact with a single “Database” to provide high availability…

  9. “Instance” a Little Closer An Oracle Instance… • Is a means to access an Oracle Database • Always opens one and only one Database • Consists of memory and background process structures

  10. Instance SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Picture of an “Instance” MemoryStructures Back-GroundProcesses

  11. “Database” a Little Closer An Oracle Database… • Is a collection of data that is treated as a unit • Consists of three file types

  12. Oracle Database Redo Log Files Control Files Data Files Picture of a “Database” ParameterFile ArchivedLog Files PasswordFile

  13. Instance SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Picture of an “Instance” MemoryStructures Back-GroundProcesses

  14. Memory Structure Oracle’s memory structure consists of two memory areas known as: • System Global Area (SGA): Allocated at instance start up, and is a fundamental component of an Oracle Instance • Program Global Area (PGA): Allocated when the server process is started

  15. System Global Area • The SGA consists of several memory structures: • Shared Pool • Database Buffer Cache • Redo Log Buffer • Other structures • There are two additional memory structures that can be configured within the SGA: • Large Pool • Java Pool

  16. System Global Area • The size of the SGA is determined by the parameters that set the sizes of the various pools; these parameters are dynamic • The SGA_MAX_SIZE parameter sets the maximum size of the SGA (so you can limit it) and is not a dynamic parameter Thanks Ned!

  17. Instance SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Picture of an “Instance” MemoryStructures Back-GroundProcesses

  18. Shared Pool • Used to store: • Most recently executed SQL statements • Most recently used data definitions • It consists of two key performance-related memory structures: • Library Cache • Data Dictionary Cache • Sized by the parameter SHARED_POOL_SIZE

  19. Library Cache • Stores information about the most recently used SQL and PL/SQL statements • Enables the sharing of commonly used statements • Is managed by a least recently used (LRU) algorithm • Consists of two structures • Shared SQL area • Shared PL/SQL area • Size is determined by the Shared Pool sizing

  20. Instance SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Picture of an “Instance” MemoryStructures Back-GroundProcesses

  21. Data Dictionary Cache • A collection of the most recently used definitions in the database • Includes information about database files, tables, indexes, columns, users, privileges, and other database objects • During the parse phase, the server process looks at the data dictionary for information to resolve object names and validate access

  22. Database Buffer Cache • Stores copies of data blocks that have been retrieved from the data files • Enables great performance gains when you obtain and update data • Managed through an LRU algorithm • DB_BLOCK_SIZE determines primary block size

  23. Instance SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Picture of an “Instance” MemoryStructures Back-GroundProcesses

  24. Redo Log Buffer • Records all changes made to the database data blocks • Primary purpose is recovery • Changes recorded within are called redo entries • Redo entries contain information to reconstruct or redo changes • Size defined by LOG_BUFFER

  25. Large Pool • An optional area of memory in the SGA • Relieves the burden place on the Shared Pool • Used for: • Session memory for the Shared Server • I/O server processes • Backup and restore operations for RMAN • Does not use an LRU list • Sized by LARGE_POOL_SIZE • Can be dynamically resized

  26. Java Pool • Services parsing requirements for Java commands • Required if installing and using Java • Sized by JAVA_POOL_SIZE parameter

  27. Oracle “Process” Structure • Oracle takes advantage of various types of Processes: • User Process: Started at the time a database user requests connection to the Oracle Server • Server Process: Connects to the Oracle instance and is started when a user establishes a session • Background Processes: Started when an Oracle instance is started

  28. User Process • A program that requests interaction with the Oracle server • Must first establish a connection • Does not interact directly with the Oracle server UserProcess ServerProcess ConnectionEstablished

  29. Server Process • A program that directly interacts with the Oracle server • Fulfills calls generated and returns results • Can be dedicated or shared server

  30. Instance SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Picture of an “Instance” MemoryStructures Back-GroundProcesses

  31. Background Processes • Maintains and enforces relationships between physical and memory structures • Mandatory background processes: DBWn PMON CKPT LGWR SMON • Optional background processes: ARCn LMDn QMNn CJQ0 LMON RECO Dnnn LMS Snnn LCKn Pnnn

  32. Instance Shared Pool SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache Oracle Database DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Redo Log Files Control Files Data Files Database Writer (DBWn) DBWn writes when: • Checkpoint occurs • Dirty buffers reach threshold • There are no free buffers • Timeout occurs • Tablespace OFFLINE • Tablespace READ ONLY • Table DROP or TRUNCATE • Tablespace BEGIN BACKUP

  33. Instance SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache Oracle Database DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Redo Log Files Control Files Data Files Log Writer (LGWR) LGWR writes: • At commit • When one-third full • When there is 1 MB of redo • Every three seconds • Before DBWn writes

  34. Instance Shared Pool SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache Oracle Database DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Redo Log Files Control Files Data Files System Monitor (SMON) Responsibilities: • Instance recovery • Rolls forward changes in online redo log files • Opens database for user access • Rolls back uncommitted transactions • Coalesces free space • Deallocates temporary segments

  35. Instance Shared Pool SGA Shared Pool Redo LogBuffer LibraryCache Oracle Database DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Redo Log Files Control Files Data Files Process Monitor (PMON) Cleans up after failed processes by: • Rolling back the transaction • Releasing locks • Releasing other resources • Restarting dead dispactchers Database BufferCache

  36. Instance SGA Shared Pool Database BufferCache Redo LogBuffer LibraryCache Oracle Database DataDictionaryCache Java Pool Large Pool PMON SMON DBWR LGWR CKPT Others Redo Log Files Control Files Data Files Checkpoint (CKPT) Responsible for: • Signaling DBWn at checkpoints • Updating datafile headers with checkpoint information • Updating control files with checkpoint information Shared Pool

  37. Oracle Database Redo Log Files Control Files Data Files Archiver (ARCn) • Optional background process • Automatically archives online redo log files when ARCHIVELOG mode is set • Preserves the record of all changes made to the database Archived Logs ARCn

  38. Oracle Data Storage Oracle keeps all system and user data in two basic storage containers: • Tablespace… a logical entity known only to Oracle • Data Files… physical files that may (typically) be seen from the operating system

  39. Tablespaces • Can belong to only one database at a time • Consist of one or more data files • Are further divided into logical units of store

  40. Data Files • Can belong to only one tablespace and one database • Are a repository for schema object data Database Tablespace DataFile DataFile

  41. 2 Types of Tablespace • Tablespaces required by Oracle for normal operations • Tablespaces that contain data and indexes that support your applications

  42. Required Tablespaces • System – Contains the Oracle Data Dictionary • Sysaux - New to 10g; supports historic monitoring / tuning • Temporary – Used for disk-based sorting of data (select...from…order by) • Undo – Used for transaction consistency during Insert / Update / Delete statements

  43. SQL Statements (IUDS) • Insert • Update • Delete • Select What happens when someone connects to the database and issues one of these statements?

  44. UserProcess ServerProcess Connect User/Pwd Connect to Oracle – What Happens • Are “User” definition and privileges in SGA “Dictionary Cache”? • If not, try to fetch from the “System” tablespace • If there, validate Pwd and privileges to login • Allow connection if all is right; otherwise decline connection

  45. “Select” – What Happens First? Select * From MyTab Order by 1; • Is this statement in the “Library Cache”? • If statement cached then it has been recently been “parsed” and “executed” • If not cached then “parse” the statement • If cached then skip parsing stage and execute statement

  46. “Select” – Parsing the Statement Select * From MyTab Order by 1; • Does “MyTab” exist? • Does user have Privs to select from “MyTab” • What columns are in “MyTab” • What is the first column in “MyTab”

  47. “Select” – Executing the Statement Select * From MyTab Order by 1; • Is “MyTab” data in the SGA “Buffer Cache”? • If not, fetch data into Buffer Cache • Sort data in “MyTab” by the first column • If can sort records in memory then do so • If cannot sort in memory then use “Temporary” tablespace as disk-based staging area • Return records to client process

  48. “I/U/D” – What Happens First? Insert (a,b,c) Into MyTab; • Is this statement in the “Library Cache”? • If statement cached then it has been recently been “parsed” and “executed” • If not cached then “parse” the statement • If cached then skip parsing stage and execute statement

  49. “I/U/D” – Executing the Statement Insert (a,b,c) Into MyTab; • Validate values to be inserted • Execute the statement • Keep DB version of the record in “Undo” tablespace until Commit or Rollback • Record changes in SGA “Redo Log Buffer” • Change records in SGA “Buffer Cache” • DBWn writes changed records to data file(s) as part of buffer cache management

  50. “I/U/D” – Executing the Statement Insert (a,b,c) Into MyTab; Commit; or Rollback; • If “Commit” then… • LGWn writes “Redo Log Buffer” entries to “Redo Logs” • Undo entries are invalidated • If “Rollback” then… • Migrate DB version of record in Undo back to tablespace/data file

More Related