# 【转】Oracle ASM How many partners?

ASM provides data redundancy by placing mirrored extent copies on partner disks in different failgroups. Each ASM disk, in a redundant disk group of course, would have up to 8 partner disks (up to 10 partners in ASM version 10). There is no disk partnership and there are no failgroups in external redundancy disk groups.

If a normal redundancy disk group has two disks, they are partners. Every extent from disk 0 is mirrored on disk 1, and every extent on disk 1 is mirrored on disk 0. So every disk has one partner.

In a normal redundancy disk group with 3 disks – and no manually specified failgroups – every disk would have two partners. Disk 0 partners with disks 1 and 2, disk 1 partners with disks 0 and 2, and finally disk 2 partners with disks 0 and 1. When an extent is placed on disk 0, its mirror copy is placed on either disk 1 or disk 2 – but not both. Remember, this is a normal redundancy disk group, so there are two copies of each extent, not three. Similarly an extent on disk 1 will have a mirror on either disk 0 or disk 2. And an extent on disk 2 will have a mirror on eitehr disk 0 or disk 1. Still fairly simple.

Similar situation with high redundancy disk group with 3 disks. The disk partnership will be exactly the same as in the normal redundancy disk group with 3 disks described above. The difference will be in mirroring – each extent on disk 0 will have copies on both partner disks 1 and 2. Same with extents on disk 1 – copies will be on both disk 0 and 2, and finally extents on disk 2 will have copies on both disks 0 and 1.

Now, in a normal redundancy disk group with ‘lot of disks’, every disk would have 8 partners. That means an extent on any of the disks will have a copy on one of its 8 partners. It is worth repeating this – an extent will always have a mirror copy on a partner disk only.

We can query x\$kfdpartner to find out more about the disk partnership. Let’s have a look at a disk group with ‘lot of disks’:

SQL> SELECT count(disk_number)
FROM v\$asm_disk
WHERE group_number = 1;COUNT(DISK_NUMBER)
——————
168

The result shows that there are more than a few disks in this disk group. Let’s see how many partners they have:

SQL> SELECT disk “Disk”, count(number_kfdpartner) “Number of partners”
FROM x\$kfdpartner
WHERE grp=1
GROUP BY disk
ORDER BY 1;Disk Number of partners
———- ——————
0                  8
1                  8
2                  8

165                  8
166                  8
167                  8

168 rows selected.

The result shows that each disk has exactly 8 partners.

The following query will show us the partnership information for all disks in all disk groups:

SQL> set pages 1000
SQL> break on Group# on Disk#
SQL> SELECT d.group_number “Group#”, d.disk_number “Disk#”, p.number_kfdpartner “Partner disk#”
FROM x\$kfdpartner p, v\$asm_disk d
WHERE p.disk=d.disk_number and p.grp=d.group_number
ORDER BY 1, 2, 3;Group#      Disk# Partner disk#
———- ———- ————-
1          0            12
13
18
20
24
27
31
34
1            13
17
21
22
24
29
34
35

29             4
5
7
8
10
12
16
19

816 rows selected..

The partnership is established automatically by ASM at CREATE DISKGROUP time and is updated on every ADD DISK and DROP DISK operation.

The partnership information is maintained in the Partnership and Status Table (PST) and the Disk Directory – both of which are important ASM metadata structures.