VMWare Server 2.0.2 实现 SUN Cluster 3.2.3 安装配置 篇四、集群共享文件系统建立篇

以上三个步骤只能初步建立集群,现在要建立一个对外服务的 oracle 服务器,非rac模式的,还要继续努力作一下工作。

1、建立集群共享的文件系统。

建立metadb,注意建立metadb前还记得当时我们安装操作系统时给那块硬盘的S7 留了250M的空余空间,这空间就用来装metadb。同时,第二块硬盘的s7也划250M出来,和第一块一样,用来作metadb的备份。

partition> p
Current partition table (original):
Total disk cylinders available: 9526 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 3476 - 9525 46.35GB (6050/0/0) 97193250
1 swap wu 1 - 704 5.39GB (704/0/0) 11309760
2 backup wm 0 - 9525 72.97GB (9526/0/0) 153035190
3 home wm 815 - 3475 20.38GB (2661/0/0) 42748965
4 unassigned wm 738 - 814 604.01MB (77/0/0) 1237005
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 706 - 737 251.02MB (32/0/0) 514080
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0)

这是 c1t0d0的分区。

partition> p
Current partition table (original):
Total disk cylinders available: 9526 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 9525 72.97GB (9526/0/0) 153035190
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 706 - 737 251.02MB (32/0/0) 514080
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0

这是 c1t1d0 的分区。

在两台主机上,以上分配是相同的。

下面分别在两台主机上建立metadb 。

guosol10aX# metadb -af -c 3 c1t0d0s7            

guosol10aX# metadb -a -c 3 c1t1d0s7
guosol10aX# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c1t0d0s7
a u 8208 8192 /dev/dsk/c1t0d0s7
a u 16400 8192 /dev/dsk/c1t0d0s7
a u 16 8192 /dev/dsk/c1t1d0s7
a u 8208 8192 /dev/dsk/c1t1d0s7
a u 16400 8192 /dev/dsk/c1t1d0s7


现在建立oracle用到共享文件系统的metaset。

一下只在 guosol10a2 上作就行了,系统会自动把metaset 同步到guosol10a1 上面。

 
创建磁盘集合
使guosol10a2 成为Oracle 数据服务的主节点。

guosol10a2# metaset -s oraset -a -h guosol10a2 guosol10a1

在两台机器上都检查一下是否磁盘集合创建成功

检验磁盘集的配置是否正确,而且对于两个节点是否可见。

root@guosol10a1#metaset

Set name = oraset, Set number = 1

Host Owner
guosol10a2
guosol10a1

root@guosol10a2#metaset

Set name = oraset, Set number = 1

Host Owner
guosol10a2
guosol10a1

可以看到 两台机器都能看到这个磁盘集合。


获取Oracle 磁盘集oraset 的所有权,并检查

guosol10a2# cldevicegroup switch -n guosol10a2 oraset
root@guosol10a2#metaset

Set name = oraset, Set number = 1

Host Owner
guosol10a2 YES
guosol10a1

检查共享磁盘。

root@guosol10a2#scdidadm -L
1 guosol10a2:/dev/rdsk/c0t0d0 /dev/did/rdsk/d1
2 guosol10a2:/dev/rdsk/c1t0d0 /dev/did/rdsk/d2
3 guosol10a2:/dev/rdsk/c1t1d0 /dev/did/rdsk/d3
4 guosol10a2:/dev/rdsk/c2t0d0 /dev/did/rdsk/d4
4 guosol10a1:/dev/rdsk/c2t0d0 /dev/did/rdsk/d4
5 guosol10a2:/dev/rdsk/c2t1d0 /dev/did/rdsk/d5
5 guosol10a1:/dev/rdsk/c2t1d0 /dev/did/rdsk/d5
6 guosol10a2:/dev/rdsk/c2t2d0 /dev/did/rdsk/d6
6 guosol10a1:/dev/rdsk/c2t2d0 /dev/did/rdsk/d6
7 guosol10a2:/dev/rdsk/c2t3d0 /dev/did/rdsk/d7
7 guosol10a1:/dev/rdsk/c2t3d0 /dev/did/rdsk/d7
8 guosol10a2:/dev/rdsk/c2t4d0 /dev/did/rdsk/d8
8 guosol10a1:/dev/rdsk/c2t4d0 /dev/did/rdsk/d8
9 guosol10a2:/dev/rdsk/c2t5d0 /dev/did/rdsk/d9
9 guosol10a1:/dev/rdsk/c2t5d0 /dev/did/rdsk/d9
10 guosol10a2:/dev/rdsk/c2t6d0 /dev/did/rdsk/d10
10 guosol10a1:/dev/rdsk/c2t6d0 /dev/did/rdsk/d10
11 guosol10a2:/dev/rdsk/c2t8d0 /dev/did/rdsk/d11
11 guosol10a1:/dev/rdsk/c2t8d0 /dev/did/rdsk/d11
12 guosol10a2:/dev/rdsk/c2t9d0 /dev/did/rdsk/d12
12 guosol10a1:/dev/rdsk/c2t9d0 /dev/did/rdsk/d12
13 guosol10a2:/dev/rdsk/c2t10d0 /dev/did/rdsk/d13
13 guosol10a1:/dev/rdsk/c2t10d0 /dev/did/rdsk/d13
14 guosol10a2:/dev/rdsk/c2t11d0 /dev/did/rdsk/d14
14 guosol10a1:/dev/rdsk/c2t11d0 /dev/did/rdsk/d14
15 guosol10a2:/dev/rdsk/c2t12d0 /dev/did/rdsk/d15
15 guosol10a1:/dev/rdsk/c2t12d0 /dev/did/rdsk/d15
16 guosol10a2:/dev/rdsk/c2t13d0 /dev/did/rdsk/d16
16 guosol10a1:/dev/rdsk/c2t13d0 /dev/did/rdsk/d16
17 guosol10a2:/dev/rdsk/c2t14d0 /dev/did/rdsk/d17
17 guosol10a1:/dev/rdsk/c2t14d0 /dev/did/rdsk/d17
18 guosol10a2:/dev/rdsk/c2t15d0 /dev/did/rdsk/d18
18 guosol10a1:/dev/rdsk/c2t15d0 /dev/did/rdsk/d18
19 guosol10a1:/dev/rdsk/c0t0d0 /dev/did/rdsk/d19
20 guosol10a1:/dev/rdsk/c1t0d0 /dev/did/rdsk/d20
21 guosol10a1:/dev/rdsk/c1t1d0 /dev/did/rdsk/d21
22 guosol10a1:/dev/rdsk/c3t0d0 /dev/did/rdsk/d22
22 guosol10a2:/dev/rdsk/c3t0d0 /dev/did/rdsk/d22
23 guosol10a1:/dev/rdsk/c3t1d0 /dev/did/rdsk/d23
23 guosol10a2:/dev/rdsk/c3t1d0 /dev/did/rdsk/d23
24 guosol10a1:/dev/rdsk/c3t2d0 /dev/did/rdsk/d24
24 guosol10a2:/dev/rdsk/c3t2d0 /dev/did/rdsk/d24
25 guosol10a1:/dev/rdsk/c3t3d0 /dev/did/rdsk/d25
25 guosol10a2:/dev/rdsk/c3t3d0 /dev/did/rdsk/d25
26 guosol10a1:/dev/rdsk/c3t4d0 /dev/did/rdsk/d26
26 guosol10a2:/dev/rdsk/c3t4d0 /dev/did/rdsk/d26
27 guosol10a1:/dev/rdsk/c3t5d0 /dev/did/rdsk/d27
27 guosol10a2:/dev/rdsk/c3t5d0 /dev/did/rdsk/d27
28 guosol10a1:/dev/rdsk/c3t6d0 /dev/did/rdsk/d28
28 guosol10a2:/dev/rdsk/c3t6d0 /dev/did/rdsk/d28
29 guosol10a1:/dev/rdsk/c3t8d0 /dev/did/rdsk/d29
29 guosol10a2:/dev/rdsk/c3t8d0 /dev/did/rdsk/d29
30 guosol10a1:/dev/rdsk/c3t9d0 /dev/did/rdsk/d30
30 guosol10a2:/dev/rdsk/c3t9d0 /dev/did/rdsk/d30
31 guosol10a1:/dev/rdsk/c3t10d0 /dev/did/rdsk/d31
31 guosol10a2:/dev/rdsk/c3t10d0 /dev/did/rdsk/d31
32 guosol10a1:/dev/rdsk/c3t11d0 /dev/did/rdsk/d32
32 guosol10a2:/dev/rdsk/c3t11d0 /dev/did/rdsk/d32
33 guosol10a1:/dev/rdsk/c3t12d0 /dev/did/rdsk/d33
33 guosol10a2:/dev/rdsk/c3t12d0 /dev/did/rdsk/d33
34 guosol10a1:/dev/rdsk/c3t13d0 /dev/did/rdsk/d34
34 guosol10a2:/dev/rdsk/c3t13d0 /dev/did/rdsk/d34
35 guosol10a1:/dev/rdsk/c3t14d0 /dev/did/rdsk/d35
35 guosol10a2:/dev/rdsk/c3t14d0 /dev/did/rdsk/d35
36 guosol10a1:/dev/rdsk/c3t15d0 /dev/did/rdsk/d36
36 guosol10a2:/dev/rdsk/c3t15d0 /dev/did/rdsk/d36


把共享磁盘7加入oraset,只在guosol10a2 上完成即可。

使用完整的DID 路径名称。

guosol10a2# metaset -s oraset -a /dev/did/rdsk/d7

格式化d7,其实就是
guosol10a2:/dev/rdsk/c2t3d0

只在 guosol10a2上完成一下步骤即可:

格式化D7
d7 分72 G 的硬盘到s0

root@guosol10a2#format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c1t0d0 <DEFAULT cyl 9526 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,1976@10/sd@0,0
1. c1t1d0 <DEFAULT cyl 9526 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,1976@10/sd@1,0
2. c2t0d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@0,0
3. c2t1d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@1,0
4. c2t2d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@2,0
5. c2t3d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@3,0
6. c2t4d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@4,0
7. c2t5d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@5,0
8. c2t6d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@6,0
9. c2t8d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@8,0
10. c2t9d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@9,0
11. c2t10d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@a,0
12. c2t11d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@b,0
13. c2t12d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@c,0
14. c2t13d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@d,0
15. c2t14d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@e,0
16. c2t15d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@4/sd@f,0
17. c3t0d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@0,0
18. c3t1d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@1,0
19. c3t2d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@2,0
20. c3t3d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@3,0
21. c3t4d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@4,0
22. c3t5d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@5,0
23. c3t6d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@6,0
24. c3t8d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@8,0
25. c3t9d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@9,0
26. c3t10d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@a,0
27. c3t11d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@b,0
28. c3t12d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@c,0
29. c3t13d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@d,0
30. c3t14d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@e,0
31. c3t15d0 <DEFAULT cyl 9527 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,790@11/pci15ad,1976@5/sd@f,0
Specify disk (enter its number): 5
selecting c2t3d0
[disk formatted]


FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
fdisk - run the fdisk program
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> fdisk
No fdisk table exists. The default partition for the disk is:

a 100% "SOLARIS System" partition

Type "y" to accept the default partition, otherwise type "n" to edit the
partition table.
y
format> p


PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
7 - change `7' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
!<cmd> - execute <cmd>, then return
quit
partition> 0
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 0
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 73gb
`73.00gb' is out of range
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 72gb
partition> label
Ready to label disk, continue? y

partition> p
Current partition table (unnamed):
Total disk cylinders available: 9526 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 9399 72.01GB (9400/0/0) 151011000
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 9525 72.97GB (9526/0/0) 153035190
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0

partition> q


FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
fdisk - run the fdisk program
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> q
root@guosol10a2#


创建并激活md.tab 文件
在两个节点上,创建具有以下条目的/etc/lvm/md.tab 文件。

guosol10X# vi md.tab
oraset/d2 -m oraset/d12
oraset/d12 1 1 /dev/did/rdsk/d7s0

oraset/d0 -p oraset/d2 3G
"md.tab" 62 lines, 1564 characters

并激活md.tab 文件,仅在 guosol10a2 上完成即可。

root@guosol10a2#metainit -s oraset -a
oraset/d12: Concat/Stripe is setup
oraset/d2: Mirror is setup
oraset/d0: Soft Partition is setup



root@guosol10a2#metastat -s oraset
oraset/d0: Soft Partition
Device: oraset/d2
State: Okay
Size: 6291456 blocks (3.0 GB)
Extent Start Block Block count
0 32 6291456

oraset/d2: Mirror
Submirror 0: oraset/d12
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 153019125 blocks (72 GB)

oraset/d12: Submirror of oraset/d2
State: Okay
Size: 153019125 blocks (72 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
d7s0 0 No Okay No



Device Relocation Information:
Device Reloc Device ID
d7 No -



root@guosol10a2#metastat -s oraset -p
oraset/d0 -p /dev/md/oraset/rdsk/d2 -o 32 -b 150994944
oraset/d2 -m oraset/d12 1
oraset/d12 1 1 /dev/did/rdsk/d7s0


# ls /dev/md/oraset/rdsk/
d0 d12 d2


格式化 d0,仅在guosol10a2 上完成即可。

# newfs /dev/md/oraset/rdsk/d0
newfs: construct a new file system /dev/md/oraset/rdsk/d0: (y/n)? y
/dev/md/oraset/rdsk/d0: 6291456 sectors in 1536 cylinders of 128 tracks, 32 sectors
3072.0MB in 62 cyl groups (25 c/g, 50.00MB/g, 8192 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 102464, 204896, 307328, 409760, 512192, 614624, 717056, 819488, 921920,
5326496, 5428928, 5531360, 5633792, 5736224, 5838656, 5941088, 6043520,
6145952, 6248384

3G 的文件系统装oracle的那些数据,日志,归档,控制文件够了,意思意思就算了,这个文件系统搞大了,格式化会死机的。


测试共享文件系统:
建立目录在 guosol10a1、guosol10a2 机上

root@guosol10a2#mkdir -p /oradata/10gR2

root@guosol10a1#mkdir -p /oradata/10gR2


在2机上获取 oraset 主导权
 

guosol10a2# cldevicegroup switch -n guosol10a2 oraset

检查 oraset 的状态

root@guosol10a2#metaset -s oraset
t

Set name = oraset, Set number = 1

Host Owner
guosol10a2 Yes
guosol10a1

Driv Dbase

d7 Yes

在2机器上挂载文件系统

root@guosol10a2#mount /dev/md/oraset/dsk/d0 /oradata/10gR2



在2机器上使用文件系统

root@guosol10a2#cd /oradata/10gR2
root@guosol10a2#cat >> OK.txt
hello world!
^Croot@guosol10a2#ls
OK.txt lost+found
root@guosol10a2#cat OK.txt
hello world!
root@guosol10a2#cd /


在2机器上卸载文件系统

root@guosol10a2#umount /oradata/10gR2


切换 oraset 到 1机器上

root@guosol10a2#cldevicegroup switch -n guosol10a1 oraset


在 1机器上试用文件系统

root@guosol10a1#mount /dev/md/oraset/dsk/d0 /oradata/10gR2
root@guosol10a1#cd /oradata/10gR2
root@guosol10a1#ls
OK.txt lost+found
root@guosol10a1#cat OK.txt
hello world!


可以看到,刚才的那个2机器上建立的简单文件已经可以被1机器看到并读取。

在两台机器的/etc/vfstab 文件中加入以下条目

/dev/md/oraset/dsk/d0   /dev/md/oraset/rdsk/d0  /oradata/10gR2  ufs     2       no      logging,forcedirectio

 

共享文件系统建立完毕

posted @ 2012-03-11 13:33  疯狂的毛豆  阅读(42)  评论(0编辑  收藏  举报