Sunteți pe pagina 1din 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.

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. All rights reserved.

Oracle Database Server Structures


Memory structures
Instance SGA Database buffer cache Shared pool Library cache Data dict. 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. 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, Oracle. All rights reserved.

Process Structures

Server

Server

Server

Server

Server

Server n processes
SGA Database buffer cache Shared pool Redo log buffer Library cache Data dict. cache

SGA

CKPT

RECO

PMON

SMON

DBWn

LGWR

ARCn

Others

Oracle background processes


1 - 10 Copyright 2009, 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. All rights reserved.

Logical and Physical Database Structures


Logical Database Physical

Schema

Tablespace

Data file

Segment

Extent

Oracle data block

OS block

1 - 14

Copyright 2009, Oracle. All rights reserved.

Tablespaces and Data Files


Tablespaces consist of one or more data files. Data files belong to only one tablespace.

Data file 1

Data file 2

USERS tablespace

1 - 16

Copyright 2009, Oracle. All rights reserved.

SYSTEM and SYSAUX Tablespaces


The SYSTEM and SYSAUX tablespaces are mandatory tablespaces. They are created at the time of database creation. The SYSTEM tablespace is used for core functionality (for example, data dictionary tables). The auxiliary SYSAUX tablespace is used for additional database components (such as the Enterprise Manager Repository).

1 - 17

Copyright 2009, Oracle. All rights reserved.

Segments, Extents, and Blocks


Segments exist within a tablespace. Segments are made up of a collection of extents. Extents are a collection of data blocks. Data blocks are mapped to disk blocks.

Segment

Extents

Data blocks

Disk blocks

1 - 18

Copyright 2009, Oracle. All rights reserved.

Database Architecture: Summary of Structural Components


Memory structures:
System Global Area (SGA): Database buffer cache, redo buffer, and various pools Program Global Area (PGA)

Process structures:
User process and server process Background processes: SMON, PMON, DBWn, CKPT, LGWR, ARCn, and so on

Storage structures:
Logical: Database, schema, tablespace, segment, extent, and Oracle block Physical: data files, control files, and redo log files

1 - 19

Copyright 2009, Oracle. All rights reserved.

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, Oracle. All rights reserved.

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, Oracle. All rights reserved.

Creating an ASM Instance

1 - 23

Copyright 2009, Oracle. All rights reserved.

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 = '$ORACLE_HOME/dbs/spfile+ASM.ora'

1 - 24

Copyright 2009, Oracle. All rights reserved.

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 Fixed Size 1299428 Variable Size 258100252 ASM Cache 25165824 ASM diskgroups mounted

bytes bytes bytes bytes

1 - 25

Copyright 2009, Oracle. All rights reserved.

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> GRANT SYSASM TO ossysasmusername; SQL> CONNECT ossysasmusername / passwd AS SYSASM; SQL> DROP USER ossysasmusername;

For ASM instances, 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 - 26

Copyright 2009, Oracle. All rights reserved.

Accessing an ASM Instance


As SYSASM or SYSDBA
ASM instance

As SYSOPER

All operations

Limited operations Disk group

Disk group

Storage system

1 - 27

Copyright 2009, Oracle. All rights reserved.

Using Enterprise Manager to Manage ASM Users

1 - 28

Copyright 2009, Oracle. All rights reserved.

Shutting Down an ASM Instance

Database instance A 2

Database instance B

ASM instance 3 SHUTDOWN NORMAL 1 1

1 - 29

Copyright 2009, Oracle. All rights reserved.

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 - 30

Copyright 2009, Oracle. All rights reserved.

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- or fine-grain striping on the basis of file type Administers disk groups, not files

ASM instance

Disk group

1 - 31

Copyright 2009, Oracle. 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 - 33

Copyright 2009, Oracle. All rights reserved.

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 - 34

Copyright 2009, Oracle. All rights reserved.

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 - 35 Copyright 2009, Oracle. All rights reserved.

Managing Disk Groups

CREATE DISKGROUP ASM instance

DROP DISKGROUP

Database instance ALTER DISKGROUP

1 - 36

Copyright 2009, Oracle. All rights reserved.

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;

1 - 37

Copyright 2009, Oracle. All rights reserved.

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, A6, A7, A8;

ALTER DISKGROUP dgroupA ADD DISK '/devices/A*';

Disk formatting

Disk group rebalancing

1 - 38

Copyright 2009, Oracle. All rights reserved.

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.

DB instance

ASM disk group

ASM instance

COMPATIBLE >= COMPATIBLE.RDBMS <= COMPATIBLE.ASM <= COMPATIBLE

1 - 39

Copyright 2009, Oracle. All rights reserved.

ASM Disk Group Attributes


Name au_size compatible.rdbms compatible.asm disk_repair_time template.tname. redundancy template.tname. 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','/dev/raw/raw2' ATTRIBUTE 'compatible.asm'='11.1';

1 - 41

Copyright 2009, Oracle. All rights reserved.

Using Enterprise Manager to Edit Disk Group Attributes

1 - 42

Copyright 2009, Oracle. All rights reserved.

ASM Fast Mirror Resync Overview


1

ASM redundancy is used

Disk access failure

Secondary extent

Primary extent

Oracle Database 11g

Disk again accessible: Only need to resync modified extents


4

Failure time < DISK_REPAIR_TIME

1 - 43

Copyright 2009, Oracle. All rights reserved.

Using EM to Perform Fast Mirror Resync

1 - 44

Copyright 2009, Oracle. All rights reserved.

Miscellaneous ALTER Commands


Remove a disk from dgroupA:
ALTER DISKGROUP dgroupA DROP DISK A5;

Add and drop a disk in a single command:


ALTER DISKGROUP dgroupA DROP DISK A6 ADD FAILGROUP fred DISK '/dev/rdsk/c0t8d0s2' NAME A9;

Cancel a disk drop operation:


ALTER DISKGROUP dgroupA UNDROP DISKS;

1 - 45

Copyright 2009, Oracle. All rights reserved.

ASMCMD Utility

SQL> CREATE TABLESPACE tbsasm DATAFILE '+DGROUP1' SIZE 100M; Tablespace created. SQL> CREATE TABLESPACE hrapps DATAFILE '+DGROUP1' SIZE 10M; Tablespace created.

$ 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.257.570923611 TBSASM.256.570922917

1 - 46

Copyright 2009, Oracle. 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 - 47

Copyright 2009, Oracle. All rights reserved.

ASM Scalability and Performance


Extent size grows automatically according to file size. 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,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 - 48

Copyright 2009, Oracle. All rights reserved.

Summary
In this lesson, 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 - 50

Copyright 2009, 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 - 51

Copyright 2009, Oracle. All rights reserved.

S-ar putea să vă placă și