CentOS静默安装Oracle 11g r2

一,下载地址
 http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Oracle 11g 联机文档:
 http://www.oracle.com/pls/db112/homepage

二,系统要求
内存:1G(官方最低要求1G)
硬盘:40G(企业版安装所需4.29G和1.7G数据文件)

检查的命令
内存
# grep MemTotal /proc/meminfo
交换空间
# grep SwapTotal /proc/meminfo
磁盘空间
# df -ah

三,安装前系统准备
1、添加主机名与IP对应记录(root用户下)

 #vim /etc/hosts 
192.168.1.254    Admin-PC

2、关闭Selinux(root用户下)
# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config  
# setenforce 0

3、创建用户和组(root用户:创建Oracle安装组oinstall,数据库管理员组dba,及oracle用户)
# groupadd -g 200 oinstall 
# groupadd -g 201 dba 
# useradd -u 440 -g oinstall -G dba oracle (主组oinstall,其它组:dba)
# passwd oracle   

4、修改内核参数(root用户:修改 /etc/sysctl.conf 文件,加上如下参数)
# vim /etc/sysctl.conf  
net.ipv4.ip_local_port_range= 9000 65500 
fs.file-max = 6815744 
kernel.shmall = 10523004 
kernel.shmmax = 4194304 
kernel.shmmni = 4096 
kernel.sem = 250 32000 100128 
net.core.rmem_default=262144 
net.core.wmem_default=262144 
net.core.rmem_max=4194304 
net.core.wmem_max=1048576 
fs.aio-max-nr = 1048576

#modprobe  bridge

#lsmod|grep  bridge

# sysctl -p 

5、修改系统资源限制(root用户:修改 /etc/security/limits.conf 文件,加上下面的参数)
# vim /etc/security/limits.conf  
oracle  soft  nproc  2047 
oracle  hard  nproc  16384 
oracle  soft  nofile  1024 
oracle  hard  nofile  65536
6、修改用户验证选项(root用户下:修改/etc/pam.d/login文件加上如下参数)
# vim /etc/pam.d/login  
session    required    pam_limits.so

7、创建安装目录及设置权限(root用户下)

# mkdir -p /opt/app/oracle/  
# chmod 755 /opt/app/oracle/  
# chown oracle.oinstall -R /opt/app/oracle/

8、设置环境变量(root用户下:修改/etc/profile文件加上如下参数)

# vim  /etc/profile 

export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export ORACLE_SID=ORCL
export ROACLE_PID=ORCL
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

完成后执行:

#source /etc/profile   #环境变量修改生效

#env | grep ORA   #查看环境变量是否完成

ORACLE_SID=ORCL

ORACLE_BASE=/opt/app/oracle

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1

四、安装Oracle

1.安装依赖包(root用户下)

#yum install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

#yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686

2.字符界面下安装oracle(root用户下)
  在/opt目录下 解压oracle软件
 # unzip -o linux.x64_11gR2_database_1of2.zip
 # unzip -o linux.x64_11gR2_database_2of2.zip

#chown -R oracle:oinstall /opt/database/

解压后得到database目录,其中包含response目录,该目录中有三个rsp文件,用来作为静默安装时的应答文件的模板。

 三个文件作用分别是:
db_install.rsp:安装应答
dbca.rsp:创建数据库应答
netca.rsp:建立监听、本地服务名等网络设置的应答

3.编辑安装应答脚本(root用户下)

#vim /opt/database/response/db_install.rsp 

4.静默安装Oracle(oracle用户下)
$chmod  -R 755  /opt/database
$ ./runInstaller -silent -force -responseFile /opt/database/response/db_install.rsp

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 165908 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 16383 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-29_03-35-32PM. Please wait ...[oracle@oracledb database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
   CAUSE: The Central Inventory is located in the Oracle base.
   ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
   CAUSE: The Central Inventory is located in the Oracle base.
   ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
 /opt/app/oracle/oraInventory/logs/installActions2015-01-29_03-35-32PM.log
The following configuration scripts need to be executed as the "root" user. 
 #!/bin/sh 
 #Root scripts to run

/app/oracle/oraInventory/orainstRoot.sh
/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
         1. Open a terminal window 
         2. Log in as "root" 
         3. Run the scripts 
         4. Return to this window and hit "Enter" key to continue

Successfully Setup Software.
然后回车,使用root用户执行root.sh

$ su root

#/app/oracle/oraInventory/orainstRoot.sh

#/app/oracle/product/11.2.0/db_1/root.sh

5.静默配置网络(oracle用户下)

$ $ORACLE_HOME/bin/netca /silent /responseFile /opt/database/response/netca.rsp

Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /opt/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Listener "LISTENER" already exists.
Oracle Net Services configuration successful. The exit code is 0

6.修改脚本dbca.rsp(root用户下)

#vim /opt/database/response/dbca.rsp

7. 静默安装数据库 (oracle用户下)
$ $ORACLE_HOME/bin/dbca -silent -responseFile /opt/database/response/dbca.rsp

Copying database files

1% complete

3% complete

11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
57% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
74% complete
85% complete
96% complete
100% complete
Look at the log file "/app/oracle/cfgtoollogs/dbca/ora11g/ora11g.log" for further details.

安装完成...

8.修改oracle配置(root用户下)

#vim $ORACLE_HOME/bin/dbstart

ORACLE_HOME_LISTNER=$ORACLE_HOME

#vim $ORACLE_HOME/bin/dbshut 

ORACLE_HOME_LISTNER=$ORACLE_HOME

9.Linux启动时自动启动Oracle监听和实例(root用户下)

#vim /etc/oratab

ORCL:/opt/app/oracle/product/11.2.0/db_1:Y

# chmod +x /etc/rc.d/rc.local

# ls -l /etc/rc.d/rc.local

#vim /etc/rc.d/rc.local

su - oracle -c "lsnrctl start"

su - oracle -c  "dbstart"

10.基本命令

登录数据库:  sqlplus / as sysdba

启动监听:lsnrctl start 或 $ORACLE_HOME/bin/lsnrctl start

查看监听:lsnrctl status 或 $ORACLE_HOME/bin/lsnrctl status

停止监听:lsnrctl stop

 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值