sybase安装详解(suse10环境)

2018-02-12 10:46:12来源:https://www.jianshu.com/p/dd81d2cbcca7作者:TarsL人点击

分享






本篇主要介绍在linux环境下以命令行方式来准备安装sybase所需要的裸设备分区、卷组、逻辑卷等。


一. 裸设备相关的知识:

1.什么叫做裸设备?  裸设备,也叫裸分区(原始分区),是一种没有经过格式化,不被Linux通过文件系统来读取的特殊字符设备。它由应用程序负责对它进行读写操作。不经过文件系统的缓冲。
  
2.使用裸设备的好处  因为使用裸设备避免了再经过操作系统这一层,数据直接从Disk到应用进行传输,所以使用裸设备对于读写频繁的数据库应用来说,可以极大地提高数据库系统的性能。当然,这是以磁盘的 I/O 非常大,磁盘I/O已经称为系统瓶颈的情况下才成立。如果磁盘读写确实非常频繁,以至于磁盘读写成为系统瓶颈的情况成立,那么采用裸设备确实可以大大提高性能,最大甚至可以提高至40%,非常明显。


下面来看看我实验的这台机器的磁盘:





在xenserver里挂载了2个virtual disks给这台实验机器,挂载hdb的分区都为文件系统用来安装os以及sybase应用,挂载hdc的将建立逻辑卷来存放sybase的device。


二. 建立物理分区:

先看下hdb的分区:


Login as root:
DevServer-9:~ # fdisk /dev/hdb

Command (m for help): p    (输出分区表)
Disk /dev/hdb: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System/dev/hdb1 1 523 4200966 82 Linux swap / Solaris/dev/hdb2 * 524 1829 10490445 83 Linux/dev/hdb3 1830 7051 41945715 83 Linux

这里一定要注意,接着到我们要操作的hdc这个存储去!!!!!


DevServer-9:~ # fdisk /dev/hdc
#输出分区表
Command (m for help): p
Device Boot Start End Blocks Id System
#建立新分区
Command (m for help): n
Command action e extended p primary partition (1-4)
#建立新分区序号输入1则建立/dev/hdc1
Partition number (1-4):1
First cylinder (1-23497, default 1):
(默认)Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-23497, default 23497):
(默认全部空间都分掉)Using default value 23497

看看分区表现在怎么样了


Command (m for help): p
Disk /dev/hdc: 193.2 GB, 193273528320 bytes255 heads, 63 sectors/track, 23497 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 23497 188739621 83 Linux(这里的83不是我们要的哦!)
Command (m for help): t (改分区格式)
Selected partition 1
Hex code (type L to list codes): 8e(8e才是我们要的)
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p (再确认一下分区表吧,虽然是实验环境咱也得谨慎点是不)
Disk /dev/hdc: 193.2 GB, 193273528320 bytes255 heads, 63 sectors/track, 23497 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 23497 188739621 8e Linux LVM
Command (m for help): w (确认写入,然后等susey一顿忙活…………)
The partition table has been altered!
Calling ioctl() to re-read partition table.Syncing disks.

通常,不需要重启,但有些计算机却要求。因此如果下面的命令不工作,试试重启。
到这里我们的分区算是分完了。


三. 建立卷组以及逻辑卷:

在这节我们要建立sybase所需要的设备空间。



syb-master 300M
syb-proc 556M
syb-tempdb 4200M
syb-data1 64G
syb-log1 32G



所有逻辑卷都在syb卷组下面。


Login as root:
#(建立分组。syb为组名。/dev/hdb1为上面建立的物理卷)
[root@suse10 ~]# vgcreate syb /dev/hdc1
Volume group "syb" successfully created
[root@suse10 ~]# lvcreate -L 300M -n master syb
Logical volume "master" created
[root@suse10 ~]# lvcreate -L 556M -n proc syb
Logical volume "proc" created
[root@suse10 ~]# lvcreate -L 4200M -n tempdb syb
Logical volume "tempdb" created
[root@suse10 ~]# lvcreate –L64G -n data1 syb
Logical volume "data1" created
[root@suse10 ~]# lvcreate -L 32G -n log1 syb
Logical volume "log1" created

建立完成后可用vgdisplay syb –v命令查看
创建完后可以看到/dev/mapper下有5个分卷设备,卷名分别为:


syb-master
syb-proc
syb-tempdb
syb-data1
syb-log1

在/etc/raw添加以下内容。如raw设备已被使用请自行调整,注意这里:前后都不要有坑爹的空格啊!!!!!!!!!**
**


[root@suse10 ~]# vi /etc/raw
raw11:syb/master
raw12:syb/proc
raw13:syb/data1
raw14:syb/tempdb
raw15:syb/log1

激活裸设备, 将裸设备绑定到分区



启动/etc/init.d ./raw start
停止/etc/init.d ./raw stop



[root@suse10 ~]# cd /etc/init.d/
[root@suse10 ~]# sh raw start
DevServer-9:/etc/init.d # sh raw startbind
/dev/raw/raw11 to /dev/syb/master... donebind
/dev/raw/raw12 to /dev/syb/proc... donebind
/dev/raw/raw13 to /dev/syb/data1... donebind
/dev/raw/raw14 to /dev/syb/tempdb... donebind
/dev/raw/raw15 to /dev/syb/log1... done

查询是否激活
/usr/sbin/raw -qa

配置在系统重启动后自动激活裸设备


/sbin/chkconfig raw on

检查


/sbin/chkconfig raw (应为on)

数据库初始化设备时使用/dev/raw/raw(n)设备名即可


四. 安装jdk:

你如果suse10是像我一样默认安装,那么一定会遇到这个错误!



A suitable JVM could not be found. Please run the program again using the option -is:javahome <JAVA HOME DIR>



乖乖翻出你的suse10安装盘找出下面这2个rpm包把



jpackage-utils-1.6.3-18.8.41.x86_64.rpm
java-1_4_2-ibm-1.4.2_sr13-0.7.1.x86_64.rpm



然后再乖乖的按次序装好它们!


DevServer-9: # rpm -ivh jpackage-utils-1.6.3-18.8.41.x86_64.rpm 
Preparing... ########################################### [100%]
1:jpackage-utils ########################################### [100%]
DevServer-9:# rpm -ivh java-1_4_2-ibm-1.4.2_sr13-0.7.1.x86_64.rpm
Preparing... ########################################### [100%]
1:java-1_4_2-ibm ########################################### [100%]

五. 配置sybase用户、组:
DevServer-9:#  groupadd -g 1000 sybase
DevServer-9:# usermod -g sybase -G disk sybase
DevServer-9:# passwd sybase

然后把sybase安装文件全部搬上来,确保安装文件属主都是我们刚建立的这个sybase用户!
这里我放到/home/sybase/sybsetup目录下面。
下面操作都用sybase用户咯。


sybase@DevServer-9: cd /home/sybase/sybsetup
sybase@DevServer-9: chmod +x setup

最后改下sybase的.profile


sybase@DevServer-9: vi .profile

加一下export LANG=en_US
保存后重新用sybase用户登录


su – sybase

下面用root登录来把前一篇建立的逻辑卷都改给sybase用户


DevServer-9: # chown sybase:sybase  /dev/raw/raw1*

然后用sybase用户登录做一下实验看看是否成功:


sybase@DevServer-9: dd if=/dev/raw/raw11 of=/tmp/foo bs=4096 count=8

看到类似内容说明成功:


/8+0 records in
8+0 records out
32768 bytes (33 kB) copied, 0.007031 seconds, 4.7 MB/s

五. 安装sybase for linux:

下面大段的屏幕输出基本都忽略了,操作时候注意哦。


sybase@DevServer-9: cd /home/sybase/sybsetup
sybase@DevServer-9: ./setup –console
#向导初始化什么什么………………
Press 1 for Next, 3 to Cancel or 4 to Redisplay [1]
#(不管 默认1 next)
#地区列表,一堆堆………
Please enter the number of the location you are installing. (1-37) [1] 24
#(选24 就是咱郭嘉)
#用户协议一大坨…………………
Press ENTER to read the text [Type q to quit] q
#(按q不看下一页了,你要爱看你继续)
#又是一堆协议相关……
I agree to the terms of the Sybase license for the install locationspecified.(Y/N) [N]y
#(问你同意协议不,能不同意么!)
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 1 #
#(接着下一步)
Please enter the directory where you would like to install the products orpress ENTER to accept the default.
Destination Directory [ERROR: ServiceException: (error code = 305; severity = 0)]/home/sybase
#(这里输入要安装应用的目录)
Do you want to continue with installation into this directory? [2] 1 (1是yes 2是no)
-------------------------------------------------------------------------------Choose the setup type that best suits your needs.
[X] 1 - Typical The program will be installed with the suggested configuration. Recommended for most users.[ ] 2 - Full The program will be installed with all the products and features.[ ] 3 - Custom The program will be installed with the features you choose. Recommended for advanced users.
To select an item enter its number, or 0 when you are finished: [0] 2
#(选择full吧 全装少烦恼)
To select an item enter its number, or 0 when you are finished: [0]#(选完直接就继续)
-------------------------------------------------------------------------------Sybase Adaptive Server Enterprise Suite will be installed in the followinglocation:
/home/sybase
with the following features:
Sybase Servers Adaptive Server Enterprise ASE Diagnostic Server ASE Agent Plugin ASE SNMP Agent Plugin ASE Web Services Job SchedulerConnectivity Open Client Common ctlib files Common dblib files Embedded SQL/C Monitor Client Library
Press ENTER to read the text [Type q to quit]
#(确认下要安装的部件)

Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 1 #(next后开始装)
Installing Sybase Adaptive Server Enterprise Suite. Please wait...
|-----------|-----------|-----------|------------|0% 25% 50% 75% 100%|||||||||||||||||||||||
#装完后会问你licenses的事 ,自己看着办吧………………
#接下来要配置那些服务,我们只配1和2,其他都点掉吧:
[X] 1 - Configure new Adaptive Server [X] 2 - Configure new Backup Server [ ] 3 - Configure new Monitor Server [ ] 4 - Configure new XP Server [ ] 5 - Configure new Job Scheduler [ ] 6 - Enable Self Management [ ] 7 - Configure Web Services [ ] 8 - Configure Unified Agent
To select an item enter its number, or 0 when you are finished: [0] (直接next)
#next之后会再给你确认一下:
[X] 1 - Custom configure new Adaptive Server [X] 2 - Custom configure new Backup Server
To select an item enter its number, or 0 when you are finished: [0]
#(2个都叉上后next)
#下面配置如下,悲剧的忘记了15新增了一个sybsysdb.dat,就默认吧!
-------------------------------------------------------------------------------Please enter custom configuration values for the new Adaptive Server
Adaptive Server Name [DEVSERVER9] SYBASE9 Port Number [5000] Error Log [/home/sybase/ASE-15_0/install/SYBASE9.log] Page Size
1. 2k 2. 4k 3. 8k 4. 16k
Select a page size : [1] 3 Master Device [/home/sybase/data/master.dat] /dev/raw/raw11 Master Device Size (MB) [120] 256 Master Database Size (MB) [52] 120 System Procedure Device [/home/sybase/data/sysprocs.dat] /dev/raw/raw12 System Procedure Device Size (MB) [132] 512 System Procedure Database Size (MB) [132] 510 System Device [/home/sybase/data/sybsysdb.dat] System Device Size (MB) [2] System Database Size (MB) [2]
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 1
-------------------------------------------------------------------------------
Please enter custom configuration values for the new Backup Server
Backup Server Name [SYBASE9_BS] Port Number [5001] Error Log [/home/sybase/ASE-15_0/install/SYBASE9_BS.log]
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1]

再一路next会收到一个/home/sybase/ASE-15_0/bin/srvbuildres: cannot execute错误,没关系,错误是多了点,咱能解决!为什么会错误呢?


sybase@DevServer-9:~> cd ASE-15_0/bin/sybase@DevServer-9:~/ASE-15_0/bin> ./srvbuildres -r ../sqlsrv.res
The SYBASE_ASE environment variable is not set.

这里的srvbuildres是根据res文件创建,res文件就是保存的咱刚配置的信息。可以vi看一下。 手工去执行一下发现提示是环境变量没有。至于这个环境变量呢是安装sybase才给提供到一个文件里,晕了晕了~~~
加一行到sybase的.profile里:


. SYBASE.sh

注意点和空格!!!!!,然后再来可以了.


sybase@DevServer-9:~/ASE-15_0/bin> ./srvbuildres -r ../sqlsrv.res 
Warning: Unable to verify /dev/raw/raw11 device size. Please verify that this device is not already in use and that it has sufficient space available.
Warning: Unable to verify /dev/raw/raw12 device size. Please verify that this device is not already in use and that it has sufficient space available.
Building Adaptive Server 'SYBASE9':
Writing entry into directory services...
Directory services entry complete.
Building master device...Master device complete.
Writing RUN_SYBASE9 file...RUN_SYBASE9 file complete.
Starting server...
Server started.
Building sysprocs device and sybsystemprocs database...sybprocs device and sybsystemprocs database created.
Running installmaster script to install system stored procedures...
installmaster: 10% complete.
installmaster: 20% complete.
installmaster: 30% complete.
installmaster: 40% complete.
installmaster: 50% complete.
installmaster: 60% complete.
installmaster: 70% complete.
installmaster: 80% complete.
installmaster: 90% complete.
installmaster: 100% complete.
installmaster script complete.
Creating two-phase commit database...Two phase commit database complete.Installing common character sets (Code Page 437, Code Page 850, ISO Latin-1, Macintosh and HP Roman-8)...Character sets installed.Setting server name in Adaptive Server...Server name added.Server 'SYBASE9' was successfully created.

至此sybase数据库服务算是完成了~!
下面是backserver,这个backserver如果没有的话就不能用dump的方式来备份和恢复!
sybase@DevServer-9:~/ASE-15_0/bin> ./srvbuildres -r ../bsrv.res
如果你的glibc的版本是2.4以上,可能会遇到一个错误:
line 15: 4168 Segmentation fault
具体的解决办法是去sybase用户的环境变量里加上:export LD_POINTER_GUARD=1(或者=0,具体机器不一样)


最终我们sybase的.profile内容如下:


export LANG=en_US
export LD_POINTER_GUARD=1
. SYBASE.sh

这时候我们可以到ASE-15_0/install目录下面通过下面2个命令来启动:


./startserver –f RUN_SYBASE
./startserver –f RUN_SYBASE_BS







最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台