首页 > 数据库 > Oracle > 正文

为Linux配备Oracle 8

2024-08-29 13:29:20
字体:
来源:转载
供稿:网友

为linux配备oracle 8

  在linux下使用oracle 8以前,应当安装oracle 8,但oracle公司提供的安装文档较为简单。笔者借鉴其在unix操作系统下的安装方法,得出了在linux上安装oracle 8的方法,此方法并不一定是最好的,使各位读者用上oracle 8才是本文的目的。

前期准备

  假定安装环境是red hat linux,请在安装前确认linux的核心版本为2.0.36及以上。

  1.以root用户登录进入系统,创建用户oracle和组dba,这是oracle默认的安装用户。创建安装用户后,用tar -xvzf 将压缩文件解压到一个指定的目录,本文假定为/oracle,因为tar进行数据归档与用户本机的用户id、组id不同,所以要运行chown -r oracle:dba 以更改文件属性。

  2.由于oracle本身对共享段的要求,用户必须重新手工生成核心,以便共享段的设定满足安装要求。为生成核心,用户应当安装linux操作系统的源代码,编辑/usr/src/linux/include/shmparam.h,将#define shmmax 0x002000000一行的0x002000000(32mb)改为256mb以上,然后在/usr/src/linux下运行make dep、make clean、make bzimage生成核心,使用linuxconf命令将新核心设为启动核心。这一步一定要做,如果生成的新核心有错,可以用原来的核心启动计算机。可用ipc -ml查看共享段的设置是否满足要求。当共享段大于2gb时,查看到的值是负数。

  3.安装相应的egc包。假定安装光盘mount在/mnt/cdrom上,用命令modprobe isofs使操作系统能处理光盘的文件系统,然后运行mount -t iso9660 /dev/cdrom /mnt/cdrom,如在安装后修改了/etc/fstab,可不进行这一步操作。进入相应的rpms目录,安装以egc开始的包,采用的安装命令为rpm -ivh <包名>。

设定安装的环境变量

  安装前,应该设定相应的环境变量。修改用户oracle的.bash—profile文件,设定相应的环境变量。由于安装系统时需要root用户,也要有这些环境变量,故将其放在/etc/profile内,加*号为oracle专有的环境变量,示例如下:

# /etc/profile # system wide environment and startup programs # functions and aliases go in /etc/bashrc java—home=/usr/local/jdk1.1.3 sybase=/opt/sybase-11.9.2 dsquery=sybaserdbms *path=$path:$java—home/bin:/usr/x11r6/bin:/home/oracle/product/8.0.5/bin ps1=″[email protected]:w$″ ulimit -c 1000000 if [ ′id -gn′ = ′id -un′ -a ′id -u′ -gt 14 ]; then umask 002 else umask 022 fi user=′id -un′ logname=$user mail=″/var/spool/mail/$user″ classpath=/usr/local/jdk1.1.3/lib:$home/bin hostname=′/bin/hostname′ histsize=1000 histfilesize=1000 export java—home classpath sybase dsquery export path ps1 hostname histsize histfilesize user logname mail *oracle—home=/home/oracle/product/8.0.5 *oracle—base=/home/oracle *oracle—owner=oracle *oracle—sid=oracle8 *oracle—term=386 *ld—library—path=/home/oracle/product/8.0.5/lib *tmpdir=/var/tmp *export oracle—home oracle—base oracle—owner oracle—sid oracle—term export ld—library—path tmpdir for i in /etc/profile.d/.sh ; do if [ -x $i ]; then . $i fi done unset i

安装并启动数据库

  1.以用户root登录系统,然后到相应目录运行/oracle/orainst/oratab.sh可生成/etc/oratab文件。用su - oracle切换到用户oracle,运行/oracle/orainst/orainst就可启动安装命令,安装时注意在这一步不要安装oracle文档、jdk和智能代理,并且不要创建数据库对象。重新启动/oracle/orainst/orainst安装的rdbms部份,一般情况下除了输入几个用户定制的口令其余按默认值就可以了。oracle安装程序开始拷贝文件,拷贝文件过程中,当安装到数据库管理系统(rdbms)时,用户可从另一终端登录,用ps -ef | grep oracle见到一些oracle进程已启动。

  2.数据库服务器安装完成后,就可以手工启动了。以用户oracle登录,进入$oracle—home/bin,运行dbstart就可以启动数据库服务器。运行dbshut就可停止数据库服务器。

  如果用户不太熟悉oracle的网络部份,可将$oracle—home/network/admin/ora拷贝到/etc目录,在$oracle—home/bin下运行lsnrctl start就可以启动网络监视进程。

  3.为了每一次启动系统时自动启动oracle或管理员手工指定是否每一次启动时自动启动oracle,可采用如下方法。以root登录,进入/etc/rc.d/init.d,手工生成文件oracle,至于文件的书写格式可参见其余相应文件,示例如下:

#!/bin/sh # oracle   this shell script takes care of starting and stopping #       oracle. # chkconfig: 2345 80 30 # description: oracle is a rdbms server. # processname: oracle # source function library. . /etc/rc.d/init.d/functions # source networking configuration. . /etc/sysconfig/network # check that networking is up. [${networking}= ″no″ ] && exit 0 # see how we were called. case ″$1″ in start) # start daemons. echo -n ″starting oracle: ″ su - oracle /home/oracle/product/8.0.5/bin/dbstart > /dev/null 2>&1 sleep 60 su - oracle/home/oracle/product/8.0.5/bin/lsnrctl start > /dev/null 2>&1 echo touch /var/lock/subsys/oracle ;; stop) # stop daemons. echo -n ″shutting down oracle: ″ su - oracle/home/oracle/product/8.0.5/bin/lsnrctl stop > /dev/null 2>&1 su - oracle /home/oracle/product/8.0.5/bin/dbshut > /dev/null 2>&1 echo rm -f /var/lock/subsys/oracle ;; restart) $0 stop $0 start ;; status) status oracle ;; ) echo ″usage: oracle {start|stop|restart|status}″ exit 1 esac exit 0

客户端配置

  为了能使用windows下的一些开发工具,可以按如下方法进行:

  1.在windows下安装oracle客户端软件(可以采用oracle 7.xx的windows客户端软件),安装完成后,将linux下的/etc/tnsnames.ora拷到windows下的$oracle etworkadmin目录下,在开始选单中运行net easy configure并指明odbc连接的字串名和运行sqlplus需要的主机字串(host string),就可以从客户端连上服务器,通过odbc进行数据库的开发。

  2.如果用户使用delphi为开发工具,可在bde设定中指明有远端oracle服务器,设定时仅指明数据库系统的网络协议为tns(transparent network substrate,请不要使用tcp),然后进入数据库桌面,就可以访问远端oracle数据库上的数据了。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表