免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6585 | 回复: 6

Centos 5.0安装Oracle9208手记 [复制链接]

论坛徽章:
0
发表于 2008-03-22 17:58 |显示全部楼层
Linux as 2.6.18-8.EL5 #1 smp
参考资料:
  1.“oracle9i installation on fedora core 6” http://jinlibing.javaeye.com/blog/39577
  2.“oracle8i-10i install on linux” http://www.oracle-base.com/articles/linux/ArticlesLinux.php
第二个里基本包含了所有的oracle9i-10i的安装
  3. Fedora 7最新安装Oracle9204手记 http://bbs.chinaunix.net/viewthread.php?tid=945880
一,解压缩Oracle9204的安装文件
1.        Oracle 9iR2 (9.2.0)
(1)        简化过程(以oracle登录,释放安装文件,使用更少的磁盘空间,速度更快)
在安装LINUX时最好分一个区/orasetup,这样一来即使系统坏了,也只是重装系统,而无须重新拷贝数据库安装文件.
在Linux下使用ISO文件:
Mkdir /mnt/iso1 iso2 iso3
mount -t iso9660 -o loop linux_ora9_d1.iso /mnt/iso1/
mount -t iso9660 -o loop linux_ora9_d2.iso /mnt/iso2/
mount -t iso9660 -o loop linux_ora9_d3.iso /mnt/iso3/
umount /mnt/isoX

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
(2) 解包和解压过程中,自动创建了3个包含安装文件的目录:
                Disk1
                Disk2
                Disk3
之后就可以安装Oracle9iR2了。
二,安装前的检查和准备工作;
1,        查看这些开发包是否已安装;
Centos  5.0完全安装.

安装需要的软件包和补丁包:
p4198954_21_linux.zip 在运行 runInstaller 之前打.
p3238244_9204_LINUX.zip 修复agent错误的补丁.
p2617419_210_GENERIC.zip 打3238244补丁所需要的补丁.
其中compat-oracle-rhel4和compat-libcwait可以在如下网站:
http://oss.oracle.com/projects/compat-oracle/files/RedHat/
# rpm -qa | grep ‘compat’
三,创建数据库安装的准备工作;
1,创建user/group;
#groupadd dba
#groupadd oinstall
#useradd oracle -g oinstall -G dba
#passwd oracle
2,建立oracle安装文件夹;
# mkdir -pv /u01/app/oracle/product/9.2.0
# chown -R oracle.dba /u01/app
# chmod -R 755 /u01/app/

# mkdir –pv /u01/cwdata
# chmod 755 /u01/cwdata
# chown oracle.dba /u01/cwdata
# chown –R oracle.dba /orasetup
# chmod 755 /orasetup

#mkdir /var/opt/oracle
#chown oracle.dba /var/opt/oracle
#chmod 755 /var/opt/oracle
#修改/etc/hosts 把x.x.x.x servername加入
把权限分配好

2,        配置环境变量;
    以root用户登录,设置root用户的环境打开.bash_profile文件,将如下内容加入:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/9.2.0
export PATH=$PATHORACLE_HOME/binORACLE_HOME/Apache/Apache/bin
export ORACLE_OWNER=oracle
export ORACLE_SID=oradb
export ORACLE_TERM=xterm
#export LD_ASSUME_KERNEL=2.4.19
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$LD_LIBRARY_PATHORACLE_HOME/lib
export ORACLE_OEM_JAVARUNTIME=/u01/app/oracle/jre1.3.1
export NLS_LANG=”American_america.zhs16gbk”
# export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export DISPLAY=:0.0
#export LANG=en_US
#export GDM_LANG= en_US
#export LC= en_US
使用Oracle用户登陆:
#su – oracle
#cp /etc/sysconfig/i18n /home/oracle/.i18n 然后修改LANG="en_US"
$vi .bash_profile
以下是配置文件的内容(其中红色字体为添加的内容)
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATHHOME/bin
#ORACLE_BASE 可以定位到盘阵上/data
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/9.2.0
export PATH=$PATHORACLE_HOME/binORACLE_HOME/Apache/Apache/bin
export ORACLE_OWNER=oracle
export ORACLE_SID=oradb
export ORACLE_TERM=xterm
#export LD_ASSUME_KERNEL=2.4.19
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$LD_LIBRARY_PATHORACLE_HOME/lib
export ORACLE_OEM_JAVARUNTIME=/u01/app/oracle/jre1.3.1
export NLS_LANG=”American_america.zhs16gbk”
# export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export DISPLAY=:0.0
export LANG=en_US
export GDM_LANG= en_US
export LC= en_US
export PATH
unset USERNAME
4,        设置系统参数;
  要检查内存空间,在命令行方式(bash环境)下执行如下命令:
#grep MemTotal /proc/meminfo  
要检查交换空间,在命令行下执行如下命令:
# grep SwapTotal /proc/meminfo

#su – root切换到root用户
a) 修改#vi /etc/sysctl.conf, 以下是配置文件的内容(其中红色字体为添加的内容):
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl( and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
#512M
kernel.shmmax = 536870912
# 268435456 (256M)
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
修改后运行#sysctl –p命令使得内核改变立即生效;
译者注:一般情况下可以设置最大共享内存为物理内存的一半,如果物理内存是 2G,则可以设置最大共享内存为 1073741824,如上;如物理内存是 1G,则可以设置最大共享内存为 512 * 1024 * 1024 = 536870912;以此类推。)
建议永久地增加 shmmax 设置。
sem 4个参数依次为SEMMSL(每个用户拥有信号量最大数);SEMMNS(系统信号量最大数);SEMOPM(每次semopm系统调用操作数);SEMMNI(系统辛苦量集数最大数).Shmmax 最大共享内存,官方文档建议是内存的1/2,Shmmni 最小共享内存 4096KB.Shmall 所有内存大小

B) 设置oracle对文件的要求:
编辑文件:#vi /etc/security/limits.conf 加入以下语句:
oracle    soft    nofile    65536
oracle    hard    nofile   65536
oracle    soft    nproc    16384
oracle    hard    nproc    16384

5,安装oracle补丁
当你从 Oracle 9iR2 光盘执行 runInstaller 时,会出现错误信息:
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
为了解决 _libc_wait 符号问题,
http://oss.oracle.com/projects/compat-oracle/files/RedHat/ 下载补丁
compat-libcwait-2.1-1.i386.rpm  为了应用这个补丁,可以运行:
$su – root
# cd /orasetup
#ls compat*.rpm
compat-libcwait-2.0-2.i386.rpm  
# rpm -Uvh compat*.rpm
Preparing...            ########################################### [100%]
  1: compat-libcwait-2.0-2.i386.rpm ##################################### [ 100%]
  

打p3006854_9204_LINUX.zip
# unzip p3006854_9204_LINUX.zip
# chmod +x 3006854/rhel3_pre_install.sh
# 3006854/rhel3_pre_install.sh

创建链接
# ln -s /usr/lib/libstdc++-libc6.2-2.so.3 /usr/lib/libstdc++-libc6.1-1.so.2

6,安装j2re
Download the Java Runtime Enviroment (j2re-1_3_1_20-linux-i586.bin) from the Sun website. Keep in mind you need    to download j2re1.3.1_11 or higher  
注意:下载jre jre1.3.1_2x 其中x为任意,但前面的版本不可改。

  Login as root and make the the file executable and then execute it. When the JRE is exracted move the    "jre1.3.1_20" di rectory to "/opt" directory.
  以root用户的登录执行下面的
  # chmod +x j2re-1_3_1_20-linux-i586.bin
  # ./j2re-1_3_1_20-linux-i586.bin
  # mv jre1.3.1_20 /u01/app/oracle/ jre1.3.1
四,开始安装oracle9iR2
(一)开始安装:
1.以oracle用户登录系统,进行Oracle的安装:
                $ cd Disk1
                $ ./runInstaller过一会儿就会出现Oracle的安装界面,如下图所示:

论坛徽章:
0
发表于 2008-03-22 18:02 |显示全部楼层
中间部分省略
.........
16,安装完后打补丁:
切换到root:#su – root 首先安装 opatch.
#cd /orasetup
#unzip p2617419_210_GENERIC.zip
Archive: p2617419_210_GENERIC.zip
creating: OPatch/
creating: OPatch/docs/
inflating: Opatch/docs/FAQ
......
inflating: README.txt
#export PATH=$PATH:/orasetup/ebf/OPatch:/sbin
(修改PATH时要要包括解压缩出来的Opatch 和 sbin目录)
# unzip p3238244_9204_LINUX.zip
# cd 3238244
# opatch apply
PERL5LIB=/u01/app/oracle/product/9.2.0/Apache/perl/lib/5.00503:/soft/oracle9i/OPatch/perl_modules; export PERL5LIB
/u01/app/oracle/product/9.2.0/Apache/perl/bin/perl /soft/oracle9i/OPatch/opatch.pl apply

OPatch Version 1.0.0.0.46
Perl Version 5.00503

Oracle Home = /u01/app/oracle/product/9.2.0
Location of Oracle Inventory = /u01/app/oracle/oraInventory
Oracle Universal Installer shared library = /u01/app/oracle/oui/bin/linux/liboraInstaller.so
Path to Java = /u01/app/oracle/jre/1.3.1/bin/java
Location of Oracle Inventory Pointer = /etc/oraInst.loc
Location of Oracle Universal Installer components = /u01/app/oracle/oui
Required Jar File under Oracle Universal Installer = lib/OraInstaller.jar


Please shut down Oracle instances running out of this ORACLE_HOME
(Oracle Home = /u01/app/oracle/product/9.2.0)
Is this system ready for updating?
Please respond Y|N >
y
Patching...
Updating inventory...
/soft/oracle9i/OPatch/opatch.pl version: 1.0.0.0.46
Copyright (c) 2001,2002,2003 Oracle Corporation. All Rights Reserved.


OPatch succeeded.
如果提示HOME变量错误可执行语句:
#export ORACLE_BASE=/u01/app/oracle
#export ORACLE_HOME=/u01/app/oracle/product/9.2.0
出现success的提示就全部安装成功.

补丁打完后,还要relinked一个.mk文件,切换到oracle用户窗口
cd $ORACLE_HOME/network/lib
make –f ins_oemagent.mk install
之后就可以启动Agent服务了.

17, 最后执行 #dbca  建oracle数据库

当你执行 dbca 时,会出现错误信息:(参考 我的的Fedora 7最新安装Oracle9204手记)
/u01/app/oracle/jre/1.1.8/bin/../lib/i686/green_threads/libzip.so: symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time reference (libzip.so)
Unable to initialize threads: cannot find class java/lang/Thread
Could not create Java VM
可以运行:
#su - oracle
$cd /u01/app/oracle/product/9.2.0
  $rm JRE
  $ln -s /u01/app/oracle/jre1.3.1 JRE
  $su -  
  # cd /u01/app/oracle/product/9.2.0/JRE/bin
  # ln -s java jre
  # cd i386/native_threads
# ln -s java jre


........


21,点击OK,然后退出即可,正常登陆并启动数据库的操作。
[oracle@oracle oracle]$ lsnrctl start
[oracle@oracle oracle]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.0 - Production on Sat Mar 12 22:58:53 2005
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> shutdown immediate  关闭数据库
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;   启动数据库
ORACLE instance started.
Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.

22, 数据库创建完成后,修改/etc/oratab,把oradb那一行最后的N改成Y,然后执行dbstart启动数据库数据库可能无法启动,报告Can’t find init file …的错误,需要复制一个初始化文件:
cp /u01/app/oracle/admin/oradb/pfile/ initoradb.ora*  /u01/app/oracle/product/9.2.0/dbs/initoradb.ora
重新执行dbstart就可以了。
为了方便管理,可以写一个启动脚本ora9i:
以root身份进入,编写以下脚本:

#!/bin/bash
#start and stop the oracle instance
# chkconfig –level 5 --add ora9i
#chkconfig: 345 91 19
# description: starts the oracle listener and instance

export ORACLE_HOME="/u01/app/oracle/product/9.2.0"
export PATH=$ORACLE_HOME/binORACLE_HOME/Apache/Apache/binPATH
export ORACLE_OWNER="oracle"
export ORACLE_SID=oradb

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
    echo "oracle startup:cannot start"
    exit 1
fi

case "$1" in
start)
  #startup the listener and instance
    echo -n "oracle startup: "
    su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
    su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbstart
    touch /var/lock/subsys/oracle
    echo "finished"
   ;;
stop)
# stop listener, apache and database
    echo -n "oracle shutdown:"
    su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
    su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbshut
    rm -f /var/lock/subsys/oracle
    echo "finished"
;;
reload|restart)
    $0 stop
    $0 start
;;
*)
   echo "Usage: ora9i [start|stop|reload|restart]"
   exit 1

esac
exit 0
注意:如果 cat –v ora9i 可以看到文件每行结尾有^M
去除^M的脚本为:
#sed 's/.$//' ora9i >ora9x
#mv ora9x ora9i


#mv ora9i ora9x
# dos2unix ora9x ora9i
存为ora9i后,然后用chmod a+x ora9,即可在以后以root身份运行/etc/rc.d/init.d/ora9i start |stop 来管理oracle的启动和停止了。如果要将这个脚本加入到系统中使其可开机运行,那么要运行以下命令:
#chkconfig –add ora9i
#chkconfig ora9i on
#chkconfig –list ora9i

也可自启动oracle9i!
或者可在/etc/rc.d/rc.local中加入如下:
su - oracle -c "/u01/app/oracle/product/9.2.0/bin/lsnrctl start"
su - oracle -c "/u01/app/oracle/product/9.2.0/bin/dbstart start"


添加listener.ora, tnsnames.ora
#cd  $ORACLE_HOME/network/admin
#vi listener.ora --网络监听
LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
  )

#vi tnsnames.ora --本地管理器所用
ORADB_hostname =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = oradb)
      (SERVER = DEDICATED)
    )
  )

23,
关于数据库删除重新安装的问题:
  把ORACLE安装目录删除及/etc/ora*.*删除就行了
#rm –f  /etc/ora*.*
或#dbca 删除数据后,再建数据,如果重新启动后,不能自动启动oracle就
#vi /etc/oratab
修改
*:/u01/app/oracle/product/9.2.0:Y
oradb:/u01/app/oracle/product/9.2.0:Y
24,关于在LINUX中运行管理软件
25,升级oracle9i为9.2.0.8
$ lsnrctl stop
$dbshut
# unzip p4547809_92080_LINUXfor_AS4.zip
#cd Disk1
$./runinstall
Starting Oracle Universal Installer...
Checking installer requirements...
Checking operating system version: must be SuSE-7, redhat-2.1AS, redhat-2.1, UnitedLinux-1.0, redhat-3, redhat-4, SuSE-8 or SuSE-9
                                      Failed <<<<
Exiting Oracle Universal Installer, log for this session can be found at /u01/app/oracle/oraInventory/logs/installActions2008-03-23_03-15-18PM.log $su –

#cd /Disk1/install
#vi  oraparam.ini (添加红色的)
[Certified Versions]
#You can customise error message shown for failure through CERTIFIED_VERSION_FAILURE_MESSAGE
Solaris=5.6,5.7,5.8,5.9
Linux=SuSE-7,redhat-2.1AS,redhat-2.1,UnitedLinux-1.0,redhat-3,redhat-4,redhat-5,SuSE-8,SuSE-9
HPUX=B.11.11
Decunix=V5.1A,V5.1
AIX=5.1.0.0

[Linux-redhat-4.0-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256

[Linux-redhat-5.0-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256

.......

升级后把 listener.ora .,tnsnames.ora拷贝到/u01/app/oracle/product/9.2.0/network/admin
下,并修改对应的(HOST = hostname).

[root@mail 9.2.0]# service ora9i start
oracle startup:
LSNRCTL for Linux: Version 9.2.0.8.0 - Production on 18-JAN-2008 19:56:44
Copyright (c) 1991, 2006, Oracle Corporation.  All rights reserved.
Starting /u01/app/oracle/product/9.2.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 9.2.0.8.0 - Production
System parameter file is /u01/app/oracle/product/9.2.0/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/9.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mail.domain.com)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mail)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 9.2.0.8.0 - Production
Start Date                18-JAN-2008 19:56:44
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mail.domain.com)(PORT=1521)))
The listener supports no services
The command completed successfully

SQL*Plus: Release 9.2.0.8.0 - Production on Fri Jan 18 19:56:45 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> Connected to an idle instance.
SQL> ORACLE instance started.

Total System Global Area  235999648 bytes
Fixed Size                   450976 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production

Database "oradb" warm started.
Finished

#oemapp
Usage: oemapp <application name>
The installed applications are: cpta, cp, ocm, worksheet, topsess, oemutil, dbastudio, console, lmviewer, esm, esmsrv, jdbctest, opm, txtmgr, sdoadvisor, ocmcli, pm, dataguard

[ 本帖最后由 wyckwemail 于 2008-3-22 18:24 编辑 ]

论坛徽章:
0
发表于 2008-03-22 18:05 |显示全部楼层
文档资料附后.
希望加精

论坛徽章:
0
发表于 2008-03-22 18:15 |显示全部楼层

文档资料

文档资料

论坛徽章:
0
发表于 2008-03-22 18:18 |显示全部楼层

文档资料

文档资料[local]1[/local]

论坛徽章:
0
发表于 2008-03-22 18:22 |显示全部楼层
附件怎么加不上?

论坛徽章:
0
发表于 2008-03-23 13:15 |显示全部楼层
恩,看不到你的文档资料哦
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP