You are on page 1of 43

Database Architecture and ASM

Copyright © 2009, Oracle. All rights reserved.

Objectives
After completing this lesson, you should be able to: • Describe the Oracle Database architecture • Describe Automatic Storage Management (ASM) • Set up initialization parameter files for ASM and database instances • Start up and shut down ASM instances • Administer ASM disk groups

1-2

Copyright © 2009, Oracle. All rights reserved.

The Oracle Database
The Oracle Relational Database Management System (RDBMS) is a database management system that provides an open, comprehensive, integrated approach to information management.

1-3

Copyright © 2009, Oracle. All rights reserved.

Oracle Database Architecture: Overview
Instance
SMON PMON Others

SGA Database buffer cache PGA Server process
DBWn CKPT

Shared pool Library cache Data dictionary cache
LGWR ARCn

Redo log buffer

User process

Data files

Control files Database

Online redo log files

Archived log files

1-4

Copyright © 2009, Oracle. All rights reserved.

. All rights reserved. Oracle.Connecting to the Database • Connection: Communication between a user process and an instance • Session: Specific connection of a user to an instance through a user process USER SQL> Select … User Session Connection 1-5 Copyright © 2009.

Oracle Database Server Structures Memory structures Instance SGA Database buffer cache Shared pool Library cache Data dict. All rights reserved. cache PMON ARCn Others User process Server process Redo log buffer Processes DBWn CKPT LGWR SMON Database Storage structures Data files Control files Online redo log files 1-6 Copyright © 2009. Oracle. .

Oracle. All rights reserved.Oracle Memory Architecture Server process 1 PGA Server process 2 PGA Background process PGA Shared SQL area Library cache Redo log buffer Database buffer cache Java pool Streams pool Data Dictionary cache Other SGA Shared pool I/O Buffer Response queue Free memory Request queue Large pool 1-7 Copyright © 2009. .

Oracle. All rights reserved. .Process Architecture • User process – Is started when a database user or a batch process connects to Oracle Database • Database processes – Server process: Connects to the Oracle instance and is started when a user establishes a session – Background processes: Are started when an Oracle instance is started Instance SGA Database buffer cache Shared pool Library cache Data dictionary cache PGA User process Server process DBWn Redo log buffer Background processes CKPT LGWR SMON PMON ARCn Others 1-9 Copyright © 2009.

All rights reserved. .10 Copyright © 2009. cache SGA CKPT RECO PMON SMON DBWn LGWR ARCn Others …Oracle background processes 1 .Process Structures Server Server Server Server Server …Server n processes SGA Database buffer cache Shared pool Redo log buffer Library cache Data dict. Oracle.

All rights reserved.Database Storage Architecture Control files Data files Online redo log files Parameter file Backup files Archived redo log files Password file 1 . .12 Alert log and trace files Copyright © 2009. Oracle.

Oracle.Logical and Physical Database Structures Logical Database Physical Schema Tablespace Data file Segment Extent Oracle data block OS block 1 . All rights reserved.14 Copyright © 2009. .

• Data files belong to only one tablespace.Tablespaces and Data Files • Tablespaces consist of one or more data files.16 Copyright © 2009. All rights reserved. Oracle. . Data file 1 Data file 2 USERS tablespace 1 .

• The SYSTEM tablespace is used for core functionality (for example. • The auxiliary SYSAUX tablespace is used for additional database components (such as the Enterprise Manager Repository).17 Copyright © 2009. . • They are created at the time of database creation. All rights reserved. data dictionary tables). 1 . Oracle.SYSTEM and SYSAUX Tablespaces • The SYSTEM and SYSAUX tablespaces are mandatory tablespaces.

Oracle. All rights reserved. . Extents. Segment Extents Data blocks Disk blocks 1 . Data blocks are mapped to disk blocks.Segments. Segments are made up of a collection of extents. and Blocks • • • • Segments exist within a tablespace.18 Copyright © 2009. Extents are a collection of data blocks.

All rights reserved. tablespace. PMON. extent. DBWn. segment.Database Architecture: Summary of Structural Components • Memory structures: – System Global Area (SGA): Database buffer cache.19 Copyright © 2009. and various pools – Program Global Area (PGA) • Process structures: – User process and server process – Background processes: SMON. Oracle. schema. redo buffer. control files. ARCn. LGWR. . and so on • Storage structures: – Logical: Database. CKPT. and redo log files 1 . and Oracle block – Physical: data files.

Automatic Storage Management: Review • Portable and high-performance cluster file system • Manages Oracle database files • Data spread across disks to balance load Application • Integrated mirroring across Database disks • Solves many storage File system management challenges Volume manager ASM Operating system 1 .20 Copyright © 2009. All rights reserved. . Oracle.

All rights reserved. Oracle.ASM: General Architecture DB instance SID=SALES DBW0 ASMB FG RBAL ASM instance SID=+ASM GMON RBAL ARB0 … ARBA ASM disks ASM disks ASM disks ASM disks ASM disks ASM disks ASM disk group 1 ASM disk group 2 1 .22 Copyright © 2009. .

Creating an ASM Instance 1 .23 Copyright © 2009. All rights reserved. . Oracle.

All rights reserved.ASM Instance Initialization Parameters INSTANCE_TYPE = ASM DB_UNIQUE_NAME = +ASM ASM_POWER_LIMIT = 1 ASM_DISKSTRING = '/dev/rdsk/*s2'.ora' 1 . dgroupB SPFILE = '$ORACLE_HOME/dbs/spfile+ASM. Oracle. '/dev/rdsk/c1*' ASM_DISKGROUPS = dgroupA. .24 Copyright © 2009.

SQL> STARTUP. All rights reserved. . Oracle. Total System Global Area 284565504 Fixed Size 1299428 Variable Size 258100252 ASM Cache 25165824 ASM diskgroups mounted bytes bytes bytes bytes 1 .Starting Up an ASM Instance $ export ORACLE_SID='+ASM' $ sqlplus /nolog SQL> CONNECT / AS sysasm Connected to an idle instance.25 Copyright © 2009.

SYSDBA will be deprecated in the future: – Oracle Database 11g Release 1 behaves as in 10g – In future releases SYSDBA privileges restricted in ASM instances 1 . • For ASM instances. . SQL> CONNECT ossysasmusername / passwd AS SYSASM.SYSASM Role • SYSASM role to manage ASM instances avoids overlap between DBAs and storage administrators SQL> CONNECT / AS SYSASM SQL> CREATE USER ossysasmusername IDENTIFIED by passwd. SQL> DROP USER ossysasmusername. All rights reserved.26 Copyright © 2009. Oracle. SQL> GRANT SYSASM TO ossysasmusername.

Accessing an ASM Instance As SYSASM or SYSDBA ASM instance As SYSOPER All operations Limited operations Disk group Disk group Storage system 1 . . Oracle.27 Copyright © 2009. All rights reserved.

28 Copyright © 2009. . All rights reserved.Using Enterprise Manager to Manage ASM Users 1 . Oracle.

.29 Copyright © 2009. All rights reserved.Shutting Down an ASM Instance Database instance A 2 Database instance B ASM instance 3 SHUTDOWN NORMAL 1 1 1 . Oracle.

30 Copyright © 2009. . All rights reserved. Oracle.ASM Storage: Concepts ASM disk group Data file ASM file Database Tablespace Segment File-system file or raw device ASM disk Extent Allocation unit Oracle block Physical block 1 .

ASM Disk Group • Is a pool of disks managed as a logical unit • Partitions total disk space into uniform sized units • Spreads each file evenly across all disks • Uses coarse. Oracle.31 Copyright © 2009. not files ASM instance Disk group 1 . . All rights reserved.or fine-grain striping on the basis of file type • Administers disk groups.

Oracle.33 Copyright © 2009. All rights reserved. .Failure Group Controller 1 6 5 4 3 2 1 1 1 7 7 7 13 13 13 Controller 2 Controller 3 1 1 1 7 7 7 13 13 13 1 1 1 7 7 7 13 13 13 Failure group 1 Failure group 2 Disk group A Failure group 3 1 .

Oracle. All rights reserved.34 Copyright © 2009. .Disk Group Mirroring • Mirror at extent level • Mix primary and mirror AUs on each disk • External redundancy: Defers to hardware mirroring • Normal redundancy: – Two-way mirroring – At least two failure groups • High redundancy: – Three-way mirroring – At least three failure groups 1 .

Disk Group Dynamic Rebalancing • Automatic online rebalance whenever storage configuration changes • Moving only the amount of data that is proportional to the storage added • No need for manual I/O tuning • Online migration to new storage • Configurable load on system using ASM_POWER_LIMIT 1 . . All rights reserved.35 Copyright © 2009. Oracle.

All rights reserved. Oracle. .Managing Disk Groups CREATE DISKGROUP ASM instance DROP DISKGROUP Database instance ALTER DISKGROUP 1 .36 Copyright © 2009.

37 Copyright © 2009.Creating and Dropping Disk Groups CREATE DISKGROUP dgroupA NORMAL REDUNDANCY FAILGROUP controller1 DISK '/devices/A1' NAME diskA1 SIZE 120G FORCE. '/devices/A3' FAILGROUP controller2 DISK '/devices/B1'. . '/devices/B2'. '/devices/B3'. DROP DISKGROUP dgroupA INCLUDING CONTENTS. '/devices/A2'. Oracle. All rights reserved. 1 .

All rights reserved.38 Copyright © 2009. A6. A8.Adding Disks to Disk Groups ALTER DISKGROUP dgroupA ADD '/dev/rdsk/c0t4d0s2' NAME '/dev/rdsk/c0t5d0s2' NAME '/dev/rdsk/c0t6d0s2' NAME '/dev/rdsk/c0t7d0s2' NAME DISK A5. ALTER DISKGROUP dgroupA ADD DISK '/devices/A*'. . Oracle. Disk formatting Disk group rebalancing 1 . A7.

ASM Disk Group Compatibility • Compatibility of each disk group is separately controllable: – ASM compatibility controls ASM metadata on-disk structure – RDBMS compatibility controls minimum consumer client level – Useful with heterogeneous environments • Setting disk group compatibility is irreversible. All rights reserved. Oracle.39 Copyright © 2009. . DB instance ASM disk group ASM instance COMPATIBLE >= COMPATIBLE.RDBMS <= COMPATIBLE.ASM <= COMPATIBLE 1 .

asm disk_repair_time template.ASM Disk Group Attributes Name au_size compatible. . redundancy template.'/dev/raw/raw2' ATTRIBUTE 'compatible.41 Copyright © 2009. All rights reserved. 1 . Oracle.asm'='11. stripe Property C AC AC AC A A Values 1|2|4|8|16|32|64MB Valid database version Valid ASM instance version 0 M to 232 D UNPROTECT|MIRROR|HIGH Description Size of allocation units in the disk group Format of messages exchanged between DB and ASM Format of ASM metadata structures on disk Length of time before removing a disk once OFFLINE Redundancy of specified template Striping attribute of specified template COARSE|FINE C: CREATE A: ALTER CREATE DISKGROUP DATA NORMAL REDUNDANCY DISK '/dev/raw/raw1'.rdbms compatible.tname.1'.tname.

42 Copyright © 2009. Oracle.Using Enterprise Manager to Edit Disk Group Attributes 1 . . All rights reserved.

ASM Fast Mirror Resync Overview 1 ASM redundancy is used 2 Disk access failure Secondary extent Primary extent Oracle Database 11g Disk again accessible: Only need to resync modified extents 4 3 Failure time < DISK_REPAIR_TIME 1 .43 Copyright © 2009. All rights reserved. Oracle. .

Using EM to Perform Fast Mirror Resync 1 . .44 Copyright © 2009. Oracle. All rights reserved.

. All rights reserved. Add and drop a disk in a single command: ALTER DISKGROUP dgroupA DROP DISK A6 ADD FAILGROUP fred DISK '/dev/rdsk/c0t8d0s2' NAME A9. 1 .Miscellaneous ALTER Commands Remove a disk from dgroupA: ALTER DISKGROUP dgroupA DROP DISK A5. Cancel a disk drop operation: ALTER DISKGROUP dgroupA UNDROP DISKS.45 Copyright © 2009. Oracle.

570923611 TBSASM. $ export ORACLE_SID=+ASM $ asmcmd ASMCMD> ls -l DGROUP1/ORCL/DATAFILE Type Redund Striped Time DATAFILE MIRROR COARSE OCT 05 21:00:00 DATAFILE MIRROR COARSE OCT 05 21:00:00 ASMCMD> Sys Y Y Name HRAPPS. All rights reserved. SQL> CREATE TABLESPACE hrapps DATAFILE '+DGROUP1' SIZE 10M. .257.46 Copyright © 2009.570922917 1 .256.ASMCMD Utility SQL> CREATE TABLESPACE tbsasm DATAFILE '+DGROUP1' SIZE 100M. Oracle. Tablespace created. Tablespace created.

47 Copyright © 2009. All rights reserved. .ASMCMD Utility User created directories Templates Disk group compatibility Disk group name Disk names and failure groups md_backup full repair/remap $ asmcmd help md_restore nodg newdg lsdsk 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 1 . Oracle.

Oracle.48 Copyright © 2009. All rights reserved.000 ASM disks in a storage system 4 petabyte maximum storage for each ASM disk 40 exabyte maximum storage for each storage system 1 million files for each disk group 1 . • ASM support variable extents size to: – Raise maximum possible file size – Reduce memory utilization in shared pool • ASM imposes the following limits: – – – – – 63 disk groups in a storage system 10.ASM Scalability and Performance • Extent size grows automatically according to file size. .

Summary In this lesson. .50 Copyright © 2009. you should have learned how to: • Describe the Oracle Database architecture • Describe Automatic Storage Management (ASM) • Set up initialization parameter files for ASM and database instances • Start up and shut down ASM instances • Administer ASM disk groups 1 . All rights reserved. Oracle.

All rights reserved.Practice 1 Overview: Database Architecture and ASM This practice covers the following topics: • Creating and starting an ASM instance • Creating and using ASM disk groups • Managing an ASM instance • Dynamic disk group rebalancing 1 . Oracle. .51 Copyright © 2009.