- New York University

Download Report

Transcript - New York University

Database Architecture and ASM
Copyright © 2008, 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 © 2008, 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 © 2008, Oracle. All rights reserved.
Oracle Database Architecture: Overview
Instance
SMON
PMON
SGA
Shared pool
Database
buffer
cache
Redo log
buffer
DBWn
CKPT
PGA
Server
process
User
process
Data files
Others
Control
files
Library
cache
Data dictionary
cache
LGWR
Online redo
log files
Database
1-4
Copyright © 2008, Oracle. All rights reserved.
ARCn
Archived
log files
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
SQL> Select …
USER
User
Connection
1-5
Copyright © 2008, Oracle. All rights reserved.
Session
Oracle Database Server Structures
Instance
Memory structures
User
process
SGA
Database
buffer
cache
Server
process
Processes
DBWn
CKPT
Shared pool
Library
cache
Redo log
buffer
LGWR
SMON
Data dict.
cache
PMON
ARCn
Others
Database
Storage structures
Data files
1-6
Control
files
Copyright © 2008, Oracle. All rights reserved.
Online redo
log files
Oracle Memory Architecture
Server
process 1
Server
process 2
PGA
Shared
SQL area
Library
cache
Database buffer
cache
1-7
Data Dictionary
cache
Other
Shared pool
Redo log
buffer
Java
pool
Background
process
PGA
Streams
pool
I/O Buffer
Free
memory
Response
queue
Request
queue
Large pool
Copyright © 2008, Oracle. All rights reserved.
PGA
SGA
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
Instance
is started
SGA
Database
buffer
cache
PGA
User
process
Server
process
Redo log
buffer
Library
cache
Data dictionary
cache
Background processes
DBWn
1-9
Shared pool
CKPT
LGWR
Copyright © 2008, Oracle. All rights reserved.
SMON
PMON
ARCn
Others
Process Structures
Server
Server
Server
Server
Server
…Server n
processes
SGA
Database
buffer
cache
CKPT
RECO
Shared pool
Redo log
buffer
Library
cache
SGA
Data dict.
cache
PMON
SMON
DBWn
LGWR
ARCn
Others
…Oracle
background
processes
1 - 10
Copyright © 2008, 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 © 2008, Oracle. All rights reserved.
Logical and Physical Database Structures
Logical
Physical
Database
Schema
Tablespace
Data file
Segment
Extent
Oracle data
block
1 - 14
Copyright © 2008, Oracle. All rights reserved.
OS block
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 © 2008, 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 © 2008, 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
1 - 18
Extents
Data
blocks
Copyright © 2008, Oracle. All rights reserved.
Disk
blocks
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 © 2008, 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 © 2008, Oracle. All rights reserved.
ASM: General Architecture
DB instance
SID=SALES
ASMB
DBW0
FG
ASM
instance
SID=+ASM
RBAL
ASM disks
ASM disks
ASM disk group 1
1 - 22
ASM disks
ARB0
…
ARBA
GMON
ASM disks
RBAL
ASM disks
ASM disks
ASM disk group 2
Copyright © 2008, Oracle. All rights reserved.
Creating an ASM Instance
1 - 23
Copyright © 2008, 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 © 2008, 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
1 - 25
bytes
bytes
bytes
bytes
Copyright © 2008, 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 © 2008, 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 © 2008, Oracle. All rights reserved.
Using Enterprise Manager to Manage ASM Users
1 - 28
Copyright © 2008, Oracle. All rights reserved.
Shutting Down an ASM Instance
Database instance A
Database instance B
2
ASM instance
3
SHUTDOWN NORMAL
1
1 - 29
1
Copyright © 2008, Oracle. All rights reserved.
ASM Storage: Concepts
ASM
disk group
Database
Tablespace
ASM file
Data file
Segment
Extent
Oracle
block
1 - 30
ASM disk
File-system
file
or
raw device
Allocation unit
Physical
block
Copyright © 2008, 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 © 2008, Oracle. All rights reserved.
Failure Group
Controller 1
Controller 2
Controller 3
6
5
4
3
2
1
1
1
7
7
7
13
13
13
Failure group 1
1
1
1
7
7
7
13
13
13
Failure group 2
Disk group A
1 - 33
Copyright © 2008, Oracle. All rights reserved.
1
1
1
7
7
7
13
13
13
Failure group 3
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 © 2008, 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 © 2008, Oracle. All rights reserved.
Managing Disk Groups
CREATE DISKGROUP
ASM
instance
DROP DISKGROUP
Database
instance
ALTER DISKGROUP
1 - 36
Copyright © 2008, 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 © 2008, 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 © 2008, 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 © 2008, Oracle. All rights reserved.
ASM Disk Group Attributes
Name
Values
Description
C
1|2|4|8|16|32|64MB
Size of allocation units in the disk group
compatible.rdbms
AC
Valid database version
Format of messages exchanged between DB
and ASM
compatible.asm
AC
Valid ASM instance version
Format of ASM metadata structures on disk
disk_repair_time
AC
0 M to 232 D
Length of time before removing a disk once
OFFLINE
template.tname.
redundancy
A
UNPROTECT|MIRROR|HIGH
Redundancy of specified template
template.tname.
stripe
A
COARSE|FINE
Striping attribute of specified template
au_size
Property
C: CREATE
A: ALTER
CREATE DISKGROUP DATA NORMAL REDUNDANCY
DISK '/dev/raw/raw1','/dev/raw/raw2'
ATTRIBUTE 'compatible.asm'='11.1';
1 - 41
Copyright © 2008, Oracle. All rights reserved.
Using Enterprise Manager to
Edit Disk Group Attributes
1 - 42
Copyright © 2008, Oracle. All rights reserved.
ASM Fast Mirror Resync Overview
1
ASM redundancy is used
2
Disk access failure
Oracle Database 11g
Disk again accessible:
Only need to resync modified extents
4
1 - 43
3
Failure time < DISK_REPAIR_TIME
Copyright © 2008, Oracle. All rights reserved.
Using EM to Perform Fast Mirror Resync
1 - 44
Copyright © 2008, 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 © 2008, 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>
1 - 46
Sys
Y
Y
Copyright © 2008, Oracle. All rights reserved.
Name
HRAPPS.257.570923611
TBSASM.256.570922917
ASMCMD Utility
User created directories
Templates
Disk group compatibility
Disk group name
Disk names and failure groups
repair/remap
md_backup
full
$ asmcmd help
md_restore
lsdsk
nodg
newdg
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 © 2008, 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:
–
–
–
–
–
1 - 48
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
Copyright © 2008, 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 © 2008, 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 © 2008, Oracle. All rights reserved.