在FreeBSD环境下使用Sybase 11.0.3.3

一、准备工作

第一步:调整内核参数

如果你的FreeBSD是缺少安装的,为了在FreeBSD下运行Sybase11.0.3.3,那么很可能你要
重新编译自己的内核。这是因为缺省情况下,核心提供给linux使用的最大内存空间不能
满足运行sybase的需要。笔者第一次安装过程中发现,配置完SQL
Server后,服务器无法启动,查看了安装日志:

00:2001/01/08 09:41:28.02 kernel Max fd 1064 exceeds internal limit of 1024

00:2001/01/08 09:41:28.18 kernel Using config area from primary master device.

00:2001/01/08 09:41:28.18 kernel Configuration Error: Configuration file,
'/usr/opt/sybase/sybase/SYBASE.cfg', does not exist.

00:2001/01/08 09:41:28.19 kernel Warning: A configuration file was not specified and
the default file '/usr/opt/sybase/sybase/SYBASE.cfg' does not exist.
SQL Server creates the default file with the default configuration.

00:2001/01/08 09:41:28.19 kernel os_create_region: can't allocate 11665408 bytes

00:2001/01/08 09:41:28.19 kernel kbcreate: couldn't create kernel region.

00:2001/01/08 09:41:28.19 kernel kistartup: could not create shared memory

很明显:现任内核无法分配启动SQL服务器所需的足够内存,所以要对核心参数进行调整。

下面开始调整FreeBSD核心参数:

cd /usr/src/sys/i386/config

vi MyKernel (我的核心名为MyKernel,你应该编辑GENERIC这个文件)

其中加入:

options SHMMAXPGS=200000

options SHMMNI=100

options SHMSEG=10

options SEMMNS=200

options SEMMNI=70

options SEMMSL=61

存盘退出

/usr/sbin/config MyKernel

#cd ../../compile/MyKernel

make depend

#make

#make install

OK 完成核心的编译与安装。

重新启动机器,如果你编译的核心无法,出现提示时,键入:

kernel.old

还可以再用老的核心再启动你的FreeBSD系统。

第二步:安装Linux支持

Sybase在FreeBSD下的运行实际上是依赖于FreeBSD对Linux的仿真实现的。如同以前
在Linux运行SCO环境下的Oracle一样。所以首先要为FreeBSD安装一个Linux仿真环境。

下面开始安装Linux_base软件包:

安装包可以在FreeBSD安装光盘上找到:

#mount –t iso9660 /dev/acd0c /cdrom

cd /cdrom/packages

cd linux_base

#pkg_add linux_base6.1.tgz

由于要安装很多软件包,所以要花10分钟左右的时间。

如果你没有安装光盘,还可以直接通过port安装linux支持

方法如下:

以root身份登录:

cd /usr/port/emulators

cd linux_base

#make install

安装程序将自动从网络上下载所需软件,校验软件包,并最终完成安装

这种安装方式,要求你的电脑能通过拨号上网或FreeBSD主机所在LAN上有路由器或网关可以
连接到Internet上。

以root登录,加载linux核心模块,也即启动linux支持

linux 或

kldload linux

查看核心模块,以确保已成功加载linux核心模块:

#kldstat

显示:

Id Refs Address Size Name

1 2 0xc0100000 1b1c60 kernel

2 1 0xc0a9c000 10000 linux.ko

第2行表示已成功加载。

至此准备工作完成,以下开始正式安装。

三、下载软件及解压

到Sybase的站点下载最新的sybase-ase-11.0.3.3更新包,Sybase对这一版本进行了多次改进,
目前推出了专为FreeBSD准备的一个软件包,其中包括以下三个文件:

sybase-ase-11_0_3_3-FreeBSD-6_i386.tgz

sybase-doc-11_0_3_3-FreeBSD-6_i386.tgz

sybase-ocsd-10_0_4-FreeBSD-6_i386.tgz

可以看到这已是本版本的第6次更新了。

以root登录FreeBSD主机,增加用户sybase

#adduser

根据提示增加一个sybase用户,同时增加一个sybase组用户。

1、将所下载的软件包拷贝到/opt/sybase目录中

cd Sybase

以sybase用户登录,解压以上三个压缩文件:

$ gunzip –c Sybase-ase-11_0_3_3-FreeBSD-6_i386.tgz | tar vxpf –

$ gunzip –c Sybase-doc-11_0_3_3-FreeBSD-6_i386.tgz | tar vxpf –

$ gunzip –c Sybase-oscd-10_0_4-FreeBSD-6_i386.tgz | tar vxpf –

解压完成,以下开始配置SQL服务器。

2、 配置数据库服务器

以sybase用户登录FreeBSD主机

$ cd Sybase

$ cd install

$ ./sysinit

出现以下画面:

SYBINIT

1. Release directory: /opt/sybase

2. Edit / View Interfaces File

3. Configure a Server product

4. Configure an Open Client/Server product

Ctrl-a Accept and Continue, Ctrl-x Exit Screen, ? Help.

Enter the number of your choice and press return:

选择3后:出现以下提示:

CONFIGURE SERVER PRODUCTS

Products:

Product Date Installed Date Configured

1. SQL Server Mar 22 2000 21:22

2. Backup Server Mar 22 2000 21:22

Ctrl-a Accept and Continue, Ctrl-x Exit Screen, ? Help.

Enter the number of your choice and press return: 1

选择1后,出现提示:

EXISTING SYBASE SERVER

1. Configure a new Adaptive Server

2. Configure an existing Sybase Server

3. Upgrade an existing Sybase Server

Ctrl-a Accept and Continue, Ctrl-x Exit Screen, ? Help.

Enter the number of your choice and press return: 1

选择1

ADD NEW ADAPTIVE SERVER

1. Adaptive Server name: SYBASE

Ctrl-a Accept and Continue, Ctrl-x Exit Screen, ? Help.

Enter the number of your choice and press return: 1

如果你要更改adaptive Server
的名称,选择1,键入你想用的名称,完成后使用Ctrl-a接受目前配置,出现以下提示,
开始对服务器进行具体配置:

SYBASE SERVER CONFIGURATION

1. CONFIGURE SERVER'S INTERFACES FILE ENTRY Incomplete

2. MASTER DEVICE CONFIGURATION Incomplete

3. SYBSYSTEMPROCS DATABASE CONFIGURATION Incomplete

4. SET ERRORLOG LOCATION Incomplete

5. CONFIGURE DEFAULT BACKUP SERVER Incomplete

6. CONFIGURE LANGUAGES Incomplete

7. CONFIGURE CHARACTER SETS Incomplete

8. CONFIGURE SORT ORDER Incomplete

9. CONFIGURE AUDITING Incomplete

Ctrl-a Accept and Continue, Ctrl-x Exit Screen, ? Help.

Enter the number of your choice and press return:

选择1~9各项,对以上9项内容进行配置。

例如第1项,配置完成后显示如下:

SERVER INTERFACES FILE ENTRY SCREEN

Server name: SYBASE

1. Retry Count: 0

2. Retry Delay: 0

3. Add a new listener service

Modify or delete a service

Listener services available:

Protocol Address Port Name Alias

4. tcp freebsd 7100 syb1103

Ctrl-a Accept and Continue, Ctrl-x Exit Screen, ? Help.

Enter the number of your choice and press return:

配置完全部1~9项后,结果如下:

SYBASE SERVER CONFIGURATION

1. CONFIGURE SERVER'S INTERFACES FILE ENTRY Complete

2. MASTER DEVICE CONFIGURATION Complete

3. SYBSYSTEMPROCS DATABASE CONFIGURATION Complete

4. SET ERRORLOG LOCATION Complete

5. CONFIGURE DEFAULT BACKUP SERVER Complete

6. CONFIGURE LANGUAGES Complete

7. CONFIGURE CHARACTER SETS Complete

8. CONFIGURE SORT ORDER Complete

9. CONFIGURE AUDITING Complete

Ctrl-a Accept and Continue, Ctrl-x Exit Screen, ? Help.

Enter the number of your choice and press return:

选择ctrl-a之后,出现以下警告:

WARNING: '/home/sybase/master.dat' is a regular file which is not recommended
for a Server device.

Press to continue.

这是因为我们正在使用的数据库不是直接放置在raw设备上,而是使用了操作系统屏蔽
下的文件系统,没有关系,直接回车即可。据说安装在sybase-11.0.3.3加入了对raw
设备的支持,有兴趣的朋友可以自己试试看。以上服务器配置完成。

以下为配置备份服务器(略)详细步骤见笔者另一篇sybase11.0.3.3在linux下的安装。

四、使用数据

首先登录数据库:

$ isql –Usa –P

>

表示连接数据库成功,以后就可以正常使用数据库了。

如果无法连接,请确认SYBASE环境变量是否设置或设置错误。

-完-

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus