oracle7xio8b.com2.z0.glb.qiniucdn.com/shoug-asm-lunar-shoug.pdf · oracle 10.2中的增强 •...
TRANSCRIPT
shoug.info 上海Oracle用户组
前Oracle售前眼中的Oracle ASM存储技术
Lunar www.lunar2013.com
Oracle 10g with ASM
Application Application Application
Database Database
ASMOperating System
Architectural Overview
Database Instance
OS/VendorLayer
DBAlert Log
Traces
ASM Instance
ASMAlert Log
Traces
OS LogsOtherTraces
Database Instance
DBAlert Log
Traces
Server
Operating System
A. Create• Database
file creation
DB Instance ASM Instance
Disk Group
• Database file creation
Server
Operating System
A. Create
DB Instance ASM Instance
Disk Group
B. A
llocatio
n
• Database file creation
Server
Operating System
A. Create
DB Instance ASM Instance
Disk Group
B.A
lloca
tion
C. Extent Map
• Database file creation
Server
Operating System
A. Create
DB Instance ASM Instance
Disk Group
B.A
lloca
tion
C. Extent Map
D.
Initia
lize
• Database file creation
Server
Operating System
A. Create
DB Instance ASM Instance
Disk Group
B.A
lloca
tion
C. Extent Map
D.
Initia
lize D. Commit
Server
Operating System
A. Open• Database
file open
DB Instance ASM Instance
Disk Group
• Database file open
Server
Operating System
A. Open
DB Instance ASM Instance
Disk Group
B. R
ea
d M
ap
• Database file creation
Server
Operating System
A. Open
DB Instance ASM Instance
Disk Group
B.R
ead
Map
C. Extent Map
• Database file open
Server
Operating System
A. Create
DB Instance ASM Instance
Disk Group
B.A
lloca
tion
C. Extent Map
D.
File
I/O
shoug.info 上海Oracle用户组
Oracle 10.2中的增强• 管理RAC和单实例数据库
– RAC模式安装ASM
– 管理多个单实例或/和RAC数据库
• 混合数据库和ASM版本
– Oracle Database 和 ASM版本的任意组合
– 版本10.2 和10.1.0.3 或更高版本
• 从数据库ORACLE_HOME中分离ASM home
– 对数据库升级和打补丁不会影响到ASM
– ASM配置从DB安装中分离:DBCA 高级选项-ASM Disk Group Management
• 通过DBMS_FILE_TRANSFER包进行文件转换
– 10.1: ASM to ASM, OS to OS
– 10.2: ASM to ASM, OS to OS, ASM to OS, OS to ASM
shoug.info 上海Oracle用户组
无 ASM 快速镜像再同步时磁盘访问故障
自动删除磁盘:重新创建所有删除的区
使用 ASM 冗余
重新添加磁盘:重新平衡区
1 2
34
Oracle Database 10g 和 Oracle Database 11g
shoug.info 上海Oracle用户组
Oracle 11.1中的增强ASM 快速镜像再同步:概览
磁盘访问故障
故障时间 < DISK_REPAIR_TIME
使用 ASM 冗余
磁盘又变得可访问;只需要再同步已修改的区
1 2
34
Oracle Database 11g
shoug.info 上海Oracle用户组
ASM 首选镜像读取:概览
站点 B站点 A
P S
站点 B站点 A
P S
P:主分配单元S:辅助分配单元
shoug.info 上海Oracle用户组
ASM 首选镜像读取:最佳方法
两个站点:正常冗余
仅两个故障组:每个实例一个
两个站点:高冗余
最多四个故障组:每个实例二个
P S P S S PSS
三个站点:高冗余
仅三个故障组:每个实例一个
P S S
shoug.info 上海Oracle用户组
Oracle Database 11g中的 ASM 可伸缩性
• ASM 强制实施下列限制:
– 63 个磁盘组
– 10,000 个 ASM 磁盘
– 每个 ASM 磁盘 4 PB
– 40 EB 的存储空间
– 每个磁盘组 1 百万个文件
– 最大文件大小:
• 外部冗余:140 PB
• 正常冗余:42 PB
• 高冗余:15 PB
shoug.info 上海Oracle用户组
SYSASM角色
– 使用 SYSASM角色管理 ASM 实例可以避免 DBA 与存储管理员之间出现重叠。
SYSDBA将被废弃:
• Oracle Database 11g版本 1 的行为与 Oracle Database 10g中的相同。
• 在将来的版本中, ASM 实例中的 SYSDBA权限将受到限制。
SQL> CONNECT / AS SYSASM
SQL> CREATE USER username IDENTIFIED by passwd;
SQL> GRANT SYSASM TO username;
SQL> DROP USER username;
SQL> CONNECT username/passwd AS SYSASM;
shoug.info 上海Oracle用户组
ASM 磁盘组兼容性
– 可以单独控制每个磁盘组的兼容性:
• ASM 兼容性可以控制磁盘上 ASM 元数据结构。
• RDBMS 兼容性可以控制最低使用者客户机级别。
• 这对于异构环境很有用。
– 对磁盘组兼容性的设置是不可逆的。
DB 实例
COMPATIBLE.RDBMS COMPATIBLE
ASM
磁盘组
>=<=
COMPATIBLE.ASM
ASM 实例
<= COMPATIBLE
shoug.info 上海Oracle用户组
强制装载磁盘组
– 默认情况下,MOUNT使用 NOFORCE选项:
• 所有磁盘必须可用
– 带有 FORCE选项的 MOUNT:
• 如果存在仲裁磁盘,则会使不可用的磁盘脱机
• 如果所有磁盘都可用,则操作会失败
ALTER DISKGROUP data MOUNT [FORCE|NOFORCE];
OCR 和Voting Disk放在ASM上
• OCR 是常规ASM文件
• 一个新的ASM文件类型
• Voting Disk
• 存储在选定的ASM磁盘上
• 使用‘crsctl’ 为Voting disk指定一个磁盘组
• 基于 Ext/Normal/High 冗余级别,ASM 自动创建1/3/5 个Voting Disk
• Quorum failure group
• ASM 基于磁盘组的冗余级别决定OCR和Voting Disk 的冗余度
• ASM SPFILE参数文件也可以被ASM支持
ASM 存储:概念
Database
Tablespace
Segment
Extent
Oracle block(db_block_size)
Datafile
Physicalblock (4k)
ASM instance
ASM disk
ASM fileFile# >=256
Allocation unit
Internal File(Metadata) File# 1-255
ASM disk group
Controlfile
Redolog
Tempfile
parameterfile
shoug.info 上海Oracle用户组
ASM 磁盘组
– 作为逻辑单元管理的磁盘组
– 将磁盘总空间划分为统一大小的单元
– 将各个文件平均分配到所有磁盘中
– 根据文件类型使用粗粒度或细粒度的条带化
– 管理的是磁盘组而非文件
磁盘组
ASM 实例
故障组
控制器 1 控制器 2
故障组 1 故障组 2
磁盘组 A
控制器 3
故障组 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
shoug.info 上海Oracle用户组
Redundancy (cont.)
External redundancy
data exists only once
Normal redundancy
two-way mirroring
one additional extent copy
At least two failure groups
High redundancy
three-way mirroring
two additional copies
At least three failure groups
How ASM allocates redundant copies?
FG1
FG2
ASM partnering concept
FG1
FG2
ASM磁盘和磁盘组(Disk Groups)
• ASM 磁盘 = 磁盘分区或 LUN
• ASM 磁盘组 = 作为一个逻辑单元进行管理的ASM 磁盘池
• 把每一个文件平均散布到跨ASM磁盘组的所有ASM磁盘
– 使用的分配单元(AU)大小为 1 MB
• 条带化
– 基于文件的类型(V$ASM_TEMPLATE)
– Coarse (1 MB)
– Fine (128 KB)
Disk Group
ASM
Instance
ASM
Disk
shoug.info 上海Oracle用户组
磁盘组镜像– 在分配单元级别镜像
– 在每个磁盘上混合主分配
单元和镜像分配单元
– 外部冗余:延迟硬件镜像
– 正常冗余:
• 双向镜像
• 至少两个故障组
– 高冗余:
• 三向镜像
• 至少三个故障组
shoug.info 上海Oracle用户组
磁盘组动态重新平衡– 无论存储配置何时发生更改,都会自动联机重新平衡
– 仅按相应比例将数据移至添加的存储
– 无需手动优化 I/O
– 联机移植到新的存储
– 可在系统上使用ASM_POWER_LIMIT
配置负载
ASM Disk Groups and Disks
37
Disk Group 1
Disk Group 2
Disk Group 3
Disk 1
Disk 4
Disk 2
Disk 6
Disk 5
Disk 7
Disk 3
ASM Disk Groups and Disks
38
Disk Group 1
Disk 1 Disk 4
Disk Group 2
Disk 2 Disk 5 Disk 6 Disk 7 Disk 3
Disk Group 3
ASM Disk Groups, Disks and Database Files
39
Disk Group 1
Disk 1 Disk 4
Disk Group 2
Disk 2 Disk 5 Disk 6 Disk 7
Disk 3
Disk Group 3
File 1
File 2File 3
File 4
File 5
File 5
File 6
ASM 文件
数据库文件
ASM 文件在磁盘组 dgroupA中自动分布
CREATE TABLESPACE sample DATAFILE '+dgroupA';
1
23
4
1 2 3 4
自动创建ASM 文件
RMAN
Chart Title
current.file#.incarnation#
CONTROLFILE
tsname.file#.incarnation
system.262.586330817
uncomplete.268.587244313
DATAFILE
group_1.258.586330719
ONLINELOG
TEMP.265.586330827
TEMPFILE
temp01.dbf
redo01.log
system01.dbf
control01.ctl
dbname1
DG1 DG2 DG3
+
shoug.info 上海Oracle用户组
Disk Zones
• ASM will attempt to optimize the placement of data within a disk to minimize seek overhead
• every ASM Disk is divided into 4 disk zones:
Meta-
datacold Zone (50%)
warm Zone
(25%)
hot Zone
(25%)
shoug.info 上海Oracle用户组
Allocation Unit
• ASM disks are divided into allocation units
• Unit of allocating storage to a file
• One megabyte in size
• Small enough not to be hot
• Large enough for efficient sequential access
• Many allocation units in a single file
• _ASM_AUSIZE
ASM Disk
1 MB
ASM disk with zones and AUs
Metadata ASM files (database)
AU0 AU50
shoug.info 上海Oracle用户组
File Extents versus Allocation Units
• File Extent
– Logical unit of ASM file
– Map to allocation units
• One to many mapping
• Allocation Unit
– Physical unit of ASM disk
– Oracle 10.2 and below
• Always 1MB
• Can be increased using _asm_ausize
– Oracle 11.1 and above
• Variable size
• 1MB, 2MB ,4MB, 8MB, 16MB, 32MB, 64MB
46
shoug.info 上海Oracle用户组
ASM File Allocation
• Splits ASM files into pieces called Data extents across all disks in a diskgroup
• Places extents onto disks at a position called an “Allocation Unit” (AU)
File # 293
File # 4713
AU #15
Ext 0
AU # 11
AU # 6
AU # 407
AU # 43Ext 3
Ext 1
Ext 0
Ext 2
Ext 3
Ext 2
Ext 1
Disk # 4
Disk # 7
Disk # 13
ExtMap x$kffxp
AT x$kfdat
shoug.info 上海Oracle用户组
Extent Map & Allocation Table
• Extent Map – One per file
(indexed by Ext #)
• Allocation Table – One per disk
(indexed by AU#)
AU # File # Ext #
0 … ….
… … ….
15 4713 0
… … …
407 293 0
AU # File # Ext #
0 -1 -1
… … …
6 293 2
…. … …
Disk # 13 Alloc Table
AU # File # Ext #
… … …
11 293 1
…. … …
43 4713 1
Disk # 7 Alloc Table
Disk # 4 Alloc Table
Extent # Disk # Alloc Unit #
0 4 407
1 13 11
2 7 6
…. … …
File 293 XMAP
Extent # Disk # Alloc Unit #
0 4 15
1 13 43
…. … …
File 4713 XMAP
Block 0 1 2 3 ............ 255
1MB
asmfile# 1
asmfile# 2
asmfile# 3
Extend maps
asmfile# 3
~50MB
1 2 3 3 3 3 3 3 3AU0
AU1
AU2
AU3
AU4
...
AU24
...
AU50
17 17 13 18 13 13 13 13 19
5 4 4 4 4 4 4 4 4
6 6 6 6 6 6 6 6 6
7 8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8 8
12 12 12 12 12 12 12 12 12
8 8 8 8 8 8 8 8 8
...
SELIFATAD
ASM的安装和管理
Automatic Storage Management (ASM) Overview
Current State
ASM Cluster Pool of Storage
Disk Group BDisk Group AShared Disk Groups
Wide File Striping
One to One Mapping of ASM Instances to Servers
ASM Instance
Database Instance
ASM Disk
RAC Cluster
Node4Node3Node2Node1 Node5ASM ASM ASM ASM ASM
ASM Instance
Database Instance
DBA DBA DBB DBB DBCDBB
Flex ASM: Eliminate 1:1 Server MappingNew: ASM Storage Consolidation in Oracle Database 12c
ASM Cluster Pool of Storage
Disk Group BDisk Group AShared Disk
Groups
Wide File Striping
Databases share
ASM instancesASM Instance
Database Instance
ASM Disk
RAC Cluster
Node5Node4Node3Node2Node1
Node5
runs as
ASM
Client to
Node4
Node1
runs as
ASM
Client to
Node2
Node1
runs as
ASM
Client to
Node4
Node2
runs as
ASM
Client to
Node3
ASM ASM ASM
ASM Instance
DBA DBA DBB DBB DBCDBB
Flex ASM: Supporting Oracle Database 11gPrevious Database Versions Will Host Local ASM Instance
ASM Cluster Pool of Storage
Disk Group BDisk Group AShared Disk Groups
Wide File Striping
Databases share ASM instances
ASM Instance
Database Instance
ASM Disk
RAC Cluster
Node5Node4Node3Node2Node1ASM ASM ASM
DBA DBA DBB DBB DBCDBB
ASM ASM
11.2
DB
11.2
DB
Q & A
S H O U G
Let’s Leverage Oracle Together
Using, Learning & Sharing