Linux上安装Oracle11G详细步骤

修改系统参数

  • 使用文本编辑器,编辑/etc/sysctl.conf文件,并添加或编辑以下数据:
fs.aio-max-nr = 1048576 
fs.file-max = 6815744 
kernel.shmall = 2097152 
kernel.shmmax = 536870912 
kernel.shmmni = 4096  
kernel.sem = 250 32000 100 128  
net.ipv4.ip_local_port_range = 9000 65500 
net.core.rmem_default = 262144 
net.core.rmem_max = 4194304 
net.core.wmem_default = 262144 
net.core.wmem_max = 1048586  
  • 输入下面的命令使内核修改的参数值立即生效
/sbin/sysctl -p 
sysctl -p 
  • 使用文本编辑器,编辑/etc/security/limits.conf文件,并添加或编辑以下数据:
oracle           soft    nproc   2047 
oracle           hard    nproc   16384 
oracle           soft    nofile  1024 
oracle           hard    nofile  65536
  • 使用文本编辑器,编辑/etc/pam.d/login文件,并添加或编辑以下数据:
session    required     pam_limits.so
  • 使用文本编辑器,编辑/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

安装依赖包

  • 需要的依赖包
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-2.5-24 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5 (32 bit)
glibc-headers-2.5
ksh-20060214
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libaio-devel-0.3.106 (32 bit)
libgcc-4.1.2
libgcc-4.1.2 (32 bit)
libstdc++-4.1.2
libstdc++-4.1.2 (32 bit)
libstdc++-devel 4.1.2
make-3.81
sysstat-7.0.2
  • 安装依赖包
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install libXp* -y
yum install -y glibc-kernheaders
  • 检查依赖包,缺失某个包时继续安装缺失的包
rpm -q --queryformat %-{name}-%{version}-%{release}-%{arch}" " compat-libstdc++-33 glibc-kernheaders glibc-headers libaio libgcc glibc-devel xorg-x11-deprecated-libs

开始安装Oracle

  • 新建用户,Oracle相关目录
useradd oracle
passwd oracle
su - oracle
mkdir -p /home/oracle/app/oracle
  • 配置环境变量(Oracle用户目录下的)/home/oracle/.bash_profile
# vim /home/oracle/.bash_profile

#Oracle
export ORACLE_BASE=/home/oracle/app/oracle
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
 
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib
export CLASSPATH=$CLASSPATH:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/jlib:$ORACLE_HOME/network/lib
#export LANG=en_US.UTF-8
#export NLS_LANG=american_america.ZHS16GBK
  • 解压安装包
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
  • Linux安装准备(xshell)
# 使用oracle用户进行。安装需要在图形界面(在控制台或者用X-Window工具软件)。打开一个终端窗口,执行如下命令进行安装:
# DISPLAY中设置本机IP,而非服务器IP,本机上开启Xmanager
export DISPLAY=本机IP:0.0
# 输入xclock测试,如果能够看见时钟证明图形化可用
yum install tigervnc tigervnc-server
  • 执行安装脚本
[root@local ~]$ su - oracle
[oracle@local ~]$ cd /home/oracle/database/
[oracle@local database]$ ./runInstaller
Starting Oracle Universal Installer...
 
Checking Temp space: must be greater than 120 MB. Actual 21658 MB Passed
Checking swap space: must be greater than 150 MB. Actual 2047 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-23_12-18-01PM. Please wait ...
[oracle@local database]$
 
[root@local database]#

配置开机自动启动

As a root user, execute the following script(s):
    1. /home/oracle/app/oracle/oraInventory/orainstRoot.sh
    2. /home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
As install user, execute the following script to complete the configuration.
    1. /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/configToolAllCommands

安装好Oracle数据库后: 执行 dbstart和dbshut会提示:

[oracle@oracle11g ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart ORACLE_HOME

错误原因是:dbstart和dbshut脚本文件中ORACLE_HOME_LISTNER的设置有问题,分别打开两个文件找到:

ORACLE_HOME_LISTNER=$1

修改为

ORACLE_HOME_LISTNER=$ORACLE_HOME

命令如下:

[oracle@oracle11g ~]$ vi $ORACLE_HOME/bin/dbstart
[oracle@oracle11g ~]$ vi $ORACLE_HOME/bin/dbshut

修改后保存退出,第一个问题已解决;


如何在Linux启动时自动启动Oracle监听和实例 首先要解决上面的问题,才能继续哟!

  1. 修改/etc/oratab文件,命令如下:
[oracle@oracle11g ~]$ vi /etc/oratab

找到:

accp:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N

修改为

accp:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y
  1. 把lsnrctl start和dbstart添加到rc.local文件中,命令如下:
[oracle@oracle11g ~]$ vi /etc/rc.d/rc.local

添加:

su oracle -lc "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc  /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart

注意:第一个命令有空格,所以要用引号的 重启试试吧!


自动安装脚本: 百度网盘:gladstone.zip 密码:cqny

本文来自AlcorZheng个人博客

猜你喜欢

转载自my.oschina.net/zhx56/blog/1791824
今日推荐