Professional Documents
Culture Documents
juliandyke.com
Objectives
1.
Understand how Oracle database files are stored in ASM Calculate how long ASM rebalance operations will take
2.
juliandyke.com
Agenda
ASM Instances ASM Disk Groups Metadata Extent Distribution Rebalancing Redundancy
juliandyke.com
ASM Instances
juliandyke.com
Server
Dedicated Storage
juliandyke.com
VKTM
MMAN
juliandyke.com
Node 1
Storage Network
Node 2
Node 3
Node 4
Shared Storage
juliandyke.com
PROD1
TEST1
PROD2
TEST2
juliandyke.com
juliandyke.com
10
juliandyke.com
Disk 1
Disk 2
Disk 5
Disk 3
Disk 4
Disk 6
Disk 7
11
juliandyke.com
Disk 1
Disk 4
Disk 2
Disk 5
Disk 6
Disk 7
Disk 3
12
juliandyke.com
File 3
File 2 File 1
File 4
File 5
File 6
Disk 3
Disk 5
Disk 6
Disk 7
13
juliandyke.com
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
14
juliandyke.com
X$KFFXP
Maps file extents to allocation units Only populated in ASM instance Columns include
Column Name GROUP_KFFXP NUMBER_KFFXP COMPOUND_KFFXP INCARN_KFFXP PXN_KFFXP XNUM_KFFXP LXN_KFFXP DISK_KFFXP AU_KFFXP SIZE_KFFXP Description Disk Group Number File Number Disk Group Number || File Number Incarnation Number Physical Extent Number (within file) Logical Extent Number (within file) 0=primary, 1=first mirror, 2=second mirror Disk Number Allocation Unit Number (within disk) Size (# allocation units)
15
juliandyke.com
ASM Metadata
Metadata is stored in first 256 files in ASM disk group Space is initially allocated when disk group is created Can be subsequently extended Metadata allocation units are divided into blocks Each block is 4096 bytes Block size specifed using _asm_blksize
File# Description Metadata Header File Directory Disk Directory Active Change Directory Continuing Operations Directory Template Directory Alias Directory Attribute directory (optional) Staleness registry (optional)
0 1 2 3 4 5 6 9 12
16
juliandyke.com
ASM Metadata
Metadata Header Partner Status Table File Directory Disk Directory Active Change Directory Continuing Operations Directory Template Directory Alias Directory Metadata Header Disk Header Free Space Table Allocation Table
17
juliandyke.com
ASM Metadata
5 Template Active Change DirectoryDirectory Records changes to metadata 6 Alias Directory Used during recovery of instance or operation failures Continuing Operations Directory Maintains state of active operations
18
juliandyke.com
19
juliandyke.com
KFED Utility
In Oracle 10.2 and above the kfed utility can be used to inspect and edit the contents of ASM blocks
[oracle@server3 ~]$ $ORACLE_HOME/bin/kfed -h as/mlib ASM Library [asmlib='lib'] aun/um AU number to examine or update [AUNUM=number] aus/z Allocation Unit size in bytes [AUSZ=number] blkn/um Block number to examine or update [BLKNUM=number] blks/z Metadata block size in bytes [BLKSZ=number] ch/ksum Update checksum before each write [CHKSUM=YES/NO] cn/t Count of AUs to process [CNT=number] d/ev ASM device to examine or update [DEV=string] o/p KFED operation type [OP=READ/WRITE/MERGE/NEW/FORM/FIND/STRUCT] p/rovnm Name for provisioning purposes [PROVNM=string] s/eek AU number to seek to [SEEK=number] te/xt File name for translated block text [TEXT=string] ty/pe ASM metadata block type number [TYPE=number]
This utility should only be used under the guidance of Oracle Support
20
juliandyke.com
KFED Utility
For example to dump blocks in aliases directory in DISKGROUP1 Find group number SELECT group_number FROM v$asm_diskgroup WHERE name = 'DISKGROUP1'; Alias directory is stored in file number 6 SELECT disk_kffxp, au_kffxp FROM x$kffxp WHERE group_kffxp = 1 AND number_kffxp = 6 AND lxn_kffxp = 0; Disk 0 Find disk name SELECT path FROM v$asm_disk WHERE group_number = 1 AND disk_number = 0; Path /dev/oracleasm/disks/VOL1 Allocation Unit 49
21
juliandyke.com
KFED Utility
Example (continued) Allocation unit is 1MB Block size is 4096 Therefore there are 256 blocks per allocation unit Starting block offset = 256 * 49 = 12544 for (( f = 12544 ; f < 12544 + 256 ; f++ )) do kfed op=read blkn=$f dev='/dev/oracleasm/disks/VOL1' > blk${f} done
22
juliandyke.com
Extent Distribution
23
juliandyke.com
Extent Distribution
Creating a disk group: CREATE DISKGROUP diskgroup1 EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/VOL1';
24
juliandyke.com
Metadata
0 1 2 3 4 5 6 7
25
juliandyke.com
Metadata
0 2 4 6 8 10 12 14
Disk 0 Metadata
Disk 1 Data
26
juliandyke.com
Metadata
0 4 8 12 16 20 24 28
Disk 0
Disk 1 Metadata
Disk 2 Data
Disk 3
27
juliandyke.com
Metadata
0 1 3 4 6 7 9 10
Disk 0 Metadata
Disk 1 Data
28
juliandyke.com
Metadata
0 3 5 8 10 13 15 18
Disk 0
Disk 1 Metadata
Disk 2 Data
Disk 4
29
juliandyke.com
Metadata
0 2 6 8 12 14 18 20
Disk 0
Disk 1 Metadata
Disk 2 Data
Disk 4
30
juliandyke.com
Rebalancing
31
juliandyke.com
Extent Distribution
Adding a disk: ALTER DISKGROUP diskgroup1 ADD DISK '/dev/oracleasm/disks/VOL2' REBALANCE POWER 0;
Dropping a disk: ALTER DISKGROUP diskgroup1 DROP DISK 'DISKGROUP1_0002' REBALANCE POWER 0;
32
juliandyke.com
Disk 0 Metadata
Disk 1 Data
33
STOP
juliandyke.com
Disk 0
Disk 1 Metadata
Disk 2 Data
Disk 3
34
STOP
juliandyke.com
Disk 0
Disk 2
35
juliandyke.com
Disk 0
Disk 1 Metadata
Disk 2 Data
Disk 3
36
STOP
juliandyke.com
Disk 0
Disk 2
37
STOP
juliandyke.com
Disk 0
Disk 2
38
STOP
juliandyke.com
Rebalancing V$ASM_OPERATION
39
juliandyke.com
Power limit can be 0 to 11 0 disables rebalance operation 1 to 11 specifies number of ARBn background processes used for rebalance In Oracle 10.2 RBAL manages rebalance operation Each ARBn background process is allocated a range of 128 allocation units to rebalance When complete another range is requested AD lock is taken while an allocation unit is being rebalanced Rebalance operations take much longer than theoretically necessary. Possible reasons include: Locking GES updates with other ASM instances Updates to RDBMS instance
40
juliandyke.com
Rebalancing Summary
EST_MINUTES column of V$ASM_OPERATION is reasonably accurate Allow a few minutes for SAN cache to stabilize Check regularly for changes to estimate ASM rebalance operations do not affect workload Locks are only taken briefly Lock mechanism has changed in Oracle 11.1 SAN cache and I/O performance will be affected In Oracle 10.2 rebalancing is fastest if Other ASM instances are shutdown RDBMS instance is shutdown Estimated completion time will be affected by: Use of SAN cache and I/O by rest of workload Rate of change by applications to blocks in ASM files being rebalanced
41
juliandyke.com
Redundancy
42
juliandyke.com
Redundancy
External Redundancy Implemented externally using storage layer Most common configuration in production Normal Redundancy Two copies of each extent maintained in separate failure groups Used with extended clusters Used occasionally in production e.g. CERN Increases CPU overhead on servers High Redundancy Three copies of each extent maintained in separate failure groups Very rare in production
43
juliandyke.com
Disk 1
Disk 2
Disk 3
44
juliandyke.com
Failure Group 1
FailureGroup 2
Disk 1
Disk 2
Disk 3
Disk 4
Disk 5
Disk 6
45
juliandyke.com
Failure Group 1
Failure Group 2
Failure Group 3
Disk 1
Disk 2
Disk 1
Disk 2
Disk 1
Disk 2
46
juliandyke.com
Failure Group 2
0 1 2 3 0 1 2 3 4 5 6 7 8 9 10 11
juliandyke.com
Failure Group 2
1 2 5 6 1 2 5 6 9 10 13 14 17 18 21 22
Disk 3
juliandyke.com
Failure Group 2
0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9
Failure Group 3
0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9
juliandyke.com
References
Oracle Automatic Storage Management (Oracle Press) Nitin Vengurlekar Murali Vallath Rich Long What ASM and ZFS Can Do For You Jason Arneil - Nominet A Closer Look Inside Oracle ASM Luca Canali - CERN Implementing ASM Without HW Raid Luca Canali - CERN
50
juliandyke.com
info@juliandyke.com
51
juliandyke.com