LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 829|回复: 0

oracle10.2.01_x86_64_for_centos4.5实战安装

[复制链接]
发表于 2007-6-22 23:45:26 | 显示全部楼层 |阅读模式
+++++++++++++++++++++++++++++++++++
秀脱linux实战笔记之oracle10g篇:
下载该文章:oracle10.2.01_x86_64_for_centos4.5实战安装手册.txt
    QQ:    6541657
听电影-看字幕-打造欣赏电影-学习英语新模式
转载请表明出处:
http://hi.baidu.com/xiutuo/blog/ ... da0d4e510ffef8.html
EMAIL:xiutuo@gmail.com   

其他附件下载: dbstart   dbora                                                               

+++++++++++++++++++++++++++++++++++


○:安装环境说明
---------------------------------------------------------------------
1.操作系统centos4.5,内核:2.6.9-55.EL
   ip:192.168.1.159/255.255.255.0

2.oracle版本10.2.01,即Oracle 10g Release 2 (10.2) for Linux x86_64,
    软件包名10201_database_linux_x86_64.cpio.gz,64位版本

3.安装路径:/home/app/oracle/
   全局数据库名: db01            
            SID:   db01
 数据库字符集:简体中文ZHS16GBK
---------------------------------------------------------------------
   
一:安装系统
--------------------------------------------------------------------
1. 安装centos4.5,内核:2.6.9-55.EL
  安装方式的选项:
  ⊙   定制要安装的软件包(C)

  桌面选项:
  (√)   X窗口系统 (选取全部)

  (√)   GNOME桌面环境 (选取全部)

  应用程序选项:
  (   )   工程和科学 (选取默认)

  (√)   图形化互联网 (选取默认)

  (√)   基于文本的互联网 (选取默认)

  ( )   办公/生产率 (视个人情况选择)

  服务器选项:
  (√)   服务器配置工具 (选取全部)

  (   )   万维网服务器 (视个人情况选择)

  (   )   Windows文件服务器 (视个人情况选择)

  (   )   DNS服务器 (视个人情况选择)

     (   )   遗留服务 (视个人情况选择)
  
  开发选项:
  (√)   开发工具   (选择全部)
   
     (√)   原有开发工具   (全部选取)

  系统选项:
  (√)   管理工具   (选取默认)

  (   )   打印支持   (视个人情况选择)

      特别说明,由于这样的自定义安装没有安装libaio这个软件包

      等系统安装完后,通过yum -y install libaio安装libaio包   
      (在centos4.5光盘里找不到这个包,但是没有关系,通过
        # yum -y install libaio)
-----------------------------------------------------------
2.安装好系统后,请先检查oracle所必要的软件包。通过运行:

# rpm -q binutils compat-db control-center gcc
gcc-c++ glibc glibc-common gnome-libs libstdc++
libstdc++-devel make pdksh sysstat xscreensaver

确保:sysstat,libaio-i386,libaio-x86_64,libaio-devel包已安装

通过上面的查询少了哪些包,可以通过第一张光盘来进入Centos/Rpm目录
rpm -ivh 软件包名称
或者
yum -y install 软件包名称
俩种方式安装

安装好系统后,记得做个软连接,防止安装到86%的时候出错
# cd /usr/lib64/
# ln -s libstdc++.so.6 libstdc++.so.5



------------------------------------------------------------------


二:创建oracle用户和用户组、从属组
------------------------------------------------------------------
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
---------------------------------------------
id oracle    //查看相关信息,看起来类似如下:
---------------------------------------------
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/useradd -m -u 501 -g oinstall -G dba oracle

passwd oracle

------------------------------------------------
mkdir -p /home/app/oracle
chown -R oracleinstall /home/app/oracle
chmod -R 775 /home/app/oracle

三:设置oracle运行参数
------------------------------------------------------------------
1.设置sysctl.conf文件
------------------------------------
#vi /etc/sysctl.conf //添加一下几行

kernel.shmall = 2097152   
kernel.shmmax = 536870912
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 = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_max = 262144

#su - root
#sysctl -p    //使设置的值生效
-------------------------------------------------------------------
注释:
-----------------------------------------------
在安装oracle过程中有个检测内核参数的过程,
请随时留意你的默认内核参数和、oracle推荐的最基本的内核参数。
以更好的设置内核参数。
一般推荐:
kernel.shmall = 2097152   
kernel.shmmax = 536870912
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 = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_max = 262144
---------------------------------------------
其中shmmax后面的值根据cat /proc/sys/kernel/shmmax查询得到
(一般比查询出来的值相等或者更大就可以了)
其中kernel.sem后面的值根据semmsl,semmns,semopm,semmni来填写。
(一般比查询出来的值相等或者更大就可以了)
其中file-max后面的值根据cat /proc/sys/kernel/file-max查询得到
(一般比查询出来的值相等或者更大就可以了)
其中ip_local_port_range后面的值根据
cat /proc/sys/kernel/ip_local_port_range查询得到
(一般比查询出来的值相等或者更大就可以了)
To see all kernel parameters, execute:
su - root
sysctl -a

For Oracle10g, the following kernel parameters have to
be set to values greater than or equal to the recommended
values which can be changed in the proc filesystem:

shmmax   = 2147483648  
(To verify, execute: cat /proc/sys/kernel/shmmax)
shmmni   = 4096        
(To verify, execute: cat /proc/sys/kernel/shmmni)
shmall   = 2097152     
(To verify, execute: cat /proc/sys/kernel/shmall)    (for 10g R1)
shmmin   = 1           
(To verify, execute: ipcs -lm |grep "min seg size")
shmseg   = 10         
(It's hardcoded in the kernel - the default is much higher)

semmsl   = 250         
(To verify, execute: cat /proc/sys/kernel/sem | awk '{print $1}')
semmns   = 32000      
(To verify, execute: cat /proc/sys/kernel/sem | awk '{print $2}')
semopm   = 100         
(To verify, execute: cat /proc/sys/kernel/sem | awk '{print $3}')
semmni   = 128         
(To verify, execute: cat /proc/sys/kernel/sem | awk '{print $4}')

file-max = 65536         
(To verify, execute: cat /proc/sys/fs/file-max)

ip_local_port_range = 1024 65000
                        
(To verify, execute: cat /proc/sys/net/ipv4/ip_local_port_range)


----------------------------------------------------------------

-------------------------------------------------
2.设置limits.conf
# cat >> /etc/security/limits.conf << EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
-------------------------------------------------
3.设置login
# cat >> /etc/pam.d/login << EOF
session required /lib/security/pam_limits.so
EOF
------------------------------------------------
4.设置profile
# cat >> /etc/profile << EOF
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
      ulimit -p 16384
      ulimit -n 65536
else
     ulimit -u 16384 -n 65536
    fi
    umask 022
fi
EOF
--------------------------------------------------
5.设置csh.login
# cat >> /etc/csh.login << EOF
if ( \$USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
EOF
---------------------------------------------------
6.设置rc.local
# cat >> /etc/rc.d/rc.local << EOF
modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
EOF
---------------------------------------------------

三:设置oracle的环境变量
使用oracle用户登入:
$ vi .bash_profile    //增加如下几行
export ORACLE_BASE=/home/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=db01
export PATH=.{PATH}HOME/binORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/jre
export CLASSPATH=${CLASSPATH}ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
export NLS_LANG=american_america.WE8ISO8859P1

设置以上参数后,重器机器吧。
-------------------------------------------------------------------------

四:安装oracle

1.以oracle用户登入xwindows,进入10201_database_linux_x86_64.cpio.gz所在目录
$ # cd /home/
$ # su -
# # gunzip 10201_database_linux_x86_64.cpio.gz
   # cpio -idcmv<10201_database_linux_x86_64.cpio
# #ls //其中database就是解压后的oracle目录
# # chown -R oracleinstall database
# # exit
$ $ sh runInstaller

  经过一小段的时间,会出现“选择安装方法”的信息窗口;

  点选“高级安装(A)”,继续安装请单击“下一步(N)”按键;

  同时“终端”窗口也会出现以下的提示信息:

  进入“指定产品清单目录和身份证明”窗口:


  继续安装请单击“下一步(N)”按键;

  检查产品清单目录和身份证明的过程如下图:

  进入“选择安装类型”窗口,点选“企业版(E)(1.26GB)”,
     继续安装请单击“下一步(N)”按键;

  进入“指定主目录详细信息”窗口:

  名称(M):db01

  路径(A):/home/oracle/oracle/product/10.2.0/db_1 (本例子使用默认路径)
             或者:
             /oracle/product/10.2.0/db_1

  继续安装请单击“下一步(N)”按键;

  进入“产品特定的选决条件检查”窗口,经过一小段时间检查,
     会出现以下的检查信息窗口;

  在“正在检查网络配置需要”项目内,选中状态栏目的内容,
     继续安装请单击“下一步(N)”按键;

  
  进入“选择配置选项”窗口,点选“创建数据库(C)” ,
     继续安装请单击“下一步(N)”按键;

  进入“选择数据库配置”窗口,点选“一般用途(G)” ,
     继续安装请单击“下一步(N)”按键;

  进入“指定数据库配置选项”窗口:

  数据库命名中的:

  全局数据库名: db01             SID: db01

  数据库字符集:

  简体中文ZHS16GBK   

  继续安装请单击“下一步(N)”按键;

  进入“选择数据库管理选项”窗口,点选“使用Database Control管理数据库”,
     继续安装请单击“下一步(N)”按键;

  进入“指定数据库存储选项”窗口,点选“文件系统”:

  指定数据库文件位置:/home/oracle/oracle/product/10.2.0/oradta/

  继续安装请单击“下一步(N)”按键;

  进入“指定备份和恢复选项”窗口,点选“不启用自动备份”,
     继续安装请单击“下一步(N)”按键;

  进入“指定数据库方案的口令”窗口:

  点选“所有的帐户都使用同一个口令”:

  输入口令: 1234567         确认口令: 1234567

  口令处理过程如下图,继续安装请单击“下一步(N)”按键;

  进入“概要信息”窗口,继续安装请单击“下一步(N)”按键;

  进入“安装”窗口,详细安装如下图片;

  A、安装部分图片;

  
  B、复制文件部分;

  C、连接数据系统部分;

  D、设置数据系统部分;

  进入“配置助手”窗口:

  配置:Oracle Net Configuration Assistant

  配置:Oracle Database Configuration Assistant时:

  会出现“Database Configuration Assistant”新窗口,详细配置过程:

  A、正在复制数据库文件;

  B、正在创建并启动Oracle实例;

  C、正在进行数据库创建;

  完成以上三个部分,会出现一个数据库创建完成信息提示窗口,点击“确定”按键

  配置:iSQL*Plus配置辅助程序

  配置过程中,会出现一个执行配置脚本信息提示窗口,详细信息如下图:

  执行orainstRoot.sh脚本的详细过程:

  点击“任务栏” → “应用程序” → “系统工具”   → “终端”:

  转换用户和执行orainstRoot.sh脚本的详细过程:

  详细操作:
  $ su root (转换成root超级用户环境)

  Password:   123456(输入root用户的密码)

  # /home/app/oracle/oraInventory/orainstRoot.sh (输入执行脚本的详细路径)

  执行root.sh脚本的详细过程:

  详细操作:
  # /home/app/oracle/product/10.2.0/db_1/root.sh (输入执行脚本的详细路径)

  执行完成orainstRoot.sh、root.sh脚本后,关闭“超级用户的终端”,
     回到“执行配置脚本”提示窗口,继续安装请单击“确定”按键;

  进入“安装结束”窗口,退出安装程序请单击“退出(X)”按键;

------------------------------------------------------------------------------

六:启动数据库
以oracle用户登入
1.启动listener
   $ lsnrctl start|stop
2.启动数据库
   $ sqlplus /nolog
   >conn /as sysdba
   >startup     //启动
   >shutdown    //关闭
   >alter user system identified by 密码; //修改ys,system,systeman密码,记得结尾有分号
   >alter user sys identified by 密码;
   >alter user systeman identified by 密码;
   >select username,password from dba_users;

五:安装时出现的错误
#--------------------------
#安装错误:
#
#用DBCA创建数据库时,出现ora-12547 tns lost contact错误
#
#已解决:安装libaio的x86包和libaio包
在centos4.5光盘里找不到这个包,但是没有关系,通过
# yum -y install libaio
#命令安装即可
#---------------------------


七:开机自动启动数据库
使用俩个脚本:
    dbstart启动数据库
    dbshut关闭数据库
1.创建/etc/orata文件
用root用户登入,编辑/etc/orata文件

# vi /etc/oratab
SID:ORACLE_HOME:{Y|N|W}
改成
SID:ORACLE_HOME:Y
---------------------------------------------------------
注释:
如果有多个数据库实列,需要多增加几条
SID:ORACLE_HOME:Y

In this example, the values Y and N specify whether you want the scripts
to start up or shut down the database, respectively. For each database
for which you want to automate shutdown and startup,
first determine the instance identifier (SID) for that database,
which is identified by the SID in the first field.
Then, change the last field for each to Y.

You can set dbstart to autostart a single-instance database that uses
an Automatic Storage Management installation that is auto-started by
Oracle Clusterware. This is the default behavior for an Automatic
Storage Management cluster. If you want to do this, then you must
change the oratab entry of the database and the Automatic Storage
Management installation to use a third field with the value W and N,
respectively. These values specify that dbstart auto-starts the
database only after the Automatic Storage Management instance is started.

Note:

If you add new database instances to the system and if you want to
automate startup for them, then you must edit the entries for those
instances in the oratab file.Change directory to one of
the following depending on your operating system.
------------------------------------------------------------

2.创建开机启动脚本/etc/init.d/dbora文件

Linux and Solaris平台初始化目录 /etc/init.d
在此目录下增加一个dbora文件,并增加以下内容

#!/bin/bash
#/etc/init.d/dbora
#开机启动需要建立相关连接
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
# description: init script to start/stop oracle database 10g, TNS listener, EMS
#
#
#改成oracle安装路径
export ORACLE_HOME=/home/app/oracle/product/10.2.0/db_1
#
export ORACLE_SID=db01
export PATH=$PATHORACLE_HOME/bin
ORA_OWNR="oracle"
# Check if the oracle installed
# Warning: if $ORACLE_HOME dir not accessiable for other user
# this will get the wrong result!
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: Cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown restart
case "$1" in
start)
#Oracle listenner and instance startup
echo -n "Starting Oracle: "
su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle
#su $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctl start"
#su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
#Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop LISTENER"
rm -f /var/lock/oracle
#su $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctl stop"
#su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|reload|restart"
exit 1
esac
exit 0
#

----------------------------------------------------------------
注释:这个脚本只能用来停止Oracle Net listener,
因为oralce用户的密码没有设置,如果listener name不是默认的值的话,
你必须在stop 和 start命令里指定listener name,如:
$ORACLE_HOME/bin/lsnrctl {start|stop} listener_name
----------------------------------------------------------------

改变dbora的所属组为dba,设置dbora的权限750

# chgrp dba dbora
# chmod 750 dbora

建立软连接

Linux
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora

当测试/etc/init.d/dbora start出现Oracle startup: Cannot start时,
请修改dbora脚本中export ORACLE_HOME=后的oracle安装路径。

由于该dbora脚本是调用dbstart,dbshut这俩个脚本来启动,关闭数据库的,
所以必须先测试dbstart和dbshut,测试方法:
切换到oracle用户:
# su - oracle
$ dbstart
或者
---------------------------------------
//切换到oracle安装目录的bin目录
$ cd /home/app/oracle/product/10.2.0/db_1/bin/
$./dbstart
---------------------------------------
如果出现:
Failed to auto-start Oracle Net Listene using
/ade/vikrkuma_new/oracle/bin/tnslsnr

解决方法:
$ cd /home/app/oracle/product/10.2.0/db_1/bin/
$ vi dbstart
修改 ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle 为
ORACLE_HOME_LISTNER=$ORACLE_HOME

附件:本文实践的正确的dbora,和dbstart文件
dbora(/etc/init.d/dbora)
dbstart(/home/app/oracle/product/10.2.0/db_1/bin/dbstart)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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