sybase安装详解(suse10环境)

本篇主要介绍在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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 196,099评论 5 462
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 82,473评论 2 373
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 143,229评论 0 325
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,570评论 1 267
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,427评论 5 358
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,335评论 1 273
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,737评论 3 386
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,392评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,693评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,730评论 2 312
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,512评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,349评论 3 314
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,750评论 3 299
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,017评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,290评论 1 251
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,706评论 2 342
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,904评论 2 335

推荐阅读更多精彩内容