社区主页 文章详情

技术宅 篇三:技术分享第四波之Oracle数据库静默安装

值友4076650138 02-07 13:24 关注

小编注:此篇文章来自#原创新人#活动,成功参与活动将获得额外100金币奖励。

因工作要求,有时需要安装Oracle数据库来搭建各种测试平台。但现实环境下部分服务器没办法使用图形化界面来部署数据库,今天给大家分享一波如何静默安装Oracle(无需图形化界面)。

环境说明:

操作系统:Centos 6.8

数据库版本:Oracle 11.2.0.4

主机IP:192.168.130.40


1.设置好主机名、关闭selinux

[root@test ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

设置主机名及IP对应关系

echo "192.168.130.40 test" >> /etc/hosts

技术宅 篇三:技术分享第四波之Oracle数据库静默安装

2.安装依赖包

[root@test ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libxcb libXi make sysstat

3.创建用户及组

[root@test ~]# groupadd oinstall

[root@test ~]# groupadd dba

[root@test ~]# /usr/sbin/useradd -g oinstall -G dba oracle

[root@test ~]# echo redhat |passwd --stdin oracle

4.配置内核参数

vi /etc/sysctl.conf,最后添加:

kernel.shmmni = 4096

kernel.sem =250 32000 100 128

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 262144

net.ipv4.ip_local_port_range =9000 65500

fs.file-max=65536

fs.aio-max-nr=1048576

修改后sysctl -p使之生效

5.修改用户限制

vi /etc/security/limits.conf,在最后添加:

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

oracle hard stack 10240

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

[root@test ~]# source /etc/profile

6.修改/etc/pam.d/login文件

最后添加:

session required /lib64/security/pam_limits.so

session required pam_limits.so

7.创建安装目录并修改权限

[root@test ~]# mkdir -p /u01/app/oracle

[root@test ~]# chown -R oracle:oinstall /u01

[root@test ~]# chmod -R 775 /u01

8.配置oracle用户环境变量

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_SID=oral

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

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

export ORACLE_CLIENT=$ORACLE_HOME

source /home/oracle/.bash_profile

9.解压安装文件

[root@test ~]# chown oracle:oinstall /tmp/p13390677_112040_Linux-x86-64_*

[oracle@test app]$ pwd

/u01/app

[oracle@test app]$ unzip p13390677_112040_Linux-x86-64_1of7.zip

[oracle@test app]$ unzip p13390677_112040_Linux-x86-64_2of7.zip

10.切换到Oracle用户,复制响应文件模板

[oracle@test ~]$ mkdir etc

[oracle@docker ~]$ cp /usr/local/src/database/response/* /home/oracle/etc/

[oracle@docker ~]$ ls etc

dbca.rsp db_install.rsp netca.rsp

[oracle@test ~]$ cp /u01/app/database/response/* /home/oracle/etc/

[oracle@test ~]$ ls etc/

dbca.rsp db_install.rsp netca.rsp

[oracle@test ~]$ chmod 700 /home/oracle/etc/*.rsp

11.使用oracle用户修改响应文件模板(/home/oracle/etc/db_install.rsp)

oracle.install.option=INSTALL_DB_SWONLY // 安装类型

ORACLE_HOSTNAME=test // 主机名称(hostname查询)

UNIX_GROUP_NAME=oinstall // 安装组

INVENTORY_LOCATION=/u01/app/oraInventory //INVENTORY目录(不填就是默认值)

SELECTED_LANGUAGES=en,zh_CN,zh_TW // 选择语言

ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 //oracle_home

ORACLE_BASE=/u01/app/oracle //oracle_base

oracle.install.db.InstallEdition=EE     // oracle版本

oracle.install.db.EEOptionsSelection=false   //自定义安装,否,使用默认组件

oracle.install.db.DBA_GROUP=dba /  / dba用户组

oracle.install.db.OPER_GROUP=oinstall // oper用户组

oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //数据库类型

oracle.install.db.config.starterdb.globalDBName=oral //globalDBName

oracle.install.db.config.starterdb.SID=oral //SID

oracle.install.db.config.starterdb.memoryLimit=2048 //自动管理内存的内存(M)

oracle.install.db.config.starterdb.password.ALL=oracle //设定所有数据库用户使用同一个密码

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //(手动写了false)

DECLINE_SECURITY_UPDATES=true   //设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)

12.开始静默安装

[oracle@test ~]$ /u01/app/database/runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp

[oracle@test ~]$ /u01/app/database/runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB. Actual 9098 MB Passed

Checking swap space: must be greater than 150 MB. Actual 3999 MB Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-08-30_10-36-03PM. Please wait ...[oracle@test ~]$ [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/OraInstall2019-08-30_10-36-03PM/installActions2019-08-30_10-36-03PM.log

ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2019-08-30_10-36-03PM/installActions2019-08-30_10-36-03PM.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:

/u01/app/oraInventory/logs/installActions2019-08-30_10-36-03PM.log

The installation of Oracle Database 11g was successful.

Please check '/u01/app/oraInventory/logs/silentInstall2019-08-30_10-36-03PM.log' for more details.

As a root user, execute the following script(s):

1. /u01/app/oraInventory/orainstRoot.sh

2. /u01/app/oracle/product/11.2.0/db_1/root.sh

Successfully Setup Software.

13.配置监听

[oracle@test ~]$ netca -silent -responsefile /home/oracle/etc/netca.rsp

Parsing command line arguments:

Parameter "silent" = true

Parameter "responsefile" = /home/oracle/etc/netca.rsp

Done parsing command line arguments.

Oracle Net Services Configuration:

Profile configuration complete.

Oracle Net Listener Startup:

Running Listener Control:

/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER

Listener Control complete.

Listener started successfully.

Listener configuration complete.

Oracle Net Services configuration successful. The exit code is 0

14.建库

编辑静默建库响应文件

[oracle@test ~]$ vi /home/oracle/etc/dbca.rsp

[GENERAL]

RESPONSEFILE_VERSION = "11.2.0"

OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]

GDBNAME = "oral" ----数据库名称

SID = "oral" ----指定SID

TEMPLATENAME = "General_Purpose.dbc"

CHARACTERSET = "AL32UTF8" ---设置所需字符集

[oracle@test ~]$ dbca -silent -responseFile /home/oracle/etc/dbca.rsp

Enter SYS user password:

Enter SYSTEM user password:

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

60% complete

62% complete

Completing Database Creation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/oral/oral.log" for further details.

[root@test ~]# cat /u01/app/oracle/cfgtoollogs/dbca/oral/oral.log

Copying database files

DBCA_PROGRESS : 1%

DBCA_PROGRESS : 3%

DBCA_PROGRESS : 11%

DBCA_PROGRESS : 18%

DBCA_PROGRESS : 26%

DBCA_PROGRESS : 37%

Creating and starting Oracle instance

DBCA_PROGRESS : 40%

DBCA_PROGRESS : 45%

DBCA_PROGRESS : 50%

DBCA_PROGRESS : 55%

DBCA_PROGRESS : 56%

DBCA_PROGRESS : 60%

DBCA_PROGRESS : 62%

Completing Database Creation

DBCA_PROGRESS : 66%

DBCA_PROGRESS : 70%

DBCA_PROGRESS : 73%

DBCA_PROGRESS : 85%

DBCA_PROGRESS : 96%

DBCA_PROGRESS : 100%

Database creation complete. For details check the logfiles at:

/u01/app/oracle/cfgtoollogs/dbca/oral.

Database Information:

Global Database Name:oral

System Identifier(SID):oral

数据库创建成功


总结

静默安装Oracle数据库没有特别复杂,最重要的一步就是创建响应文件,因为数据库安装过程中都要读取响应文件里面的参数配置,上文中响应文件每项参数都进行了标注,按着操作并根据自己需求修改相应的参数应该就没什么大问题。You Can Do it!!!

展开阅读全文

打开App,查看更多好文内容

暂无评论,打开APP参与讨论

猜你喜欢
编辑精选
相关商品推荐
1
8
0
你已经点过赞了
新浪微博 QQ空间 微信好友 豆瓣
当前为触屏版
热门搜索