CentOS 5 上安装Oracle11g

时间:2021-12-30 23:10:56

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/40180867

1. 域名解析设置及网络配置

# vi /etc/hosts

127.0.0.1         localhost.localdomain localhost

::1               localhost6.localdomain6 localhost6

192.168.56.103    hyl

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

--修改网卡配置

--若在安装系统时设置,此处可不进行修改

# Intel Corporation 82540EM Gigabit Ethernet Controller

DEVICE=eth0

BOOTPROTO=static

IPADDR=192.168.56.103

NETMASK=255.255.255.0

HWADDR=08:00:27:29:DB:B2

ONBOOT=yes

~

# service network restart

--重启网卡使其生效

# vi /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=hyl

2. 安装包

根据官方文档准备rpm包,上传至服务器

需要的包如下所示:

CentOS 5 上安装Oracle11g

执行脚本实现:

#vi CentOS5.6-11g-script.sh

--脚本实现两种功能

--功能1:安装rpm包并记录日志,安装后删除相关包

--功能2:检查安装的rpm包并记录日志

rpm -ivh binutils-2.17.50.0.6-14.el5.x86_64.rpm >> rpm.log 2>&1
rpm -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>&1
rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm >> rpm.log 2>&1
rpm -ivh compat-libstdc++-33-3.2.3-61.x86_64.rpm >> rpm.log 2>&1
rpm -ivh elfutils-libelf-0.137-3.el5.i386.rpm >> rpm.log 2>&1
rpm -ivh elfutils-libelf-0.137-3.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh elfutils-libelf-devel-0.137-3.el5.i386.rpm >> rpm.log 2>&1
rpm -ivh elfutils-libelf-devel-0.137-3.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh elfutils-libelf-devel-static-0.137-3.el5.i386.rpm >> rpm.log 2>&1
rpm -ivh elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh gcc-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh gcc-c++-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh glibc-2.5-58.i686.rpm >> rpm.log 2>&1
rpm -ivh glibc-2.5-58.x86_64.rpm >> rpm.log 2>&1
rpm -ivh glibc-common-2.5-58.x86_64.rpm >> rpm.log 2>&1
rpm -ivh glibc-devel-2.5-58.i386.rpm >> rpm.log 2>&1
rpm -ivh glibc-devel-2.5-58.x86_64.rpm >> rpm.log 2>&1
rpm -ivh glibc-headers-2.5-58.x86_64.rpm >> rpm.log 2>&1
rpm -ivh libaio-0.3.106-5.i386.rpm >> rpm.log 2>&1
rpm -ivh libaio-0.3.106-5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh libaio-devel-0.3.106-5.i386.rpm >> rpm.log 2>&1
rpm -ivh libaio-devel-0.3.106-5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh libao-0.8.6-7.i386.rpm >> rpm.log 2>&1
rpm -ivh libao-0.8.6-7.x86_64.rpm >> rpm.log 2>&1
rpm -ivh libgcc-4.1.2-50.el5.i386.rpm >> rpm.log 2>&1
rpm -ivh libgcc-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh libstdc++-4.1.2-50.el5.i386.rpm >> rpm.log 2>&1
rpm -ivh libstdc++-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh libstdc++-devel-4.1.2-50.el5.i386.rpm >> rpm.log 2>&1
rpm -ivh libstdc++-devel-4.1.2-50.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh make-3.81-3.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh numactl-0.9.8-11.el5.i386.rpm >> rpm.log 2>&1
rpm -ivh numactl-0.9.8-11.el5.x86_64.rpm >> rpm.log 2>&1
rpm -ivh pdksh-5.2.14-36.el5.x86_64.rpm >> rpm.log 2>&1
rpm -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.rpm
rm -rf binutils-devel-2.17.50.0.6-14.el5.i386.rpm
rm -rf binutils-devel-2.17.50.0.6-14.el5.x86_64.rpm
rm -rf compat-libstdc++-33-3.2.3-61.i386.rpm
rm -rf compat-libstdc++-33-3.2.3-61.x86_64.rpm
rm -rf elfutils-libelf-0.137-3.el5.i386.rpm
rm -rf elfutils-libelf-0.137-3.el5.x86_64.rpm
rm -rf elfutils-libelf-devel-0.137-3.el5.i386.rpm
rm -rf elfutils-libelf-devel-0.137-3.el5.x86_64.rpm
rm -rf elfutils-libelf-devel-static-0.137-3.el5.i386.rpm
rm -rf elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm
rm -rf gcc-4.1.2-50.el5.x86_64.rpm
rm -rf gcc-c++-4.1.2-50.el5.x86_64.rpm
rm -rf glibc-2.5-58.i686.rpm
rm -rf glibc-2.5-58.x86_64.rpm
rm -rf glibc-common-2.5-58.x86_64.rpm
rm -rf glibc-devel-2.5-58.i386.rpm
rm -rf glibc-devel-2.5-58.x86_64.rpm
rm -rf glibc-headers-2.5-58.x86_64.rpm
rm -rf libaio-0.3.106-5.i386.rpm
rm -rf libaio-0.3.106-5.x86_64.rpm
rm -rf libaio-devel-0.3.106-5.i386.rpm
rm -rf libaio-devel-0.3.106-5.x86_64.rpm
rm -rf libao-0.8.6-7.i386.rpm
rm -rf libao-0.8.6-7.x86_64.rpm
rm -rf libgcc-4.1.2-50.el5.i386.rpm
rm -rf libgcc-4.1.2-50.el5.x86_64.rpm
rm -rf libstdc++-4.1.2-50.el5.i386.rpm
rm -rf libstdc++-4.1.2-50.el5.x86_64.rpm
rm -rf libstdc++-devel-4.1.2-50.el5.i386.rpm
rm -rf libstdc++-devel-4.1.2-50.el5.x86_64.rpm
rm -rf make-3.81-3.el5.x86_64.rpm
rm -rf numactl-0.9.8-11.el5.i386.rpm
rm -rf numactl-0.9.8-11.el5.x86_64.rpm
rm -rf pdksh-5.2.14-36.el5.x86_64.rpm
rm -rf sysstat-7.0.2-3.el5_5.1.x86_64.rpm 
rpm -qa|grep binutils >> queryrpm.log 2>&1
rpm -qa|grep compat-libstdc >> queryrpm.log 2>&1
rpm -qa|grep elfutils >> queryrpm.log 2>&1
rpm -qa|grep gcc >> queryrpm.log 2>&1
rpm -qa|grep glibc >> queryrpm.log 2>&1
rpm -qa|grep kernel >> queryrpm.log 2>&1
rpm -qa|grep ksh >> queryrpm.log 2>&1
rpm -qa|grep libaio >> queryrpm.log 2>&1
rpm -qa|grep libgcc >> queryrpm.log 2>&1
rpm -qa|grep libgomp >> queryrpm.log 2>&1
rpm -qa|grep libstdc++- >> queryrpm.log 2>&1
rpm -qa|grep make >> queryrpm.log 2>&1
rpm -qa|grep sysstat >> queryrpm.log 2>&1

3. 创建用户、组、目录

# groupadd oinstall

# groupadd dba

# useradd -g oinstall -G dba oracle

# passwd oracle

Changing password for user oracle.

New UNIX password:oracle

BAD PASSWORD: it is based on a dictionary word

Retype new UNIX password:oracle

passwd: all authentication tokens updated successfully.

# id oracle

uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)

# mkdir -p /home/u01/app/oracle

# mkdir -p /home/u01/app/oraInventory

# chown -R oracle:oinstall /home/u01/app

# chmod -R 775 /home/u01/app 

4. 配置内核参数、修改环境变量

# vi /etc/sysctl.conf

添加:

kernel.shmall = 4294967296

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65500

net.core.rmem_default = 4194304

net.core.wmem_default = 262144

net.core.rmem_max = 4194304

net.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/oracle

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

ORACLE_SID=hyl

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

export 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. 解压安装包

例:解压.zip

# unzip p13390677_112040_Linux-x86-64_1of7.zip

# unzip p13390677_112040_Linux-x86-64_2of7.zip 

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/11.2.0/db_1/bin/dbstart start"

su - oracle -c "/home/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start"

~

~

~

# vi /etc/oratab   --修改开机启动,将值由N设为Y

hyl:/home/u01/app/oracle/product/11.2.0/db_1:Y

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/40180867 

 

系列链接_20150523:

蓝的成长记——追逐DBA(1):奔波于路上,挺进山东 

蓝的成长记——追逐DBA(2):安装!安装!久违的记忆,引起我对DBA的重新认知

蓝的成长记——追逐DBA(3):古董上操作,数据导入导出成了问题 

蓝的成长记——追逐DBA(4):追忆少年情愁,再探oracle安装(Linux下10g、11g) 

蓝的成长记——追逐DBA(5):不谈技术谈业务,恼人的应用系统

蓝的成长记——追逐DBA(6): 做事与做人:小技术,大为人

蓝的成长记——追逐DBA(7):基础命令,地基之石 

蓝的成长记——追逐DBA(8):重拾SP报告,回忆oracle的STATSPACK实验

蓝的成长记— —追逐DBA(9):国庆渐去,追逐DBA,新规划,新启程

蓝的成长记——追逐DBA(10):飞刀防身,熟络而非专长:摆弄中间件Websphere 

蓝的成长记——追逐DBA(11):回家后的安逸,晕晕乎乎醒了过来 

蓝的成长记——追逐DBA(12):七天七收获的SQL

蓝的成长记——追逐DBA(13):协调硬件厂商,六个故事:所见所感的“服务器、存储、交换机......”

蓝的成长记——追逐DBA(14):难忘的“云”端,起步的hadoop部署 

蓝的成长记——追逐DBA(15):以为FTP很“简单”,谁成想一波三折

蓝的成长记——追逐DBA(16):DBA也喝酒,被捭阖了