Over this article,you will be learn how to use raw devices as the sybase database devices.The sybase recommand that you mirror the master device and don't specified the master as the system default disk,after installation.So you must reconfigure the system default disks and mirror the master device.This article based on aix with raw devices.
1.Creating some Logicle volumes on AIX:
- # mkvg -f -y datavg hdisk1
- 0516-1254 mkvg: Changing the PVID in the ODM.
- datavg
- # mklv -t raw -y sybdev01 datavg 5G
- sybdev01
- # mklv -t raw -y sybdev02 datavg 5G
- sybdev02
- # mklv -t raw -y syblog01 datavg 10G
- syblog01
- //Changing above raw devices owner to user sybase:
- # ls -l /dev/rsyb*
- crw-rw---- 1 root system 36, 1 Aug 20 09:25 /dev/rsybdev01
- crw-rw---- 1 root system 36, 2 Aug 20 09:25 /dev/rsybdev02
- crw-rw---- 1 root system 36, 3 Aug 20 09:26 /dev/rsyblog01
- # chown sybase.sybase /dev/rsyb*
- # chmod 660 /dev/rsyb*
- # ls -l /dev/rsyb*
- crw-rw---- 1 sybase sybase 36, 1 Aug 20 10:23 /dev/rsybdev01
- crw-rw---- 1 sybase sybase 36, 2 Aug 20 10:23 /dev/rsybdev02
- crw-rw---- 1 sybase sybase 36, 3 Aug 20 10:23 /dev/rsyblog01
2.Initializing above raw devices
- 1> disk init name='sybdev01',physname='/dev/rsybdev01',vdevno=2,size='200M'
- 2> go
- Execution Time (ms.): 195 Clock Time (ms.): 195
- 1> disk init name='sybdev02',physname='/dev/rsybdev02',vdevno=3,size='200M'
- 2> go
- Execution Time (ms.): 138 Clock Time (ms.): 138
- 1> disk init name='syblog01',physname='/dev/rsyblog01',vdevno=4,size='500M'
- 2> go
- Execution Time (ms.): 216 Clock Time (ms.): 216
The ASE server log output like this:
- #tail –f /sybase/ASE-15_0/install/H144129.log
- 00:0002:00000:00021:2012/08/20 10:25:06.44 kernel Initializing virtual device 2, '/dev/rsybdev01' with dsync 'off'.
- 00:0002:00000:00021:2012/08/20 10:25:06.44 kernel Virtual device 2 started using asynchronous i/o.
- 00:0002:00000:00021:2012/08/20 10:25:46.04 kernel Initializing virtual device 3, '/dev/rsybdev02' with dsync 'off'.
- 00:0002:00000:00021:2012/08/20 10:25:46.04 kernel Virtual device 3 started using asynchronous i/o.
- 00:0002:00000:00021:2012/08/20 10:26:44.99 kernel Initializing virtual device 4, '/dev/rsyblog01' with dsync 'off'.
- 00:0002:00000:00021:2012/08/20 10:26:44.99 kernel Virtual device 4 started using asynchronous i/o.
Notice:
The initialization size can't great than raw size.If it great than raw size,you can see following errors:
- 00:0002:00000:00021:2012/08/20 09:59:24.59 kernel basis_dsizecheck: attempt to write page 1572865 on device '/dev/rsybdev01' failed, system error is: No such device or address
- 00:0002:00000:00021:2012/08/20 10:05:43.53 kernel basis_dsizecheck: attempt to write page 1572865 on device '/dev/rsybdev02' failed, system error is: No such device or address
3.Configuring the system default devices
Here i'm going to configure the sybdev01 as the system default device and unset the master devivce as the system device.You can configure one or more system default devices.
- 1> sp_diskdefault sybdev01,defaulton
- 2> go
- 1> sp_diskdefault master,defaultoff
- 2> go
Using the GUI tools to check current system default devices:
4.Mirroring devices
Before mirror,i'll create three raw devices:
- # mkvg -f -y stbydata hdisk2
- 0516-1254 mkvg: Changing the PVID in the ODM.
- stbydata
- # mklv -t raw -y stby01 stbydata 3G
- stby01
- # r 01=02
- mklv -t raw -y stby02 stbydata 3G
- stby02
- # mklv -t raw -y slog01 stbydata 6G
- slog01
- # chown sybase.sybase /dev/rstby*
- # chown sybase.sybase /dev/rsl*
- # chmod 660 /dev/rstby*
- # chmod 660 /dev/rslo*
- # ls -l /dev/rstby*
- crw-rw---- 1 sybase sybase 37, 1 Aug 20 10:48 /dev/rstby01
- crw-rw---- 1 sybase sybase 37, 2 Aug 20 10:48 /dev/rstby02
- # ls -l /dev/rslo*
- crw-rw---- 1 sybase sybase 37, 3 Aug 20 10:49 /dev/rslog01
Now,i'm going to mirror following devices:sybdev01,sybdev02 and syblog01.
- 1> disk mirror name='sybdev01',mirror='/dev/rstby01',writes=noserial
- 2> go
- 1> disk mirror name='sybdev02',mirror='/dev/rstby02',writes=noserial
- 2> go
- 1> disk mirror name='syblog01',mirror='/dev/rslog01',writes=noserial
- 2> go
Viewing current mirrored devices by the GUI tools:
5.Unmirror the deivce:
- 1>disk umirror name='sybdev01',mode='remove'
- 2>go
If you specified mode with remove value,then you can't remirror the device.If you specified mode with retain value,you can remirror the device again.
6.Remirror the device:
- 1>disk remirror name='sybdev01'
- 2>go
7.Resize the ASE database devices:
- 1>USE master
- 2>go
- 1>disk resize name='sybdev01',size = '5120M',skip_alloc = true
- 2>go
Notice:
Before you resize the device,ensure that the raw device has enough space unused and it unmirrored.If you resize a mirrored device,you'll see following errors:
disk resize can proceed only when mirroring is permanently disabled.Unmirror secondary with mode ='remove' and re-execute disk resize command.
本文出自 “candon123” 博客,谢绝转载!