CENTOS7中ORACLE12静默安装记录

操作系统环境设置

检查系统版本:

cat /etc/redhat-release

结果如下:

CentOS Linux release 7.0.1406 (Core)

查看IP地址

ifconfig ent0
192.168.0.115

配置系统和安装所需软件包

关闭selinux

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

关闭防火墙

systemctl disable iptables

进行一次升级


yum update -y

修改主机名并重启

将主机名修改为mes.dfec.com


vim /etc/hostname

修改hosts,添加一条主机记录


echo "127.0.0.1      mes mes.dfec.com" >> /etc/hosts 

ping mes.dfec.com

安装oracle所需的软件包


yum install gcc gcc-c++ glibc glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel zlib-devel unzip compat-libcap1 compat-libstdc++-33

结果如下:

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: mirrors.cn99.com

 * extras: mirrors.cn99.com

 * updates: mirrors.cn99.com

软件包 gcc-4.8.5-4.el7.x86_64 已安装并且是最新版本

软件包 glibc-2.17-106.el7_2.8.x86_64 已安装并且是最新版本

软件包 glibc-devel-2.17-106.el7_2.8.x86_64 已安装并且是最新版本

软件包 glibc-headers-2.17-106.el7_2.8.x86_64 已安装并且是最新版本

软件包 libaio-0.3.109-13.el7.x86_64 已安装并且是最新版本

软件包 libgcc-4.8.5-4.el7.x86_64 已安装并且是最新版本

软件包 libstdc++-4.8.5-4.el7.x86_64 已安装并且是最新版本

软件包 1:make-3.82-21.el7.x86_64 已安装并且是最新版本

软件包 sysstat-10.1.5-7.el7.x86_64 已安装并且是最新版本

软件包 unzip-6.0-15.el7.x86_64 已安装并且是最新版本

正在解决依赖关系

--> 正在检查事务

---> 软件包 compat-libcap1.x86_64.0.1.10-7.el7 将被 安装

---> 软件包 compat-libstdc++-33.x86_64.0.3.2.3-72.el7 将被 安装

---> 软件包 gcc-c++.x86_64.0.4.8.5-4.el7 将被 安装

---> 软件包 ksh.x86_64.0.20120801-22.el7_1.3 将被 安装

---> 软件包 libaio-devel.x86_64.0.0.3.109-13.el7 将被 安装

---> 软件包 libstdc++-devel.x86_64.0.4.8.5-4.el7 将被 安装

---> 软件包 unixODBC.x86_64.0.2.3.1-11.el7 将被 安装

---> 软件包 unixODBC-devel.x86_64.0.2.3.1-11.el7 将被 安装

---> 软件包 zlib-devel.x86_64.0.1.2.7-15.el7 将被 安装

--> 解决依赖关系完成

依赖关系解决

==================================================================================

 Package                  架构        版本                     源            大小

==================================================================================

正在安装:

 compat-libcap1           x86_64      1.10-7.el7               base          19 k

 compat-libstdc++-33      x86_64      3.2.3-72.el7             base         191 k

 gcc-c++                  x86_64      4.8.5-4.el7              base         7.2 M

 ksh                      x86_64      20120801-22.el7_1.3      updates      881 k

 libaio-devel             x86_64      0.3.109-13.el7           base          13 k

 libstdc++-devel          x86_64      4.8.5-4.el7              base         1.5 M

 unixODBC                 x86_64      2.3.1-11.el7             base         413 k

 unixODBC-devel           x86_64      2.3.1-11.el7             base          55 k

 zlib-devel               x86_64      1.2.7-15.el7             base          50 k

事务概要

==================================================================================

安装  9 软件包

总下载量:10 M

安装大小:30 M

Is this ok [y/d/N]: y

Downloading packages:

(1/9): compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm         | 191 kB  00:00:05

(2/9): gcc-c++-4.8.5-4.el7.x86_64.rpm                      | 7.2 MB  00:00:01

(3/9): libaio-devel-0.3.109-13.el7.x86_64.rpm              |  13 kB  00:00:00

(4/9): libstdc++-devel-4.8.5-4.el7.x86_64.rpm              | 1.5 MB  00:00:00

(5/9): unixODBC-2.3.1-11.el7.x86_64.rpm                    | 413 kB  00:00:00

(6/9): unixODBC-devel-2.3.1-11.el7.x86_64.rpm              |  55 kB  00:00:00

(7/9): zlib-devel-1.2.7-15.el7.x86_64.rpm                  |  50 kB  00:00:00

(8/9): ksh-20120801-22.el7_1.3.x86_64.rpm                  | 881 kB  00:00:02

(9/9): compat-libcap1-1.10-7.el7.x86_64.rpm                |  19 kB  00:00:10

----------------------------------------------------------------------------------

总计                                                 977 kB/s |  10 MB  00:10

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  正在安装    : unixODBC-2.3.1-11.el7.x86_64                                  1/9

  正在安装    : libstdc++-devel-4.8.5-4.el7.x86_64                            2/9

  正在安装    : gcc-c++-4.8.5-4.el7.x86_64                                    3/9

  正在安装    : unixODBC-devel-2.3.1-11.el7.x86_64                            4/9

  正在安装    : ksh-20120801-22.el7_1.3.x86_64                                5/9

  正在安装    : libaio-devel-0.3.109-13.el7.x86_64                            6/9

  正在安装    : compat-libcap1-1.10-7.el7.x86_64                              7/9

  正在安装    : compat-libstdc++-33-3.2.3-72.el7.x86_64                       8/9

  正在安装    : zlib-devel-1.2.7-15.el7.x86_64                                9/9

  验证中      : zlib-devel-1.2.7-15.el7.x86_64                                1/9

  验证中      : gcc-c++-4.8.5-4.el7.x86_64                                    2/9

  验证中      : libstdc++-devel-4.8.5-4.el7.x86_64                            3/9

  验证中      : unixODBC-devel-2.3.1-11.el7.x86_64                            4/9

  验证中      : unixODBC-2.3.1-11.el7.x86_64                                  5/9

  验证中      : compat-libstdc++-33-3.2.3-72.el7.x86_64                       6/9

  验证中      : compat-libcap1-1.10-7.el7.x86_64                              7/9

  验证中      : libaio-devel-0.3.109-13.el7.x86_64                            8/9

  验证中      : ksh-20120801-22.el7_1.3.x86_64                                9/9

已安装:

  compat-libcap1.x86_64 0:1.10-7.el7    compat-libstdc++-33.x86_64 0:3.2.3-72.el7

  gcc-c++.x86_64 0:4.8.5-4.el7          ksh.x86_64 0:20120801-22.el7_1.3

  libaio-devel.x86_64 0:0.3.109-13.el7  libstdc++-devel.x86_64 0:4.8.5-4.el7

  unixODBC.x86_64 0:2.3.1-11.el7        unixODBC-devel.x86_64 0:2.3.1-11.el7

  zlib-devel.x86_64 0:1.2.7-15.el7

完毕!

添加oracle用户组

groupadd oinstall

groupadd dba

groupadd oper

useradd -g oinstall -G dba,oper oracle

修改系统参数

/etc/sysctl.conf

vim  /etc/sysctl.conf

添加如下内容:

fs.file-max = 6815744

kernel.sem = 250 32000 100 128

kernel.shmmni = 4096

kernel.shmall = 1073741824

kernel.shmmax = 4398046511104

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

fs.aio-max-nr = 1048576

net.ipv4.ip_local_port_range = 9000 65500

应用核心参数

sysctl -p

/etc/security/limits.conf

vim /etc/security/limits.conf

添加如下内容:

oracle   soft   nofile   1024

oracle   hard   nofile   65536

oracle   soft   nproc    2047

oracle   hard   nproc    16384

oracle   soft   stack    10240

oracle   hard   stack    32768

创建安装文件夹

mkdir -p /oracle/app/oracle/product/12.1.2/db_1

chown oracle:oinstall /oracle -R

配置oracle用户环境变量

切换到oracle用户

su - oracle

配置环境变量

vim ~/.bash_profile

添加如下内容:

export TMP=/tmp

export ORACLE_HOSTNAME=mes.dfec.com

export ORACLE_UNQNAME=LIVENUX

export ORACLE_BASE=/oracle/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.1.2/db_1

export ORACLE_SID=ORCL

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin:$HOME/bin:/$HOME/.local/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias cdob='cd $ORACLE_BASE'

alias cdoh='cd $ORACLE_HOME'

alias tns='cd $ORACLE_HOME/network/admin'

alias envo='env | grep ORACLE'

应用环境变量

source .bash_profile

准备安装文件

下载安装文件

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html 下载oracle12c安装包

上传oracle安装文件

scp /Users/lihongjun/software/oracle12c/p21419221_121020_Linux-x86-64_1of10.zip root@192.168.0.115:/software
scp /Users/lihongjun/software/oracle12c/p21419221_121020_Linux-x86-64_2of10.zip root@192.168.0.115:/software
scp /Users/lihongjun/Downloads/CentOS-7.0-1406-x86_64-DVD.iso root@192.168.0.115:/software

解压oracle安装文件

unzip p21419221_121020_Linux-x86-64_1of10.zip
unzip p21419221_121020_Linux-x86-64_2of10.zip

复制一个应答文件

cd /software

cd database

cp response/db_install.rsp inst.rsp

mkdir -p /oracle/orainst/12.1.2/database/stage

修改应答文件

vim /software/database/inst.rsp

修改内容如下:

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=ora1
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/oracle/orainst/12.1.2/database/stage
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/oracle/app/oracle/product/12.1.2/db_1
ORACLE_BASE=/oracle/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.BACKUPDBA_GROUP=dba
oracle.install.db.DGDBA_GROUP=dba
oracle.install.db.KMDBA_GROUP=dba
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true

执行安装程序

./runInstaller -ignoreSysPrereqs -force -silent -responseFile /software/database/inst.rsp

查看是否有出错日志

The installation of Oracle Database 12c was successful.
Please check '/oracle/orainst/12.1.2/database/stage/logs/silentInstall2016-09-03_07-24-04PM.log' for more details.

As a root user, execute the following script(s):
        1. /oracle/orainst/12.1.2/database/stage/orainstRoot.sh
        2. /oracle/app/oracle/product/12.1.2/db_1/root.sh

Successfully Setup Software.

执行root.sh

su - root
cd /oracle/app/oracle/product/12.1.2/db_1
sh ./root.sh

执行结果如下:

Check /oracle/app/oracle/product/12.1.2/db_1/install/root_mes.dfec.com_2016-09-03_20-15-41.log for the output of root script

执行orainstRoot.sh

cd /oracle/orainst/12.1.2/database/stage
sh ./orainstRoot.sh

执行结果如下:

Changing permissions of /oracle/orainst/12.1.2/database/stage.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /oracle/orainst/12.1.2/database/stage to oinstall.
The execution of the script is complete.

配置监听器

查看netca response file参数

cd /software/database/response
sed -n '/^[^#]/p' netca.rsp

结果如下:

[GENERAL]
RESPONSEFILE_VERSION="12.1"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
[root@#localhost response]# pwd
/software/database/response

编辑netca response file参数

cp /software/database/response/netca.rsp /software/database/netca.rsp
vim /software/database/netca.rsp

修改后的结果如下:

[GENERAL]
RESPONSEFILE_VERSION="12.1"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""custom""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

静默安装NET Listener

su - oracle
cd /oracle/app/oracle/product/12.1.2/db_1/bin
/oracle/app/oracle/product/12.1.2/db_1/bin/netca -silent -responseFile /software/database/netca.rsp

执行结果如下:

Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /software/database/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Listener configuration complete.
Oracle Net Listener Startup:
    Running Listener Control:
      /oracle/app/oracle/product/12.1.2/db_1/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Profile configuration complete.
Oracle Net Services configuration successful. The exit code is 0

创建数据库

查看响应文件

cd /software/database
sed -n '/^[^#]/p' dbca.rsp

结果如下:

[GENERAL]
RESPONSEFILE_VERSION = "12.1.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl12c.us.oracle.com"
SID = "orcl12c"
TEMPLATENAME = "General_Purpose.dbc"
[createTemplateFromDB]
SOURCEDB = "myhost:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "My Copy TEMPLATE"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl12.us.oracle.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl12c.us.oracle.com"
NODENAME=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl12c.us.oracle.com"
INSTANCENAME = "orcl12c"
SYSDBAUSERNAME = "sys"
[CREATEPLUGGABLEDATABASE]
SOURCEDB = "orcl"
PDBNAME = "PDB1"
[UNPLUGDATABASE]
SOURCEDB = "orcl"
PDBNAME = "PDB1"
ARCHIVETYPE = "TAR"
[DELETEPLUGGABLEDATABASE]
SOURCEDB = "orcl"
PDBNAME = "PDB1"
[CONFIGUREPLUGGABLEDATABASE]
SOURCEDB = "orcl"
PDBNAME = "PDB1"

编辑响应文件dbca.rsp

cp /software/database/response/dbca.rsp /software/database/dbca.rsp
vim /software/database/dbca.rsp

修改的结果如下:

[GENERAL]
RESPONSEFILE_VERSION = "12.1.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl12c.mes.dfec.com"
SID = "orcl12c"
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "SYS"
SYSTEMPASSWORD = "SYSTEM"
[createTemplateFromDB]
SOURCEDB = "myhost:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "My Copy TEMPLATE"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl12.mes.dfec.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl12c.mes.dfec.com"
NODENAME=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl12c.mes.dfec.com"
INSTANCENAME = "orcl12c"
SYSDBAUSERNAME = "sys"
[CREATEPLUGGABLEDATABASE]
SOURCEDB = "orcl"
PDBNAME = "PDB1"
[UNPLUGDATABASE]
SOURCEDB = "orcl"
PDBNAME = "PDB1"
ARCHIVETYPE = "TAR"
[DELETEPLUGGABLEDATABASE]
SOURCEDB = "orcl"
PDBNAME = "PDB1"
[CONFIGUREPLUGGABLEDATABASE]
SOURCEDB = "orcl"
PDBNAME = "PDB1"

创建数据库

/oracle/app/oracle/product/12.1.2/db_1/bin/dbca -silent -responseFile /software/database/dbca.rsp

执行结果如下:

Copying database files
1% complete
2% complete
4% complete
DBCA Operation failed.
Look at the log file "/oracle/app/oracle/cfgtoollogs/dbca/orcl12c/orcl12c.log" for further details.

执行失败,查看log:

vim /oracle/app/oracle/cfgtoollogs/dbca/orcl12c/orcl12c.log

结果如下:

Database Configuration Assistant failed to detect options for this Oracle Installation.
ORA-12547: TNS:lost contact

Due to this failure some Database Configuration Assistant features will not be available. Do you want to continue?

Unique database identifier check passed.

/ has enough space. Required space is 6140 MB , available space is 33031 MB.
File Validations Successful.
Copying database files
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 2%
ORA-12547: TNS:lost contact

DBCA_PROGRESS : 4%
Error while cataloging RMAN Backups
DBCA_PROGRESS : DBCA Operation failed.

查看IP地址

ifconfig eth0

结果如下:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.115  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::21c:42ff:fe11:61b  prefixlen 64  scopeid 0x20<link>
        ether 00:1c:42:11:06:1b  txqueuelen 1000  (Ethernet)
        RX packets 114131  bytes 30342139 (28.9 MiB)
        RX errors 0  dropped 190  overruns 0  frame 0
        TX packets 16014  bytes 4278352 (4.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

参考文档

http://blog.itpub.net/13804621/viewspace-767741/
http://www.cnblogs.com/fincod/p/3997503.html
http://www.linuxidc.com/Linux/2013-07/87696.htm
http://blog.csdn.net/yabingshi_tech/article/details/46801539

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,294评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,493评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,790评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,595评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,718评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,906评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,053评论 3 410
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,797评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,250评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,570评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,711评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,388评论 4 332
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,018评论 3 316
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,796评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,023评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,461评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,595评论 2 350

推荐阅读更多精彩内容