QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1010|回复: 0

在Redhat 9上安装Oracle9i R2速成

[复制链接]
发表于 2006-1-19 14:55:53 | 显示全部楼层 |阅读模式
Installing Oracle 9i R2 (9.2.0.1.0) on Red Hat 9


提示:Oracle 9i R2(9.2.0.1.0)在RedHat 9 英文界面安装时界面显示正常,在中文界面显示不正常。建议在RH的英文界面下安装、使用oracle的图形模式功能。
This is the installation HOWTO for Oracle 9.2 on RedHat Linux 9. Please remember that Oracle 9.2 is not certified for RedHat 9 and this combination should not be endorsed in production environments. For a full list of Oracle certified environments, check out the Oracle certification matrix.
第一部分:创建用户,授权,设置参数
1、        Creating users and groups
Become root and execute the following commands
        [roko@miniroko] su -                //(切换到根用户)
        [root@miniroko]# groupadd oinstall        //(建立oinstall组)
        [root@miniroko]# groupadd dba//(建立dba组)
        [root@miniroko]# useradd -g oinstall -G dba oracle//(增加ORACLE用户属于这两个组)
        [root@miniroko]# passwd oracle//(修改ORACLE用户密码,修改密码时光标没有任何反应,输完回车即可。)
2、        Creating directories.
Oracle recommends OFA - Optimal Flexible Architecture directory structure, but we will install everything under /opt/ora9:
        [root@miniroko]# mkdir -p /opt/ora9/product/9.2
        [root@miniroko]# mkdir /var/opt/oracle//(建立目录)
        [root@miniroko]# chown oracle.dba /var/opt/oracle
        [root@miniroko]# chown -R oracle.dba /opt/ora9//(授权)
3、        Preinstallation (system configuration):
3.1 Install these compatibility libraries:
A、第一种数据包安装方法
        compat-gcc-7.3-2.96.118.i386.rpm
        compat-libgcj-7.3-2.96.118.i386.rpm
        compat-libgcj-devel-7.3-2.96.118.i386.rpm
        nss_db-compat-2.2-20.i386.rpm
        说明:1、此三文件可以在RedHat的第二张光盘上找到(王卓),但我在第二张光盘上只找到后三个,第一个没有找到(邵彦超)。
                     2、双击此文件安装没用,看似安装,其实没有安装。
                           3、安装方法(执行顺序不要错)
                        rpm -Uvh (ivh) --force compat-gcc-7.3-2.96.118.i386.rpm
                        rpm -Uvh(ivh) --force compat-libgcj-7.3-2.96.118.i386.rpm
rpm -Uvh(ivh)--force compat-lib gcj-devel-7.3-2.96.118.i386.rpm
                         rpm –Uvh(ivh) –force nss_db-compat-2.2-20.i386.rpm
         B、第二种包安装方法
                glibc-2.3.2-5.i686.rpm
                glibc-common-2.3.2-5.i386.rpm
                glibc-devel-2.3.2-5.i386.rpm
                nscd-2.3.2-5.i386.rpm
          安装:
# rpm -Uvh --force glibc-2.3.2-5.i686.rpm glibc-common-2.3.2-5.i386.rpm glibc-devel-2.3.2-5.i386.rpm
If you get the following error:
        error: Failed dependencies:
         glibc = 2.3.2-11.9 is needed by (installed) glibc-debug-2.3.2-11.9
            glibc = 2.3.2-11.9 is needed by (installed) glibc-utils-2.3.2-11.9
            glibc-devel = 2.3.2-11.9 is needed by (installed) glibc-debug-2.3.2-11.9
            glibc-devel = 2.3.2-11.9 is needed by (installed) nptl-devel-2.3.2-11.9
then you can temporarily remove the RPMs from your system until you upgrade the glibc RPMs after your Oracle installation:
# rpm -e glibc-debug glibc-utils nptl-devel
Now try to run runInstaller again(配置完参数文件后)
这两种包安装哪一个都行,第一种我试过,是可以,第二种没试。
I found them all using Synaptic, a graphical tool for updating your RH system. To install synaptic, first download Apt binary RPM package for RH9 from http://apt.freshrpms.net/ and then do (as root):
        [root@miniroko]# rpm -Uvh apt-0.5.5cnc5-fr2.i386.rpm
        [root@miniroko]# apt-get update
        [root@miniroko]# apt-get install synaptic
        这部分红色字体的可以跳过。
        3.2 Set kernel params to be correct at startup:
Append these lines to /etc/sysctl.conf
You might want to change these values if you have more RAM:
        kernel.shmmax = 536870912
        kernel.shmmni = 4096
        kernel.shmall = 2097152
        kernel.sem = 250 32000 128 128
        fs.file-max = 65536
        net.ipv4.ip_local_port_range = 1024 65000
Append these lines into /etc/security/limits.conf
        oracle soft nofile 65536
        oracle hard nofile 65536
        oracle soft nproc 16384
        oracle hard nproc 16384
REBOOT the system so the kernel changes can take effect, or if rebooting is not an option, you can change the kernel params at runtime by issuing:
        [root@miniroko]# echo 250 32000 100 128 > /proc/sys/kernel/sem
        [root@miniroko]# echo 536870912 > /proc/sys/kernel/shmmax
        [root@miniroko]# echo 4096 > /proc/sys/kernel/shmmni
        [root@miniroko]# echo 2097152 > /proc/sys/kernel/shmall
        [root@miniroko]# echo 65536 > /proc/sys/fs/file-max
        [root@miniroko]# echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range

        注:
•        上面的方法比较好,不用重新启动计算机;
•        对于内存为640M的情况,shmmax可以设为536870912 ,经测试通过;
说明:第1、第2及第3中的3.2可以以直接执行文件1.usr(执行方法为:# ./1.usr),执行完毕后,第1、第2及第3中的3.2不用再手工创建。但安装包还要安装,可在执行完1.usr文件后安装,此时oracle 用户的密码是空,在root用户下,打开用户管理,找到oracle用户,修改其密码,去掉 User account is locked 和 Enabled password expiration属性。
3.3安装JAVE JDK(如果需要的话):
经测试,在RH9上安装Oracle 9i R2(9.2.0.1.0)不需要安装JDK的任何版本;但是,这里还是给出JDK的安装方法,仅供需要时参考:
         在Sun网站上提供下载的JDK for Linux有两种格式,一种是.bin档,另一种是.rpm档。安装的方式分别如下:
1).        j2sdk-1_3_1-linux-i386.bin的安装方式
a.        将j2sdk-1_3_1-linux-i386.bin复制到欲安装的目录下,例如/usr/local。
b.        更改档案属性为”可执行”:
                > chmod a+x j2sdk-1_3_1-linux-i386.bin
c.        执行JDK安装程序
                > ./j2sdk-1_3_1-linux-i386.bin

2).        j2sdk-1_3_1-linux-i386-rpm.bin的安装方式
a.        执行j2sdk-1_3_1-linux-i386-rpm.bin:
                > chmod a+x j2sdk-1_3_1-linux-i386-rpm.bin
                > ./j2sdk-1_3_1-linux-i386-rpm.bin
                执行之后会在目前工作目录下产生一个jdk-1.3.1.i386.rpm档案。
b.        利用rpm指令安装JDK程序套件:
                > rpm –iv jdk-1.3.1.i386.rpm

4、        Preinstallation (oracle environment):
Login as oracle user:
        su - oracle
[oracle@miniroko]# vi /home/oracle/.bash_profile
说明:用上面命令打开文件后,将下面的脚本粘贴进去。
按INSERT键,打开插入状态,按ESC退出插入状态,上下左右光标键移动光标,粘贴完比后,退出插入状态,输入:wq(写退出),退出后重复用上面的命令打开文件,看看刚才编辑是否有效,输入:q退出文件。
Put the following lines in ~/.bashrc
        #oracle 9i
        export BASE_ENV=$HOME/.bashrc
        export ORACLE_BASE=/opt/ora9
        export ORACLE_HOME=/opt/ora9/product/9.2
        export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
        export ORACLE_OWNER=oracle
        export ORACLE_SID=ora92in
        export ORACLE_TERM=vt100
        export LD_ASSUME_KERNEL=2.4.1
        export THREADS_FLAG=native
        export LD_LIBRARY_PATH=/opt/ora9/product/9.2/lib:$LD_LIBRARY_PATH
        export PATH=/opt/ora9/product/9.2/bin:$PATH
        #
        # change this NLS settings to suit your country:
        # example:
        # german_germany.we8iso8859p15, american_america.we8iso8859p2 etc.
        #
        #使用中文的情况,语言设置如下:
        export NLS_LANG=AMERICAN_AMERINCA.ZHS16GBK
If you want other national settings (these are croatian), consult the supported settings here, and change the NLS_LANG variable accordingly
5、        Installation:
        Oracle 9i 压缩文件解压:(先将三张ORACLE安装盘文件考贝到某一目录下)
1、        执行gunzip,例如:
> gunzip Lnx_920_disk1.cpio.gz
> gunzip Lnx_920_disk2.cpio.gz
> gunzip Lnx_920_disk3.cpio.gz
2、        解开.cpio檔:
> cpio –idmv< Lnx_920_disk1.cpio
> cpio –idmv< Lnx_920_disk2.cpio
> cpio –idmv< Lnx_920_disk3.cpio
3、        可以使用如下命令代替上面两步
zcat lnx_920_disk1.cpio.gz  |  cpio –idmv
zcat lnx_920_disk2.cpio.gz  |  cpio –idmv
zcat lnx_920_disk3.cpio.gz  |  cpio –idmv
Login as root and allow user oracle to write to X display:
        su -
        xhost +
Login to oracle user:
        su – oracle(推荐注销根用户,登录到oracle用户)
Start the installation. Do not switch to your CD-ROM mount directory because you will not be able to unmount the 1st Cd to insert others when asked.
/mnt/cdrom/install/linux/runInstaller
During the installation, Oracle will ask you to insert other disks. Open up a new console, unmount the current disk with umount /dev/cdrom (as root), replace the disk. If Redhat9 does not mount it automagically, mount it yourself with mount /dev/cdrom
Your installation will produce two errors.
•        First, you will see an error dialog informing about problems with ins_oemagent.mk. Choose ignore on this one, we will fix it in postinstallation.
•        Second dialog will inform you about an "Error in invoking target install of makefile $ORACLE_HOME/ctx/lib/ins_ctx.mk".
When that happens, open up a new console and login as oracle user. Execute the following commands:
•        [oracle@miniroko oracle]$ cd $ORACLE_HOME/install
•        [oracle@miniroko install]$ tail make.log
You will see a line such as this:
gcc -o ctxhx -L/opt/ora9/product/9.2/ctx/lib/ -L/opt/ora9/product/9.2/lib/
-L/opt/ora9/product/9.2/lib/stubs/  /opt/ora9/product/9.2/ctx/lib/ctxhx.o
-L/opt/ora9/product/9.2/ctx/lib/ -lm -lsc_ca -lsc_fa -lsc_ex -lsc_da -lsc_ut
-lsc_ch -lsc_fi -lctxhx -lc -Wl,-rpath,/opt/ora9/product/9.2/ctx/lib -lnls9
-lcore9 -lnls9 -lcore9 -lnls9 -lxml9 -lcore9 -lunls9 -lnls9
Copy this line, add -ldl at the end and run it in $ORACLE_HOME/bin
[oracle@miniroko]$ cd $ORACLE_HOME/bin
[oracle@miniroko bin]$ gcc -o ctxhx -L/opt/ora9/product/9.2/ctx/lib/
-L/opt/ora9/product/9.2/lib/ -L/opt/ora9/product/9.2/lib/stubs/  
/opt/ora9/product/9.2/ctx/lib/ctxhx.o -L/opt/ora9/product/9.2/ctx/lib/
-lm -lsc_ca -lsc_fa -lsc_ex -lsc_da -lsc_ut -lsc_ch -lsc_fi -lctxhx -lc
-Wl,-rpath,/opt/ora9/product/9.2/ctx/lib -lnls9 -lcore9 -lnls9 -lcore9
-lnls9 -lxml9 -lcore9 -lunls9 -lnls9 -ldl
Now hit the ignore button on the dialog and the installation will continue.
At the end Oracle installation will probably inform you that agents failed to start. Choose ignore on this one, we will fix it later
在安装过程中,一定要注意系统的提示,按系统的提示做,否则就安装不成功,在ORACLE9I安装界面打开后,到输入SID的地方注意,SID在前面的配置文件中已写明(ora92in),在输入的界面上不要再更改,否则安装失败。
   6、Postinstall
        Open up a console and login as oracle user. Execute these lines:
        [oracle@miniroko oracle]$ cd $ORACLE_HOME/network/lib
        [oracle@miniroko lib]$ make -f ins_net_client.mk install
Then edit the $ORACLE_HOME/ctx/lib/ins_ctx.mk file so that lines 13-14 change from:
        ctxhx: $(CTXHXOBJ)
        $(LINK) $(CTXHXOBJ) $(INSO_LINK)
to
        ctxhx: $(CTXHXOBJ)
        $(LINK) -ldl $(CTXHXOBJ) $(INSO_LINK)
Then do SO
        [oracle@miniroko lib]$ make -f $ORACLE_HOME/ctx/lib/ins_ctx.mk install
Now you should be able to start your agents with
        [oracle@miniroko lib]$  /opt/ora9/product/9.2/bin/agentctl start

7、Starting the database
------------------------------
The easiest way is to create a startup/shutdown script as such
--
        #!/bin/bash
        #
        # (c) [email protected]
        #
        # name: /etc/rc.d/init.d/ora9
        # description:  starts and stops oracle 9i database, TNS listener
        #  http server, and fixes kernel parameters for oracle

        #oracle environment
        export ORACLE_HOME=/opt/ora9/product/9.2
        export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
        export NLS_LANG=AMERICAN_AMERINCA.ZHS16GBK
        export ORACLE_SID=ora92in//(与前面配置文件必须一样)

        export DISPLAY=:0
        oracle_user=oracle
                                                                                                                                          
        # see how we're called
                                                                                                                                          
        case $1 in
         start)
          # fix kernel parameters
          echo 250 32000 100 128 > /proc/sys/kernel/sem
        echo 536870912 > /proc/sys/kernel/shmmax
          echo 4096 > /proc/sys/kernel/shmmni
          echo 2097152 > /proc/sys/kernel/shmall
          echo 65536 > /proc/sys/kernel/fs/file-max
          echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range

          # start listener, apache and database
          su - "$oracle_user"<<EOO
            lsnrctl start
            apachectl start
            sqlplus /nolog<<EOS
              connect / as sysdba
              startup
        EOS
        EOO
        ;;
                                                                                                                                          
          stop)
          # stop listener, apache and database
          su - "$oracle_user"<<EOO
              lsnrctl stop
              apachectl stop
            sqlplus /nolog<<EOS
              connect / as sysdba
              shutdown immediate
        EOS
        EOO
          ;;
                                                                                                                                          
          *)
         echo "Usage: ora9 [start|stop]"
         ;;
                                                                                                                                          
        esac
--
Just make sure you change the ORACLE_SID to your SID.
You can copy that script to your /etc/rc.d/init.d directory or link it from your runlevel startup directory (e.g. /etc/rc.d/rc5.d) to make sure Oracle is started upon booting the machine, and stopped before shutting down.
Alternativly you can start and stop it directly with /etc/rc.d/init.d/ora9 start|stop
        具体做法:
•        使用root用户在/etc/rc.d/init.d 下建立ora92i文件,内容为上面所列从“--”至“--”之脚本。
•        添加自启动连接,使用下面语句:
[root@miniroko]# ln – s /etc/rc.d/init.d/ora92i  /etc/rc0.d/K10ora92i
[root@miniroko]# ln – s /etc/rc.d/init.d/ora92i  /etc/rc1.d/K10ora92i
[root@miniroko]# ln – s /etc/rc.d/init.d/ora92i  /etc/rc2.d/S99ora92i
[root@miniroko]# ln – s /etc/rc.d/init.d/ora92i  /etc/rc3.d/S99ora92i
[root@miniroko]# ln – s /etc/rc.d/init.d/ora92i  /etc/rc4.d/S99ora92i
[root@miniroko]# ln – s /etc/rc.d/init.d/ora92i  /etc/rc5.d/S99ora92i
已有此文件,在根用户下将其复制到/etc/rc.d/init.d,并将其再次复次到/usr/local/bin下边,可以在SHEEL中执行如:ora92i start(stop)
注:可以只考虑运行级别为0-关机和5-X11的情况,中间四级可以忽略
     8、使用Oracle 9i 数据库
        安装完毕后Oracle数据库会自动启动,下面我们用实际超作来说明一下Oracle 9i数据库的启动和关闭。
    以oracle用户登陆数据库,开个控制台窗口;
    关闭Oracle 9i 数据库

[oracle@wing /oracle]$ sqlplus " / as sysdba"
//以sysdba用户登陆数据库
SQL*Plus: Release 9.0.1.0.0 - Production on Wed Jul 11 15:35:31 2001
(c) Copyright 2001 Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.0.1.0.0 - Production
With the Partitioning option
JServer Release 9.0.1.0.0 - Production
运行shudown命令关闭数据库
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
  启动Oracle 9i 数据库

[oracle@wing bin]$ sqlplus " / as sysdba"
SQL*Plus: Release 9.0.1.0.0 - Production on Wed Jul 11 16:00:59 2001
(c) Copyright 2001 Oracle Corporation. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 336356520 bytes
Fixed Size 279720 bytes
Variable Size     268435456 bytes
Database Buffers 67108864 bytes
Redo Buffers 532480 bytes
Database mounted.
Database opened.
SQL>
  启动Oracle 9i监听程序
  Oracle的监听程序主要是为客户端的连接提供接口

[oracle@wing bin]$ lsnrctl
LSNRCTL for Linux: Version 9.0.1.0.0 - Production on 11-JUL-2001 16:12:17
Copyright (c) 1991, 2001, Oracle Corporation. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> start
Starting /oracle/product/9.0.1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 9.0.1.0.0 - Production
System parameter file is /oracle/product/9.0.1/network/admin/listener.ora
Log messages written to /oracle/product/9.0.1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=wing)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 9.0.1.0.0 - Production
Start Date 11-JUL-2001 16:12:58
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File /oracle/product/9.0.1/network/admin/listener.ora
Listener Log File /oracle/product/9.0.1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=wing)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "oracle" has 1 instance(s).
  Instance "oracle", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>
  关闭Oracle 9i监听程序

[oracle@wing bin]$ lsnrctl
LSNRCTL for Linux: Version 9.0.1.0.0 - Production on 11-JUL-2001 16:12:17
Copyright (c) 1991, 2001, Oracle Corporation. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
The command completed successfully
LSNRCTL>
  关闭Oracle Web Server

cd $ORACLE_HOME/Apache/Apache/bin
./stopJServ.sh
/oracle/product/9.0.1/Apache/Apache/bin/apachectl stop: httpd stopped
  启动Oracle Web Server

cd $ORACLE_HOME/Apache/Apache/bin
[oracle@wing bin]$ ./startJServ.sh
/oracle/product/9.0.1/Apache/Apache/bin/apachectl start: httpd started
  启动Oracle Web Server后默认的端口号是7777
  在客户端浏览器地址栏输入http://xxx.xx.xxx.xxx:7777/
  如果浏览器出现以下界面则表示Oracle Web Server运行正常
That's it, good luck
--
Roko Roic

1. touch /etc/rac_on
可以修复dbca不能创建数据库的问题
2.关于"Error in invoking target install of makefile /opt/oracle/product/9.2.0/ctx/lib/ins_ctx.mk" 的错误用下面的方法更佳

Edit $ORACLE_HOME/ctx/lib/env_ctx.mk and go to "INSO_LINK =", add a "$(LDLIBFLAG)dl" to the line and save it.

Here is the full line with the added "$(LDLIBFLAG)dl" flag:
INSO_LINK = -L$(CTXLIB) $(LDLIBFLAG)m $(LDLIBFLAG)dl $(LDLIBFLAG)sc_ca $(LDLIBFLAG)sc_fa $(LDLIBFLAG)sc_ex $(LDLIBFLAG)sc_da $(LDLIBFLAG)sc_ut $(LDLIBFLAG)sc_ch $(LDLIBFLAG)sc_fi $(LLIBCTXHX) $(LDLIBFLAG)c -Wl,-rpath,$(CTXHOME)lib $(CORELIBS) $(COMPEOBJS)

After that hit retry in the error popup.(OVER)[email protected]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-2 22:36 , Processed in 0.041075 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表