Debian下安装oracle 10g & 10gR2
作者 blue_stone
E-mail blue_stone@xinhuanet.com
原始出处 http://bluestone.cublog.cn
本文描述了在Debian GNU/Linux下Oracle10g和10gR2的安装, 硬件环境为CPU: AMD Athlon 1800+ MEM:512M .
Debian安装时选择了2.6内核, 内核版本为2.6.8
1 安装需要的软件包
1.1 删除exim, nvi, ppp等不需要的软件包, 安装vim等软件包, 这一步依照个人习惯, 和oracle没有太大的关联.
apt-get remove --purge exim* nvi
apt-get remove --purge ppp pppconfig pppoe pppoeconf
apt-get install vim unzip zip1.2 安装x, 这样可以在Debian上启动图形界面, 如果使用远程机器上的xserver, 则可以不安装kde-core.
apt-get install x-window-system-core
kde-core
1.3 安装oracle依赖的软件包
apt-get install make binutils gcc libstdc++2.10-glibc2.2 libstdc++2.10-dev rpm
1.3 设置gcc
root@guoliang:~# gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3
.3.5/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3
--enable-shared --enable-__cxa_atexit --with-system-zlib --enable-nls
--without-included-gettext --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc
i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-13)
root@guoliang:~# cd /usr/bin
root@guoliang:/usr/bin# ls -al |grep gcc
lrwxrwxrwx 1 root root 7 2006-07-26 13:36 gcc -> gcc-3.3
-rwxr-xr-x 1 root root 69960 2004-03-10 14:47
gcc-2.95
-rwxr-xr-x 1 root root 85196 2005-05-25 08:03 gcc-3.3
lrwxrwxrwx 1 root root 10 2006-07-26 13:36 gccbug -> gccbug-3.3
-rwxr-xr-x 1 root root 16056 2005-05-25 07:25 gccbug-3.3
lrwxrwxrwx 1 root root 7 2006-07-26 13:36 i386-linux-gcc -> gcc-3.3
lrwxrwxrwx 1 root root 7 2006-07-26 13:36 i386-linux-gcc-3.3 -> gcc-3.3
lrwxrwxrwx 1 root root 7 2006-07-26 13:36
i486-linux-gcc-3.3 -> gcc-3.3
root@guoliang:/usr/bin# rm gcc
root@guoliang:/usr/bin# ln -s gcc-2.95 gcc
root@guoliang:/usr/bin# gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version
2.95.4 20011002 (Debian prerelease)
1.4 检查perl和ld的版本, 需要的perl版本为5.8.4, 需要的ld版本为2.15
root@guoliang:/usr/bin# perl -v
This is perl, v5.8.4 built for i386-linux-thread-multi
Copyright 1987-2004, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at , the Perl Home Page.
root@guoliang:/usr/bin# ld -v
GNU ld version 2.15
1.5 建立需要的符号联接
root@guoliang:/usr/bin# ln -s /usr/bin/awk /bin/awk
root@guoliang:/usr/bin# ln -s /usr/bin/sort /bin/sort
root@guoliang:/usr/bin# ln -s /usr/bin/basename /bin/basename
root@guoliang:/usr/bin# ln -s /usr/bin/rpm /bin/rpm
root@guoliang:/usr/bin# ln -s /etc /etc/rc.d
1.6 安装libaio(仅oracle10gR2需要), 我使用的是Debian SID中的libaio, 如果下面的文件不存在请到查找最新版本
wget
dpkg -i libaio_0.3.104-1_i386.deb
2 设置内核变量
对于10gR1, 将如下内容添加到/etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
对于10gR2, 将如下内容添加到/etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
编辑完成后运行sysctl -p 使内核设置生效
3 建立Oracle需要用户和用户组
root@guoliang:~# groupadd oinstall
root@guoliang:~# groupadd dba
root@guoliang:~# useradd -d /home/oracle -g oinstall -G dba,oinstall -s /bin/bash oracle
root@guoliang:~# mkdir -p /home/oracle
root@guoliang:~# chown -R oracle:oinstall /home/oracle
root@guoliang:~# mkdir -p /oracle
root@guoliang:~# chown -R oracle:oinstall /oracle
root@guoliang:~# passwd oracle
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@guoliang:~# groupadd nobody
root@guoliang:~# usermod -G nogroup,nobody nobody
4 设置oracle用户的环境变量, 编辑/home/oracle/.bash_profile, 如果安装10gR1, 则添加
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.1.0
export ORACLE_TERM=xterm
export ORACLE_SID=o10g
export PATH=$PATH:$ORACLE_HOME/bin
如果安装10gR2, 则添加
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export ORACLE_TERM=xterm
export ORACLE_SID=o10gr2
export PATH=$PATH:$ORACLE_HOME/bin
5 安装oracle
运行/oracle/path/runInstaller -ignoreSysPreReqs开始安装Oracle, 安装过程中, 安装程序会提示以root身份运行$ORACLE_HOME/root.sh, 以root身份运行root.sh前, 由于Debian的默认运行级别为2, 需要修改下面的文件, 确保cssd守护进程能够正常启动.
将$ORACLE_HOME/css/admin/inittab_local中的
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1
修改为
h1:23:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1
将$ORACLE_HOME/inventory/Templates/css/admin/init.cssd和$ORACLE_HOME/css/admin/init.cssd中的
SU="/bin/su -l"
修改为
SU="/bin/su -"
10gR1中这一行在文件的83行, 10gR2中这一行在文件的181行.
10GR2中, 将$ORACLE_HOME/bin/localconfig和$ORACLE_HOME/inventory/Templates/bin/localconfig中246到247行的
RCSDIR="/etc/rc.d/rc3.d /etc/rc.d/rc5.d"
RCKDIR="/etc/rc.d/rc0.d /etc/rc.d/rc1.d /etc/rc.d/rc2.d /etc/rc.d/rc4.d /etc/rc.d/rc6.d"
修改为
RCSDIR="/etc/rc.d/rc3.d /etc/rc.d/rc2.d"
RCKDIR="/etc/rc.d/rc0.d /etc/rc.d/rc1.d /etc/rc.d/rc5.d /etc/rc.d/rc4.d /etc/rc.d/rc6.d"
以上修改对10gR1是必须的, 不当的修改将导致root.sh脚本运行失败. 对于10gR2, 则在运行root.sh时可以不做修改, 而在运行$ORACLE_HOME/bin/localconfig前修改.
6 安装后的配置及使用
在10gR2中, 如果使用ASM进行存储管理, 则在建立asm实例前需要运行$ORACLE_HOME/bin/localconfig reset 将init.cssd添加到inittab中.
启动或关闭isqlplus可以使用isqlplusctl start和isqlplusctl stop
启动和关闭企业管理器可以使用emctl start dbconsole和emctl stop dbconsole
附录:
1 我使用的source.list
#deb file:///cdrom/ sarge main
deb cdrom:[Debian GNU/Linux 3.1 r2 _Sarge_ - Official i386 Binary-1 (20060419)]/
unstable contrib main
#deb http://security.debian.org/ stable/updates main contrib
deb stable main non-free contrib
deb -non-US stable/non-US main contrib non-free
deb -security stable/updates main contrib non-free