阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS静默安装Oracle 11g R2

118次阅读
没有评论

共计 6223 个字符,预计需要花费 16 分钟才能阅读完成。

一,下载地址
 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 = 6465333657
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 /app/oracle/ 
# chmod 755 /app/oracle/ 
# chown oracle.oinstall -R /app/oracle/

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

# vim  /etc/profile

export ORACLE_BASE=/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=/app/oracle

ORACLE_HOME=/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

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/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:/app/oracle/product/11.2.0/db_1:Y

#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

更多 Oracle 相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-07/133757tm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计6223字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中