首页 > 代码库 > CentOS 5 上安装Oracle10g
CentOS 5 上安装Oracle10g
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/40180579
1. 域名解析设置及网络配置
# vi /etc/hosts 127.0.0.1 localhost.localdomain localhost::1 localhost6.localdomain6 localhost6192.168.56.103 hyl
# vi /etc/sysconfig/network-scripts/ifcfg-eth0--修改网卡配置--若在安装系统时设置,此处可不进行修改# Intel Corporation 82540EM Gigabit Ethernet ControllerDEVICE=eth0BOOTPROTO=staticIPADDR=192.168.56.103NETMASK=255.255.255.0HWADDR=08:00:27:29:DB:B2ONBOOT=yes~
# service network restart--重启网卡使其生效# vi /etc/sysconfig/networkNETWORKING=yesNETWORKING_IPV6=noHOSTNAME=hyl~
2. 安装包
根据官方文档准备rpm包,上传至服务器
需要的包如下所示:
执行脚本实现:
#vi CentOS5.6-10g-script.sh--脚本实现两种功能--功能1:安装rpm包并记录日志,安装后删除相关包--功能2:检查安装的rpm包并记录日志rpm -ivh binutils-2.17.50.0.6-14.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh binutils-devel-2.17.50.0.6-14.el5.i386.rpm >> rpm.log 2>&1 rpm -ivh binutils-devel-2.17.50.0.6-14.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh compat-db-4.2.52-5.1.i386.rpm >> rpm.log 2>&1rpm -ivh compat-db-4.2.52-5.1.x86_64.rpm >> rpm.log 2>&1rpm -ivh control-center-2.16.0-16.el5.i386.rpm >> rpm.log 2>&1rpm -ivh control-center-2.16.0-16.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh control-center-devel-2.16.0-16.el5.i386.rpm >> rpm.log 2>&1rpm -ivh control-center-devel-2.16.0-16.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh gcc-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh gcc-c++-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh glibc-2.5-58.i686.rpm >> rpm.log 2>&1rpm -ivh glibc-2.5-58.x86_64.rpm >> rpm.log 2>&1rpm -ivh glibc-common-2.5-58.x86_64.rpm >> rpm.log 2>&1rpm -ivh glibc-devel-2.5-58.i386.rpm >> rpm.log 2>&1rpm -ivh glibc-devel-2.5-58.x86_64.rpm >> rpm.log 2>&1rpm -ivh glibc-headers-2.5-58.x86_64.rpm >> rpm.log 2>&1rpm -ivh glibc-utils-2.5-58.x86_64.rpm >> rpm.log 2>&1rpm -ivh libstdc++-devel-4.1.2-50.el5.i386.rpm >> rpm.log 2>&1rpm -ivh libstdc++-devel-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh libX11-1.0.3-11.el5.i386.rpm >> rpm.log 2>&1rpm -ivh libX11-1.0.3-11.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh libX11-devel-1.0.3-11.el5.i386.rpm >> rpm.log 2>&1rpm -ivh libX11-devel-1.0.3-11.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh libXp-1.0.0-8.1.el5.i386.rpm >> rpm.log 2>&1rpm -ivh libXp-1.0.0-8.1.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh libXp-devel-1.0.0-8.1.el5.i386.rpm >> rpm.log 2>&1rpm -ivh libXp-devel-1.0.0-8.1.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh libXpm-3.5.5-3.i386.rpm >> rpm.log 2>&1rpm -ivh libXpm-3.5.5-3.x86_64.rpm >> rpm.log 2>&1rpm -ivh libXpm-devel-3.5.5-3.i386.rpm >> rpm.log 2>&1rpm -ivh libXpm-devel-3.5.5-3.x86_64.rpm >> rpm.log 2>&1rpm -ivh make-3.81-3.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh pdksh-5.2.14-36.el5.x86_64.rpm >> rpm.log 2>&1rpm -ivh sysstat-7.0.2-3.el5_5.1.x86_64.rpm >> rpm.log 2>&1 rm -rf binutils-2.17.50.0.6-14.el5.x86_64.rpmrm -rf binutils-devel-2.17.50.0.6-14.el5.i386.rpmrm -rf binutils-devel-2.17.50.0.6-14.el5.x86_64.rpmrm -rf compat-db-4.2.52-5.1.i386.rpmrm -rf compat-db-4.2.52-5.1.x86_64.rpmrm -rf control-center-2.16.0-16.el5.i386.rpmrm -rf control-center-2.16.0-16.el5.x86_64.rpmrm -rf control-center-devel-2.16.0-16.el5.i386.rpmrm -rf control-center-devel-2.16.0-16.el5.x86_64.rpmrm -rf gcc-4.1.2-50.el5.x86_64.rpmrm -rf gcc-c++-4.1.2-50.el5.x86_64.rpmrm -rf glibc-2.5-58.i686.rpmrm -rf glibc-2.5-58.x86_64.rpmrm -rf glibc-common-2.5-58.x86_64.rpmrm -rf glibc-devel-2.5-58.i386.rpmrm -rf glibc-devel-2.5-58.x86_64.rpmrm -rf glibc-headers-2.5-58.x86_64.rpmrm -rf glibc-utils-2.5-58.x86_64.rpmrm -rf libstdc++-devel-4.1.2-50.el5.i386.rpmrm -rf libstdc++-devel-4.1.2-50.el5.x86_64.rpmrm -rf libX11-1.0.3-11.el5.i386.rpmrm -rf libX11-1.0.3-11.el5.x86_64.rpmrm -rf libX11-devel-1.0.3-11.el5.i386.rpmrm -rf libX11-devel-1.0.3-11.el5.x86_64.rpmrm -rf libXp-1.0.0-8.1.el5.i386.rpmrm -rf libXp-1.0.0-8.1.el5.x86_64.rpmrm -rf libXp-devel-1.0.0-8.1.el5.i386.rpmrm -rf libXp-devel-1.0.0-8.1.el5.x86_64.rpmrm -rf libXpm-3.5.5-3.i386.rpmrm -rf libXpm-3.5.5-3.x86_64.rpmrm -rf libXpm-devel-3.5.5-3.i386.rpmrm -rf libXpm-devel-3.5.5-3.x86_64.rpmrm -rf make-3.81-3.el5.x86_64.rpmrm -rf pdksh-5.2.14-36.el5.x86_64.rpmrm -rf sysstat-7.0.2-3.el5_5.1.x86_64.rpmrpm -qa|grep binutils >> queryrpm.log 2>&1rpm -qa|grep compat >> queryrpm.log 2>&1rpm -qa|grep control >> queryrpm.log 2>&1rpm -qa|grep gcc >> queryrpm.log 2>&1rpm -qa|grep glibc >> queryrpm.log 2>&1rpm -qa|grep gnome >> queryrpm.log 2>&1rpm -qa|grep libstdc++ >> queryrpm.log 2>&1rpm -qa|grep make >> queryrpm.log 2>&1rpm -qa|grep pdksh >> queryrpm.log 2>&1rpm -qa|grep sysstat >> queryrpm.log 2>&1#sh CentOS5.6-10g-script.sh
3. 创建用户、组、目录
# groupadd oinstall# groupadd dba# useradd -g oinstall -G dba oracle# passwd oracleChanging password for user oracle.New UNIX password: oracleBAD PASSWORD: it is based on a dictionary wordRetype new UNIX password: oraclepasswd: all authentication tokens updated successfully.# id oracleuid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)# mkdir -p /home/u01/app/oracle# mkdir -p /home/u01/app/oracle/oraInventory# chown -R oracle:oinstall /home/u01/app/oracle# chmod -R 775 /home/u01/app/oracle
4. 配置内核参数、修改环境变量
# vi /etc/sysctl.conf添加:kernel.shmall = 4294967296kernel.shmmni = 4096kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65500net.core.rmem_default = 4194304net.core.wmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_max = 262144~# sysctl -p--使内核参数生效# su - oracle$ vi .bash_profile--修改oracle用户的环境配置文件--执行:su - oracle 切换到oracle用户环境,然后编辑 .bash_profile 文件,更改PATH的配置,同时在环境变量中增加NLS_LANG的配置ORACLE_BASE=/home/u01/app/oracleORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1ORACLE_SID=hylPATH=$PATH:$HOME/bin:$ORACLE_HOME/binLD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/libexport ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH
5. 设置shell限制
--添加以下参数
# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# vi /etc/pam.d/login
--添加以下参数
session required /lib/security/pam_limits.so
session required pam_limits.so
# vi /etc/profile --添加以下参数
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
--在/etc/profile文件中修改以下内容
ulimit –s –c 0 >/dev/null 2> &1 修改为
ulimit –s –c unlimited >/dev/null 2> &1
6. 解压安装包、修改版本检查
下面列举针对不同压缩包时,我们具体的应对方法,以下列举较为常见的三种包格式。
(例1)、解压.cpio.gz格式包
# zcat 10201_database_linux_x86_64.cpio.gz | cpio -idmv > /dev/null 2>&1
(例2)、解压.cpio格式包
# cpio -idmv < 10201_database_linux_x86_64.cpio
(例3)、解压.zip
# unzip p8202632_10205_Linux-x86-64.zip
# vi /home/oracle/downloads/database/install/oraparam.ini
--添加redhat-5如下所示
[Certified Versions]
Linux=redhat-5,redhat-3,SuSE-9,redhat-4,UnitedLinux-1.0,asianux-1,asianux-2
7. 图形化安装oracle、dbca建库、netca配置监听
(略)
说明:由于图形化安装非常简单,可以尝试自己摸索安装练习,或参阅我的其它文章,链接地址如下:
CentOS5.6下安装Oracle10G软件 【保留报错经验】
dbca 建库、配置监听、导入数据(CentOS5.6+Oracle10G)
8. 配置开机启动实例
# vi /etc/rc.d/rc.local
--添加开机启动实例、监听语句
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don‘t
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
su - oracle -c "/home/u01/app/oracle/product/10.2.0/db_1/bin/dbstart start"
su - oracle -c "/home/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl start"
~
~
~
# vi /etc/oratab --修改开机启动,将值由N设为Y
hyl:/home/u01/app/oracle/product/10.2.0/db_1:Y
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/40180579
CentOS 5 上安装Oracle10g