RedHat 7 静默安装Oracle 12c

  1. 云栖社区>
  2. 博客>
  3. 正文

RedHat 7 静默安装Oracle 12c

技术小大人 2017-11-15 18:06:00 浏览1943
展开阅读全文

之前在网上看了很多Oracle的静默安装教程,感觉有些乱,经过自己查阅Oracle官网英文手册,结合在虚拟机中安装测试,整理出了这篇RedHat 7 静默安装Oracle 12c。redhat 6静默安装Oracle 11g R2也已基本整理好了,等有时间了再发出来。

本文原始出处:江健龙的技术博客http://jiangjianlong.blog.51cto.com/3735273/1792451


一、环境要求与准备


1、硬件要求

1)磁盘空间

EnterpriseEdition : 6.4GB

StandardEdition : 6.1GB

1 GB of space inthe  /tmp directory on your Linux system.

 

2RAM

Minimum: 1 GB of RAM

Recommended: 2 GB ofRAM or more

 

3SWAP

RAM                                                    Swap Space

Between 1 GB and 2 GB   ——1.5 times the size of the RAM

Between2 GB and 16 GB ——Equal to the size of the RAM

Morethan 16 GB ——16 GB

 

2、软件要求

1)操作系统

■Supported OracleLinux 7 and Red Hat Enterprise Linux 7 Distributions for x86-64

■ Supported OracleLinux 6 and Red Hat Enterprise Linux 6 Distributions for x86-64

■ Supported OracleLinux 5 and Red Hat Enterprise Linux 5 Distributions for x86-64

■ Supported SUSEDistributions for x86-64

Starting with Oracle Database 12c Release 1 (12.1.0.2), Red HatEnterprise Linux 7 3.10.0-54.0.1.el7.x86_64are supported on Linuxx86-64 systems.


2RPM包要求forRH7

binutils-2.23.52.0.1-12.el7.x86_64

compat-libcap1-1.10-3.el7.x86_64

compat-libstdc++-33-3.2.3-71.el7.i686(需另外下载)

compat-libstdc++-33-3.2.3-71.el7.x86_64(需另外下载)

gcc-4.8.2-3.el7.x86_64

gcc-c++-4.8.2-3.el7.x86_64

glibc-2.17-36.el7.i686

glibc-2.17-36.el7.x86_64

glibc-devel-2.17-36.el7.i686

glibc-devel-2.17-36.el7.x86_64

ksh

libaio-0.3.109-9.el7.i686

libaio-0.3.109-9.el7.x86_64

libaio-devel-0.3.109-9.el7.i686

libaio-devel-0.3.109-9.el7.x86_64

libgcc-4.8.2-3.el7.i686

libgcc-4.8.2-3.el7.x86_64

libstdc++-4.8.2-3.el7.i686

libstdc++-4.8.2-3.el7.x86_64

libstdc++-devel-4.8.2-3.el7.i686

libstdc++-devel-4.8.2-3.el7.x86_64

libXi-1.7.2-1.el7.i686

libXi-1.7.2-1.el7.x86_64

libXtst-1.2.2-1.el7.i686

libXtst-1.2.2-1.el7.x86_64

make-3.82-19.el7.x86_64

sysstat-10.1.5-1.el7.x86_64

unixODBC-2.3.1 orlater


3、设置域名解析

 

4、关闭Transparent HugePages

使用root登录

查看:cat /sys/kernel/mm/redhat_transparent_hugepage/enabled

关闭方法:

官方推荐关闭,但Redhat 7我还未找到关闭方法,但也不影响安装

 

5、创建用户和组

Thefollowing local operating system groups and users are required if you areinstalling Oracle Database:

■ The OracleInventory group (typically,  oinstall )

■ The OSDBA group(typically,  dba )

■ The Oraclesoftware owner (typically,  oracle )

■ The OSOPER group(optional. Typically,  oper )

# grep dba/etc/group

# id oracle

If the  oracle user exists

# /usr/sbin/usermod-g oinstall -G dba oracle

If the  oracle user does not exist

# /usr/sbin/useradd-g oinstall -G dba oracle

set the password

# passwd oracle

wKiom1eMPnmwYkTtAABBz1Ibh5c347.png


6、创建安装目录

Oracle_Base目录:/u01/app/oracle/

Oracle_Home目录:/u01/app/oracle/12c

Oracle清单目录:/u01/app/oracle/oraInventory

wKiom1drfWqzQy_gAAAPyTgqiiw296.png


7、设置资源限制

wKioL1drfWqhSymGAACd7BCNENc867.png

查看方式:

$ ulimit -Sn

1024

$ ulimit -Hn

65536

$ ulimit -Su

2047

$ ulimit -Hu

16384

$ ulimit -Ss

10240

$ ulimit -Hs

32768

修改方法:

vi /etc/security/limits.conf,加上以下内容:


oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle hard stack 32768

oracle soft stack 10240


注:如果Oracle已登录,必须先登出后再次登录才生效


8配置Oracle用户环境变量

vi /home/oracle/.bash_profile,加上以下内容,标橙色的部分需要根据自己实际进行修改

export EDITOR=vi

export ORACLE_SID=orcl

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/12c

export nls_date_format="yyyy-mm-dd hh24:mi:ss"

export PATH=/u01/app/oracle/12c/bin:$PATH


9、配置内核参数

wKiom1drfWuTVzIPAAFn0XuXyR4828.png

Note:If the current value for any parameter is greater than the valuelisted in this table, then the Fixupscripts do not change the value of  that parameter.

查看方式:

wKiom1drfWyStdoaAADKRRQAkS0994.png

修改方式:vi  /etc/sysctl.conf,修改或增加以下内容:

fs.aio-max-nr =1048576

fs.file-max =6815744

kernel.shmall =2097152

kernel.shmmax =4294967295

kernel.shmmni = 4096

kernel.sem = 25032000 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 =1048576

最好reboot一下,不然有的参数不生效



10、编辑/etc/profile

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


二、静默安装Oracle software

1、编辑应答文件db_install.rsp

Oracle安装介质中有应答文件,复制一份出来进行修改,更改以下内容,标橙色部分需要根据自己实际修改,应答文件中的其他内容不需要改,Oracle版本:12.1.0.2

本文原始出处:江健龙的技术博客http://jiangjianlong.blog.51cto.com/3735273/1792451


oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=rh7

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oraInventory

SELECTED_LANGUAGES=en,zh_CN

ORACLE_HOME=/u01/app/oracle/12c

ORACLE_BASE=/u01/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.DBA_GROUP=dba

oracle.install.db.OPER_GROUP=oinstall

oracle.install.db.BACKUPDBA_GROUP=dba

oracle.install.db.DGDBA_GROUP=dba

oracle.install.db.KMDBA_GROUP=dba

DECLINE_SECURITY_UPDATES=true


2、执行静默安装命令

[oracle@rh7 database]$ ./runInstaller -silent -ignorePrereq -responseFile /oracle12czip/db_install.rsp

wKioL1eMPquDifHfAABpkv2uG9A593.png


3、完成安装后使用root登录执行脚本

wKiom1drfW2zWaHDAAAsoD4ST70925.png


4、配置监听

复制一份安装介质中的应答文件netca.rsp,无需修改,直接静默执行即可

[oracle@rh7 oracle12czip]$ netca -silent -responseFile /oracle12czip/netca.rsp

wKioL1drfW3CpnotAAA5Df1UT98486.png


、静默安装数据库

1、编辑应答文件dbca.rsp

Oracle安装介质中有应答文件dbca.rsp,复制一份出来进行修改,更改以下内容,标橙色部分需要根据自己实际修改,应答文件中的其他内容不需要改

[GENERAL]

RESPONSEFILE_VERSION = "12.1.0"

OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]

GDBNAME ="orcl"

SID = "orcl"

TEMPLATENAME = "General_Purpose.dbc"

SYSPASSWORD ="p@ssw0rd"

SYSTEMPASSWORD ="p@ssw0rd"

EMCONFIGURATION ="DBEXPRESS"

EMEXPRESSPORT = "5520" #(指定该参数安装后未生效,仍是默认的5500)

DBSNMPPASSWORD ="p@ssw0rd"

STORAGETYPE="FS"

CHARACTERSET = "ZHS16GBK"

NATIONALCHARACTERSET= "AL16UTF16"

MEMORYPERCENTAGE ="40"

TOTALMEMORY ="1024"


2、执行静默安装命令

 $dbca -silent -responseFile /oracle12czip/dbca.rsp

wKiom1eMPtGDE-qoAABfnAnRSRs868.png


四、安装完成后检查

1、检查监听状态:$ lsnrctl status

wKioL1drfW7AshCtAAB7clorMR4602.png


2、检查Oracle进程:]$ ps -ef |grep ora_ |grep -v grep

wKioL1drfW_RG5PAAABwHdTZXgg093.png


3、登录Oracle数据库

wKioL1eMPvHjDnbOAABvr_bIyLg669.png

SQL> select name from V$database;

wKiom1drfXDQRwsVAAAHth79hmA881.png

SQL> select instance_name from V$instance;

wKioL1drfXDB4VBgAAAJJ_x-Wr4033.png

SQL> select name from V$datafile;

wKiom1drfXHSIZCeAAAQ9zHWEr0845.png

SQL>  select userenv('language') from dual;

wKioL1drfXGCp7USAAAMTdrw4Jc169.png

SQL> select * from product_component_version;

wKioL1drfXGT-Pg1AAAzFCL7tA0988.png

SQL> show parameter background_dump_dest;

wKiom1drfXKSRePWAAASdXQcdC0589.png


4、登录EM

wKioL1eMQDnwoNFAAAFfp5B_T9Y148.png

wKiom1eMPzayg4uuAAKz_rsTqdc844.png


Oracle 12c至此已在redhat 7上静默安装完成了,可以创建表空间、创建用户去使用了。

本文转自jianlong1990 博客,原文链接:   http://blog.51cto.com/jiangjianlong/1792451 如需转载请自行联系原作者



网友评论

登录后评论
0/500
评论
技术小大人
+ 关注