Les 01 Arch

3,585 views

Published on

Oracle DBA Interview Questions and Answers, CBT, Oracle E-books, Certifications http://oracledba-interview.blogspot.com

  • Be the first to comment

Les 01 Arch

  1. 1. Database Architecture and ASM
  2. 2. Objectives <ul><li>After completing this lesson, you should be able to: </li></ul><ul><ul><li>Describe the Oracle Database architecture </li></ul></ul><ul><ul><li>Describe Automatic Storage Management (ASM) </li></ul></ul><ul><ul><li>Set up initialization parameter files for ASM and database instances </li></ul></ul><ul><ul><li>Start up and shut down ASM instances </li></ul></ul><ul><ul><li>Administer ASM disk groups </li></ul></ul>
  3. 3. The Oracle Database <ul><li>The Oracle Relational Database Management System (RDBMS) is a database management system that provides an open, comprehensive, integrated approach to information management. </li></ul>
  4. 4. Oracle Database Architecture: Overview Database Data files Online redo log files Control files Database buffer cache Shared pool Data dictionary cache Library cache PMON SMON Others Server process PGA Archived log files User process Instance ARCn SGA DBWn Redo log buffer LGWR CKPT
  5. 5. Connecting to the Database <ul><ul><li>Connection: Communication between a user process and an instance </li></ul></ul><ul><ul><li>Session: Specific connection of a user to an instance through a user process </li></ul></ul>SQL> Select … Session Connection USER User
  6. 6. Oracle Database Server Structures Database PMON SMON Others Data files Online redo log files Control files Instance ARC n DBW n LGWR CKPT Storage structures Memory structures Processes Database buffer cache Shared pool Data dict. cache Library cache SGA Redo log buffer User process Server process
  7. 7. Oracle Memory Architecture SGA Database buffer cache Redo log buffer Java pool Streams pool Shared pool Large pool PGA PGA PGA Background process Server process 1 Server process 2 Shared SQL area Library cache Data Dictionary cache Other I/O Buffer Response queue Request queue Free memory
  8. 8. Oracle Memory Architecture Full Notes Page
  9. 9. Process Architecture <ul><ul><li>User process: </li></ul></ul><ul><ul><ul><li>Is started when a database user or a batch process connects to Oracle Database </li></ul></ul></ul><ul><ul><li>Database processes </li></ul></ul><ul><ul><ul><li>Server process: Connects to the Oracle instance and is started when a user establishes a session </li></ul></ul></ul><ul><ul><ul><li>Background processes: Are started when an Oracle instance is started </li></ul></ul></ul>PMON SMON Others Instance ARC n DBW n LGWR CKPT PGA User process Server process Background processes Database buffer cache Shared pool Data dictionary cache Library cache SGA Redo log buffer
  10. 10. Process Structures … Server n processes SGA … Oracle background processes PMON SMON Others RECO ARC n DBW n LGWR CKPT Server Server Server Server Server Database buffer cache Shared pool Data dict. cache Library cache SGA Redo log buffer
  11. 11. Process Structures Full Notes Page
  12. 12. Database Storage Architecture Online redo log files Password file Parameter file Archived redo log files Control files Data files Alert log and trace files Backup files
  13. 13. Database Storage Architecture Full Notes Page
  14. 14. Logical and Physical Database Structures Database Logical Physical Tablespace Data file OS block Segment Extent Oracle data block Schema
  15. 15. Database Structures Full Notes Page
  16. 16. Tablespaces and Data Files <ul><ul><li>Tablespaces consist of one or more data files. </li></ul></ul><ul><ul><li>Data files belong to only one tablespace. </li></ul></ul>USERS tablespace Data file 1 Data file 2
  17. 17. SYSTEM and SYSAUX Tablespaces <ul><ul><li>The SYSTEM and SYSAUX tablespaces are mandatory tablespaces. </li></ul></ul><ul><ul><li>They are created at the time of database creation. </li></ul></ul><ul><ul><li>The SYSTEM tablespace is used for core functionality (for example, data dictionary tables). </li></ul></ul><ul><ul><li>The auxiliary SYSAUX tablespace is used for additional database components (such as the Enterprise Manager Repository). </li></ul></ul>
  18. 18. Segments, Extents, and Blocks <ul><ul><li>Segments exist within a tablespace. </li></ul></ul><ul><ul><li>Segments are made up of a collection of extents. </li></ul></ul><ul><ul><li>Extents are a collection of data blocks. </li></ul></ul><ul><ul><li>Data blocks are mapped to disk blocks. </li></ul></ul>Segment Extents Data blocks Disk blocks
  19. 19. Database Architecture: Summary of Structural Components <ul><ul><li>Memory structures: </li></ul></ul><ul><ul><ul><li>System Global Area (SGA): Database buffer cache, redo buffer, and various pools </li></ul></ul></ul><ul><ul><ul><li>Program Global Area (PGA) </li></ul></ul></ul><ul><ul><li>Process structures: </li></ul></ul><ul><ul><ul><li>User process and server process </li></ul></ul></ul><ul><ul><ul><li>Background processes: SMON, PMON, DBW n , CKPT, LGWR, ARC n , and so on </li></ul></ul></ul><ul><ul><li>Storage structures: </li></ul></ul><ul><ul><ul><li>Logical: Database, schema, tablespace, segment, extent, and Oracle block </li></ul></ul></ul><ul><ul><ul><li>Physical: data files, control files, and redo log files </li></ul></ul></ul>
  20. 20. Automatic Storage Management: Review <ul><ul><li>Portable and high-performance cluster file system </li></ul></ul><ul><ul><li>Manages Oracle database files </li></ul></ul><ul><ul><li>Data spread across disks to balance load </li></ul></ul><ul><ul><li>Integrated mirroring across disks </li></ul></ul><ul><ul><li>Solves many storage management challenges </li></ul></ul>ASM File system Volume manager Operating system Application Database
  21. 21. Automatic Storage Management: Review Full Notes Page
  22. 22. ASM: General Architecture ASM instance SID=+ASM ASM disks ASM disks ASM disk group 1 DB instance SID= SALES ASMB RBAL ARB 0 ARB A … ASM disks ASM disks ASM disks ASM disk group 2 ASM disks DBW 0 RBAL FG GMON
  23. 23. Creating an ASM Instance
  24. 24. ASM Instance Initialization Parameters INSTANCE_TYPE = ASM DB_UNIQUE_NAME = +ASM ASM_POWER_LIMIT = 1 ASM_DISKSTRING = ' /dev/rdsk/*s2 ' , ' /dev/rdsk/c1* ' ASM_DISKGROUPS = dgroupA, dgroupB SPFILE = ' +DATA/ORCL/orclspfile.ora_1 '
  25. 25. Starting Up an ASM Instance $ export ORACLE_SID='+ASM' $ sqlplus /nolog SQL> CONNECT / AS sysasm Connected to an idle instance. SQL> STARTUP; Total System Global Area 284565504 bytes Fixed Size 1299428 bytes Variable Size 258100252 bytes ASM Cache 25165824 bytes ASM diskgroups mounted
  26. 26. SYSASM Role <ul><ul><li>SYSASM role to manage ASM instances avoids overlap between DBAs and storage administrators </li></ul></ul><ul><ul><li>For ASM instances, SYSDBA will be deprecated in the future: </li></ul></ul><ul><ul><ul><li>Oracle Database 11 g Release 1 behaves as in 10 g </li></ul></ul></ul><ul><ul><ul><li>In future releases SYSDBA privileges restricted in ASM instances </li></ul></ul></ul>SQL> CONNECT / AS SYSASM SQL> CREATE USER ossysasmusername IDENTIFIED by passwd; SQL> GRANT SYSASM TO ossysasmusername ; SQL> DROP USER ossysasmusername ; SQL> CONNECT ossysasmusername / passwd AS SYSASM;
  27. 27. Accessing an ASM Instance Disk group Disk group Storage system As SYSASM or SYSDBA As SYSOPER ASM instance All operations Limited operations
  28. 28. Using Enterprise Manager to Manage ASM Users
  29. 29. Shutting Down an ASM Instance SHUTDOWN NORMAL ASM instance Database instance A Database instance B 1 1 2 3
  30. 30. ASM Storage: Concepts Database Tablespace Segment Extent Oracle block Data file Physical block ASM disk group ASM disk ASM file Allocation unit File-system file or raw device
  31. 31. ASM Disk Group <ul><ul><li>Is a pool of disks managed as a logical unit </li></ul></ul><ul><ul><li>Partitions total disk space into uniform sized units </li></ul></ul><ul><ul><li>Spreads each file evenly across all disks </li></ul></ul><ul><ul><li>Uses coarse- or fine-grain striping on the basis of file type </li></ul></ul><ul><ul><li>Administers disk groups, not files </li></ul></ul>Disk group ASM instance
  32. 32. ASM Disk Group Full Notes Page
  33. 33. Failure Group Controller 1 Controller 2 Failure group 1 Failure group 2 Disk group A Controller 3 Failure group 3 1 7 13 1 7 13 1 7 13 1 7 13 1 7 13 1 7 13 1 7 13 1 7 13 1 7 13 2 3 4 5 6
  34. 34. Disk Group Mirroring <ul><ul><li>Mirror at AU level </li></ul></ul><ul><ul><li>Mix primary and mirror AUs on each disk </li></ul></ul><ul><ul><li>External redundancy: Defers to hardware mirroring </li></ul></ul><ul><ul><li>Normal redundancy: </li></ul></ul><ul><ul><ul><li>Two-way mirroring </li></ul></ul></ul><ul><ul><ul><li>At least two failure groups </li></ul></ul></ul><ul><ul><li>High redundancy: </li></ul></ul><ul><ul><ul><li>Three-way mirroring </li></ul></ul></ul><ul><ul><ul><li>At least three failure groups </li></ul></ul></ul>
  35. 35. Disk Group Dynamic Rebalancing <ul><ul><li>Automatic online rebalance whenever storage configuration changes </li></ul></ul><ul><ul><li>Only move data proportional to storage added </li></ul></ul><ul><ul><li>No need for manual I/O tuning </li></ul></ul><ul><ul><li>Online migration to new storage </li></ul></ul><ul><ul><li>Configurable load on system using ASM_POWER_LIMIT </li></ul></ul>
  36. 36. Managing Disk Groups CREATE DISKGROUP ALTER DISKGROUP DROP DISKGROUP ASM instance Database instance
  37. 37. Creating and Dropping Disk Groups CREATE DISKGROUP dgroupA NORMAL REDUNDANCY FAILGROUP controller1 DISK ' /devices/A1 ' NAME diskA1 SIZE 120G FORCE , ' /devices/A2 ' , ' /devices/A3 ' FAILGROUP controller2 DISK ' /devices/B1 ' , ' /devices/B2 ' , ' /devices/B3 ' ; DROP DISKGROUP dgroupA INCLUDING CONTENTS;
  38. 38. Adding Disks to Disk Groups ALTER DISKGROUP dgroupA ADD DISK ' /dev/rdsk/c0t4d0s2 ' NAME A5, ' /dev/rdsk/c0t5d0s2 ' NAME A6, ' /dev/rdsk/c0t6d0s2 ' NAME A7, ' /dev/rdsk/c0t7d0s2 ' NAME A8; ALTER DISKGROUP dgroupA ADD DISK ' /devices/A* ' ; Disk formatting Disk group rebalancing
  39. 39. ASM Disk Group Compatibility <ul><ul><li>Compatibility of each disk group is separately controllable: </li></ul></ul><ul><ul><ul><li>ASM compatibility controls ASM metadata on-disk structure </li></ul></ul></ul><ul><ul><ul><li>RDBMS compatibility controls minimum consumer client level </li></ul></ul></ul><ul><ul><ul><li>Useful with heterogeneous environments </li></ul></ul></ul><ul><ul><li>Setting disk group compatibility is irreversible. </li></ul></ul>DB instance COMPATIBLE.RDBMS COMPATIBLE ASM disk group >= <= COMPATIBLE.ASM ASM instance <= COMPATIBLE
  40. 40. ASM Disk Group Compatibility Full Notes Page
  41. 41. ASM Disk Group Attributes CREATE DISKGROUP DATA NORMAL REDUNDANCY DISK '/dev/raw/raw1','/dev/raw/raw2' ATTRIBUTE 'compatible.asm'='11.1'; C: CREATE A: ALTER Striping attribute of specified template COARSE | FINE A template. tname . stripe Redundancy of specified template UNPROTECT | MIRROR | HIGH A template. tname . redundancy Length o time before removing a disk once OFFLINE 0 M to 2 32 D A disk_repair_time Format of ASM metadata structures on disk Valid ASM instance version AC compatible.asm Format of messages exchanged between DB and ASM Valid database version AC compatible.rdbms Size of allocation units in the disk group 1 | 2 | 4 | 8 | 16 | 32 | 64MB C au_size Description Values Property Name
  42. 42. Using Enterprise Manager to Edit Disk Group Attributes
  43. 43. Miscellaneous ALTER Commands <ul><li>Remove a disk from dgroupA : </li></ul><ul><li>Add and drop a disk in a single command: Cancel a disk drop operation: </li></ul>ALTER DISKGROUP dgroupA DROP DISK A5; ALTER DISKGROUP dgroupA DROP DISK A6 ADD FAILGROUP fred DISK ' /dev/rdsk/c0t8d0s2 ' NAME A9; ALTER DISKGROUP dgroupA UNDROP DISKS ;
  44. 44. ASMCMD Utility $ export ORACLE_SID=+ASM $ asmcmd ASMCMD> ls -l DGROUP1/ORCL/DATAFILE Type Redund Striped Time Sys Name DATAFILE MIRROR COARSE OCT 05 21:00:00 Y HRAPPS.257.570923611 DATAFILE MIRROR COARSE OCT 05 21:00:00 Y TBSASM.256.570922917 ASMCMD> SQL> CREATE TABLESPACE tbsasm DATAFILE '+DGROUP1' SIZE 100M; Tablespace created. SQL> CREATE TABLESPACE hrapps DATAFILE '+DGROUP1' SIZE 10M; Tablespace created.
  45. 45. ASMCMD Utility $ asmcmd help full nodg newdg User created directories Templates Disk group compatibility Disk group name Disk names and failure groups ASMCMD> md_backup –b /tmp/dgbackup070222 –g admdsk1 –g asmdsk2 ASMCMD> md_restore –t full –g asmdsk1 –i backup_file ASMCMD> lsdsk -k DATA *_0001 md_backup md_restore lsdsk repair/remap
  46. 46. ASM Scalability and Performance <ul><ul><li>Extent size grows automatically according to file size. </li></ul></ul><ul><ul><li>ASM support variable extents size to: </li></ul></ul><ul><ul><ul><li>Raise maximum possible file size </li></ul></ul></ul><ul><ul><ul><li>Reduce memory utilization in shared pool </li></ul></ul></ul><ul><ul><li>ASM imposes the following limits: </li></ul></ul><ul><ul><ul><li>63 disk groups in a storage system </li></ul></ul></ul><ul><ul><ul><li>10,000 ASM disks in a storage system </li></ul></ul></ul><ul><ul><ul><li>4 petabyte maximum storage for each ASM disk </li></ul></ul></ul><ul><ul><ul><li>40 exabyte maximum storage for each storage system </li></ul></ul></ul><ul><ul><ul><li>1 million files for each disk group </li></ul></ul></ul>
  47. 47. ASM Scalability and Performance Full Notes Page
  48. 48. Summary <ul><li>In this lesson, you should have learned how to: </li></ul><ul><ul><li>Describe the Oracle Database architecture </li></ul></ul><ul><ul><li>Describe Automatic Storage Management (ASM) </li></ul></ul><ul><ul><li>Set up initialization parameter files for ASM and database instances </li></ul></ul><ul><ul><li>Start up and shut down ASM instances </li></ul></ul><ul><ul><li>Administer ASM disk groups </li></ul></ul>
  49. 49. Practice 1 Overview: Database Architecture and ASM <ul><li>This practice covers the following topics: </li></ul><ul><ul><li>Creating and starting an ASM instance </li></ul></ul><ul><ul><li>Creating and using ASM disk groups </li></ul></ul><ul><ul><li>Managing an ASM instance </li></ul></ul><ul><ul><li>Dynamic disk group rebalancing </li></ul></ul>

×