oracle9i安装问题

在RHAS3上成功安装Oracle9204

1、从网上下载redhat Enterprise Linux Advanced Server3的四个安装文件,安装时swap分区设置为内存的二倍。不要采用DHCP设置主机名和IP地址,而是“手工设置”。否则会在安装oracle的时候出现如下错误:
  Quote:
Thrown when the IP address of a host cannot be determined


出现这个错误将使Oracle不能安装成功。安装RHAS3,可以刻录到光盘安装,也可以从硬盘安装,从硬盘安装RHAS3,请参考:http://bbs.chinaunix.net/forum/viewtopic.php?p=2416942#2416942
2、系统要求:内存最低256(我的就是这么大),建议512M,硬盘空间4G,如果Oracle安装文件存在硬盘,建议5G(在安装操作系统后的剩余空间)。
可以查看内存的大小,用到的命令是:grep MemTotal /proc/meminfo
swap分区在安装操作系统的时候就设定好了,为内存的2倍,当内存达到1G以上时,和内存大小相同就可以了啊。相看交换分区命令是:/sbin/swapon -s
3、检查是否安装以下包:
  Quote:
#su - root
#rpm -qa|grep compat
compat-db-4.0.14-5.i386
compat-gcc-7.3-2.96.122.i386
compat-gcc-c++-7.3-2.96.122.i386
compat-libstdc++-7.3-2.96.122.i386
compat-libstdc++-devel-7.3-2.96.122.i386
#rpm -qa|grep openmotif21
openmotif21-2.1.30-8.i386
#rpm -qa|grep setarch
setarch-1.3-1.i386
#rpm -qa|grep tcl
tcl-8.3.5-92.i386


上面显示的内容是在笔者已经安装了具体的RPM包之后的结果。它们对应的软件包是:
  Quote:

compat-db-4.0.14-5.i386.rpm
compat-gcc-7.3-2.96.122.i386.rpm
compat-gcc-c++-7.3-2.96.122.i386.rpm
compat-libstdc++-7.3-2.96.122.i386.rpm
compat-libstdc++-devel-7.3-2.96.122.i386.rpm
openmotif21-2.1.30-8.i386.rpm
setarch-1.3-1.i386.rpm
tcl-8.3.5-92.i386.rpm


一般情况下,你的系统上的输出结果和这个不同。如果个别包没有安装,把系统安装光盘mount上,找到具体的软件包(大多数在第三张光盘上),然后利用如下的命令来安装相应的包:
# rpm -ivh compat.....rpm  
因为我没有把RHAS3刻录到光盘,所以我用下面的命令来挂载iso文件
  Quote:
mount -o loop /mnt/e/rhas3/rhel-3-i386-as-disc3.iso /mnt/cdrom


要额外注意的是,这些软件包之间是有依赖性的,先后的顺序要找好。否则会报告不能安装的错误。在安装软件包的时候,如果出现软件包的依赖性,就先安装有有依赖的包。我相信大家会看明白软件包之间的依赖性的。
还需要将gcc、g++更换为2.96的版本.
方法如下:
  Quote:
#su - root
mv /usr/bin/gcc /usr/bin/gcc323
ln -s /usr/bin/gcc296 /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++323      # if g++ doesn't exist, then gcc-c++ was not installed(这里是注释哦)
ln -s /usr/bin/g++296 /usr/bin/g++


3、设置内核参数:
这个版本的默认的glibc 很合适,免去了不少麻烦。
用grep MemTotal /proc/meminfo查看内存总量
出现 MemTotal XXXXXKB,其中的XXXXX就是内存总量。
修改两个文件,如下:
  Quote:

#vi /etc/sysctl.conf
加入:
kernel.shmmax = xxxxx*1024*2(为内存的2倍,切换到字节。要是超过这个值,在运行dbca时会出现Ora-27123:Unable to attach to shared memeroy segment)
kernel.shmmni=4096
kernel.shmall=2097152
kernel.sem=250 32000 100 128
fs.file-max=65536
net.ipv4.ip_local_port_range=1024 65000
#vi /etc/security/limits.conf
加入:
oracle hard nofile 65536
oracle soft nofile 65536
oracle hard nproc 16384
oracle soft nproc 16384


4、建立用户、设置环境变量
建立用户的命令是以root用户运行的。
  Quote:
#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba oracle
#passwd oracle


设置环境变量:
以oracle用户登录,
  Quote:
vi $HOME/.bash_profile
插入下面的内容
# Set the LD_ASSUME_KERNEL environment variable only for Red Hat 9 and
# for Red Hat Enterprise Linux Advanced Server 3 (RHEL AS 3) !!
# Use the "Linuxthreads with floating stacks" implementation instead of NPTL:
export LD_ASSUME_KERNEL=2.4.1

# Oracle Environment
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/9.2.0
export ORACLE_SID=test
export ORACLE_TERM=xterm
# export TNS_ADMIN= Set if sqlnet.ora, tnsnames.ora, etc. are not in $ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN;
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH

# Set shell search paths
export PATH=$PATHORACLE_HOME/bin


然后注销重新登录,用set|more查看环境变量是否生效。因为我把Oracle安装在了oracle用户主目录下,所以我的ORACLE_BASE值为/home/oracle,当然你也可以安装到指定的目录,如下:
  Quote:
#su - root
#mkdir /opt/oracle
#mkdir /opt/oracle/product
#mkdir /opt/oracle/product/9.2.0
#chown -R oracle.oinstall /opt/oracle
                                            
#mkdir /var/opt/oracle
#chown oracle.dba /var/opt/oracle
#chmod 755 /var/opt/oracle


这时ORACLE_BASE的值就是/opt/oracle。
5、开始安装
http://www.oracle.com下载三个安装文件,
ship_9204_linux_disk1.cpio.gz
ship_9204_linux_disk2.cpio.gz
ship_9204_linux_disk3.cpio.gz
用zcat ship_9204_linux_disk1.cpio.gz|cpio -idmv
zcat ship_9204_linux_disk2.cpio.gz|cpio -idmv
zcat ship_9204_linux_disk3.cpio.gz|cpio -idmv
生成三个文件夹Disk1,Disk2,Disk3;
你也可以用gunzip ship_9204_linux_disk1.cpio.gz
               cpio -idmv
这样的命令来生成三个目录,可以用下面的命令刻录到光盘,也可以保存在硬盘。
  Quote:

mkisofs -r Disk1 | cdrecord -v --eject dev=0,0,0 speed=15 -
mkisofs -r Disk2 | cdrecord -v --eject dev=0,0,0 speed=15 -
mkisofs -r Disk3 | cdrecord -v --eject dev=0,0,0 speed=15 -


进入Disk1目录运行runInstaller之前,注意两点:
a、export LANG=en_us(否则安装界面出来就会出现“□”,因为Oracle9i不支持中文界面。)
b、安装p3006854_9204_LINUX.zip补丁,否则会出现如下错误:
  Quote:
Error occurred during initialization of VM
Unable to load native library: /tmp/OraInstall2003-10-25_03-14-57PM/jre/lib/i386/libjava.so:
    symbol __libc_wait, version GLIBC_2.0 not defined in file libc.so.6 with link time reference


http://metalink.oracle.com下载p3006854_9204_LINUX.zip补丁。安装此补丁的方法:
  Quote:

su - root
# unzip p3006854_9204_LINUX.zip
Archive:  p3006854_9204_LINUX.zip
   creating: 3006854/
  inflating: 3006854/rhel3_pre_install.sh
  inflating: 3006854/README.txt

# cd 3006854
# sh rhel3_pre_install.sh
Applying patch...
Patch successfully applied
#  
注意:如果运行 rhel3_pre_install.sh出现下面的错误  
  rhel3_pre_install.sh: line 36: gcc: command not found
是因为你忘了安装gcc,同样要是出现下面的错误:  
# ls
ls: error while loading shared libraries: /etc/libcwait.so: cannot open shared object file: No such file or directory
# rm /etc/ld.so.preload
rm: error while loading shared libraries: /etc/libcwait.so: cannot open shared object file: No such file or directory
#
请不要退出bash,用下面的方法来修复(我开始遇到,后来没有遇到了,可能是因为我把gcc降级到了296吧)  
# echo "" > /etc/ld.so.preload
rm /etc/ld.so.preload
And start over again.  


现在运行./runInstaller &(必须进入到Disk1目录,或者从光盘运行,从光盘安装不要进入/mnt/cdrom后运行runInstaller,而是这样运行./mnt/cdrom/runInstaller)
  呵呵,高兴了吧,期待以久的GUI界面终于出来了啊。这是欢迎界面。显示了Oracle安装的源文件所在目录,还有要安装到的产品目录。我们点“Next”;
       接着出现的下一个界面是Inventory路径,我们点“Next”;
  现在要求用户输入UNIX组名,我们用Oracle用户所在的组“oinstall”,然后点“Next”,如果你是第一次安装Oracle产品,则要你运行一个sh文件。文件是/tmp/orainstRoot.sh,我们打开一个shell窗口,切换到root用户,如下:
  Quote:
su root
sh /tmp/orainstRoot.sh


运行完毕我们返回Oracle安装界面,点“Continue”;
  选择文件存放的目录,我们选择默认值。然后“Next”;
  安装的产品是“Oracle9i Database 9.2.0.4.0”,点“Next”;
  选择安装类型是“通用”,默认选项。点“Next”;
  输入全局数据库名,然后“Next”;
  数据文件的存放位置,我采用的是默认位置,点“Next”;
  出现安装组件的选择结果,这时点“Install”,开始安装,复制文件,进度条在一点一点的增加,当安装并link完后,出现配置工具界面,agent服务不能配置成功,忽略不用管,在下面修复。DBCA,NETCA,HTTP都正确配置完毕哦。呵呵。下面开始修复错误。其实要是把各个界面抓取下来就更好了。
6、Patching Oracle Intelligent Agent on RH AS 3

When you run "agentctl start" (Oracle 9.2.0.4), dbsnmp will crash:
$ su - oracle
$ agentctl start

DBSNMP for Linux: Version 9.2.0.4.0 - Production on 07-JAN-2004 19:11:14

Copyright (c) 2003 Oracle Corporation.  All rights reserved.

Starting Oracle Intelligent Agent.../opt/oracle/product/9.2.0/bin/dbsnmpwd: line 156:  1855 Segmentation fault      nohup $ORACLE_HOME/bin/dbsnmp $*
>>$DBSNMP_WDLOGFILE 2>&1
/opt/oracle/product/9.2.0/bin/dbsnmpwd: line 156:  1868 Segmentation fault      nohup $ORACLE_HOME/bin/dbsnmp $* >>$DBSNMP_WDLOGFILE 2>&1
/opt/oracle/product/9.2.0/bin/dbsnmpwd: line 156:  1880 Segmentation fault      nohup $ORACLE_HOME/bin/dbsnmp $* >>$DBSNMP_WDLOGFILE 2>&1
/opt/oracle/product/9.2.0/bin/dbsnmpwd: line 156:  1892 Segmentation fault      nohup $ORACLE_HOME/bin/dbsnmp $* >>$DBSNMP_WDLOGFILE 2>&1

To resolve this problem, apply the patch p3238244_9204_LINUX.zip from http://metalink.oracle.com. See bug/patch 3238244 for more information.

Before you apply the patch, make sure the instance is down!
首先安装 opatch.
$ unzip p2617419_220_GENERIC.zip  
Archive: p2617419_220_GENERIC.zip  
creating: OPatch/  
creating: OPatch/docs/  
inflating: Opatch/docs/FAQ  
......  
inflating: README.txt  
$ ls  
$ pwd  
/tmp/

$ export PATH=$PATH:/tmp/OPatch:/sbin
Also make sure the opatch script appears in your $PATH. See "atching Oracle9iR2 on Red Hat AS 3" for information on getting and installing opatch. To verify if opatch is in your $PATH, run the which command:
$ su - oracle
$ which opatch
/tmp/OPatch/opatch
$

To apply now the patch, run:
$ su - oracle
$ unzip p3238244_9204_LINUX.zip
$ cd 3238244
$ export PATH=$PATH:/sbin        # the patch needs "user" which is located in /sbin
$ opatch apply

Now you need to relink dbsnmp. This is the binary that crashed when running agentctl start. To find which makefile handles the linking of dbsnmp, you can run:
$ su - oracle
$ find $ORACLE_HOME -name "*.mk" | xargs grep -l dbsnmp
/opt/oracle/product/9.2.0/network/lib/ins_oemagent.mk
/opt/oracle/product/9.2.0/network/lib/env_oemagent.mk
$

I relinked dbsnmp and all associated executables which are maintained by the ins_oemagent.mk makefile:
$ su - oracle
$ cd $ORACLE_HOME/network/lib
$ make -f ins_oemagent.mk install

Now you should be able to start the agent:
$ su - oracle
$ agentctl start

NOTE: Don't forget to undo the changes (links) to /usr/bin/gcc and /usr/bin/g++ if you don't need it any more. Also don't forget the /etc/ld.so.preload file.
改回gcc,g++的版本,否则在以后编译安装其他软件时可能会有问题
# mv /usr/bin/gcc323 /usr/bin/gcc
# mv /usr/bin/g++323 /usr/bin/g++

现在在运行agentctl start,看是不是可以成功运行agent服务了啊,可以用stop、status来停止此服务或者检查服务的状态。
在这个成功之后,居然不能启动Oracle,说是不能找到初始化文件,没办法,我用dbca先删除了原来安装时建立的库,再重新建立了数据库。
7、运行dbca来创建数据库。呵呵,一路畅通,完成数据库的安装。
希望你也能成功安装。
Startup and Shutdown of the Oracle 9i Database
sqlplus:

svrmgrl is not supported any more. You can now do everything with sqlplus.
For instance, to startup the database, run the following commands:
oracle$ sqlplus /nolog
SQL> connect / as sysdba
SQL> startup
The slash connects you to the schema owned by SYS. So in this example you will be connected to the schema owned by SYS with the privilege SYSDBA. SYSDBA gives you the following privileges:
  - sysoper privileges WITH ADMIN OPTION
  - create database
  - recover database until

$ORACLE_HOME/bin/dbstart and $ORACLE_HOME/bin/dbshut

You can also use $ORACLE_HOME/bin/dbstart to startup the database, and $ORACLE_HOME/bin/dbshut to shutdown the database. You can place $ORACLE_HOME/bin/dbstart into the /etc/rc.d/rc.local boot script to automatically bring up the database at system boot time. To get $ORACLE_HOME/bin/dbstart and $ORACLE_HOME/bin/dbshut working, you need to change the third field for your Oracle SID in /etc/oratab from "N" to "Y".

For example, for the Oracle SID "test" I changed the line in /etc/oratab from:
test:/opt/oracle/product/9.2.0:N
to read:
test:/opt/oracle/product/9.2.0:Y

In some cases for 9.2.0 I also had to copy the init file for my SID "test" from /opt/oracle/admin/test/pfile to $ORACLE_HOME/dbs to get dbstart and dbshut working:
cp /opt/oracle/admin/test/pfile/inittest.ora.642002224936 $ORACLE_HOME/dbs/inittest.ora
But first make sure if your init file already exists in $ORACLE_HOME/dbs!

后记:我想在各个版本的LINUX上安装Oracle的各版本,思路和步骤都大体相同,但是更要注意那些微小的差别,也许可能就是这些微小的差别将使你无法成功的安装。建议各位多到Oracle的网部去看看,多上网找些资料来对比着学习学习。工想你肯定会成功的。祝愿热爱Oracle和Linux的朋友都能成功。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值