日常开发、测试,及一些非核心生产环境,经常要安装oracle数据库,目前很多还在采用oracle 11g数据库软件。但采用图形安装,一是耗时,安装vnc,安装x软件等非常耗时,另外由于xmanger米乐app官网下载的版权问题,很多公司也不方便使用,所以采用静默安装非常方便。本次整理一篇单机版静默安装指南,等有机会再详细整理一篇rac静默安装文档。
1.1 配置本地yum源
因为该服务器无法连接外网,所以本次选择配置本地yum源解决rpm包安装依赖问题。
上传centos7镜像文件centos-7.9-x86_64-dvd-2009.iso至服务器/home/soft目录。
将iso镜像挂载至/mnt/ios目录
[root@192 soft]# mkdir /mnt/iso [root@192 soft]# mount -o loop /home/soft/centos-7.9-x86_64-dvd-2009.iso /mnt/iso [root@192 soft]# df -h filesystem size used avail use% mounted on devtmpfs 1.9g 0 1.9g 0% /dev tmpfs 1.9g 313m 1.6g 17% /dev/shm tmpfs 1.9g 49m 1.8g 3% /run tmpfs 1.9g 0 1.9g 0% /sys/fs/cgroup /dev/mapper/centos-root 44g 7.4g 37g 17% / /dev/sda1 1014m 151m 864m 15% /boot /dev/mapper/centos-home 22g 9.5g 12g 45% /home tmpfs 375m 0 375m 0% /run/user/0 /dev/loop0 4.4g 4.4g 0 100% /mnt/iso # 修改yum配置文件 [root@192 ~]# cd /etc/yum.repos.d [root@192 yum.repos.d]# mkdir bak [root@192 yum.repos.d]# mv *.repo ./bak #新建local.repo文件 [root@192 yum.repos.d]# cat > /etc/yum.repos.d/local.repo <
1.2 准备安装包
1.2.1 下载安装包
oracle 11.2.0.4 x86_64系统安装包共7个zip文件,若只安装oracle仅需前两个zip文件。
可从以下m6米乐安卓版下载官网地址下载oracle 11.2.0.4 x86_64位安装包。
oracle 11.2.0.4 linux x86-64 (american english)下载地址:
https://updates.oracle.com/orion/services/download/p13390677_112040_linux-x86-64_1of7.zip?aru=16716375&patch_file=p13390677_112040_linux-x86-64_1of7.zip
https://updates.oracle.com/orion/services/download/p13390677_112040_linux-x86-64_2of7.zip?aru=16716375&patch_file=p13390677_112040_linux-x86-64_2of7.zip
1.2.2 上传安装包
将下载的oracle 安装包上传至/home/soft目录,并解压。
[root@192 ~]# cd /home/soft
[root@192 ~]# unzip p13390677_112040_linux-x86-64_1of7.zip
[root@192 ~]# unzip p13390677_112040_linux-x86-64_2of7.zip
[root@192 ~]# chmod -r 777 /home/soft
1.3 创建组和用户
# 创建安装oracle数据库所需的用组和用户
[root@192 ~]# groupadd -g 600 oinstall
[root@192 ~]# groupadd -g 601 dba
[root@192 ~]# useradd -u 600 -g oinstall -g dba oracle
# 设置oracle用户密码
[root@192 ~]# passwd oracle
1.4 创建目录及设置权限
# 创建数据库对应目录,并修改目录权限
[root@192 ~]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
[root@192 ~]# mkdir /u01/app/oracle/oradata
[root@192 ~]# mkdir /u01/app/oracle/inventory
[root@192 ~]# mkdir /u01/app/oracle/fast_recovery_area
[root@192 ~]# chown -r oracle:oinstall /u01/app/oracle
[root@192 ~]# chmod -r 775 /u01/app/oracle
1.5 编辑用户环境变量
# 切换至oracle用户
[root@192 ~]# su - oracle
# 编辑.bash_profile环境变量文件,添加如下内容
[oracle@192 ~]$ cat .bash_profile --内容如下
export oracle_base=/u01/app/oracle
export oracle_home=$oracle_base/product/11.2.0/db_1
export oracle_sid=orcl
export nls_lang=american_america.zhs16gbk
export nls_date_format='yyyy-mm-dd hh24:mi:ss'
# export path
export path=$oracle_home/bin:$oracle_home/opatch:$path
export ld_library_path=$oracle_home/lib:/lib:/usr/lib
# 使环境变量生效
[oracle@192 ~]$ source .bash_profile
1.6 编辑资源限制
# 切换至root用户,编辑 /etc/security/limits.conf
[root@192 ~]# cat >> /home/oracle/123 <
1.7 修改内核参数
# 切换至root用户,编辑 /etc/sysctl.conf 文件
# 注意,修改shmall和shmmax建议参照如下设置
shmall参数:设置共享内存总页数。这个值太小有可能导致数据库启动报错。很多人调整系统内核参数的时候只关注shmmax参数,而忽略了shmall参数的设置。这个值推荐设置为物理内存大小除以分页大小。
# getconf page_size
对于32g、64g的内存,4k分页大小的系统而言,shmall的值应该设置为
select 32*1024*1024*1024/4096 from dual; == 8388608
select 64*1024*1024*1024/4096 from dual; == 16777216
shmmax参数:用于定义单个共享内存段的最大值。
64位linux 系统:可取的最大值为物理内存值 -1byte ,建议值为多于物理内存的一半,一般取值大于sga_max_size 即可,可以取物理内存 -1byte 。
内存为32g时,该值为 32*1024*1024*1024-1 = 34359738367
内存为64g时,该值为 64*1024*1024*1024-1 = 68719476735
内存为128g时,该值为 128*1024*1024*1024-1 = 137438953471
[root@192 ~]# cat >> /etc/sysctl.conf <
1.8 编辑/etc/pam.d/login文件
# 切换至root用户操作
[root@192 ~]# cat >> /etc/pam.d/login <
1.9 安装依赖包
# root用户使用本地yum源安装如下依赖包
[root@192 ~]# yum install -y gcc make binutils gcc-c compat-libstdc -33 elfutils-libelf-devel elfutils-libelf-devel-static libstdc libstdc -devel ksh libaio libaio-devel numactl-devel sysstat unixodbc unixodbc-devel pcre-devel glibc glibc-common glibc-devel
1.10 关闭防火墙
# root用户操作
[root@192 ~]# service iptables stop
[root@192 ~]# systemctl stop firewalld
[root@192 ~]# systemctl disable firewalld
1.11 关闭selinux
# root用户操作
[root@192 ~]# sed -i "s/selinux=enforcing/selinux=disabled/" /etc/selinux/config
[root@192 ~]# cat /etc/selinux/config
[root@192 ~]# setenforce 0
2.1 准备db_install.rsp响应文件
# 切换至oracle用户操作
[root@192 ~]# su - oracle
[oracle@192 ~]$ cp -r /home/soft/database/response/ .
[oracle@192 ~]$ ll
total 0
drwxr-xr-x. 2 oracle oinstall 61 may 23 22:04 response
[oracle@192 ~]$ cd response/
# 编辑 db_install.rsp响应文件,主要修改以下内容
# 响应文件的格式版本,这里指定的版本为 "/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0"
oracle.install.responsefileversion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
# 安装选项,这里设置为 "install_db_swonly",表示仅安装数据库软件,而不创建或配置数据库实例
oracle.install.option=install_db_swonly
# oracle数据库所在的主机名
oracle_hostname=xxx-db
# 用于安装和管理oracle软件的unix组名,这里设置为"oinstall"
unix_group_name=oinstall
# oracle inventory(安装目录)的路径,这里设置为 "/u01/app/orainventory"。
inventory_location=/u01/app/orainventory
# 选择的语言,这里设置为 "en,zh_cn",表示英文和简体中文
selected_languages=en,zh_cn
# oracle软件的安装路径(数据库主目录)
oracle_home=/u01/app/oracle/product/11.2.0/db_1
# oracle软件的基本路径
oracle_base=/u01/app/oracle
# 安装的oracle数据库版本。这里设置为 "ee",表示企业版
oracle.install.db.installedition=ee
# 是否选择了企业版选项,这里设置为"false",表示未选择任何企业版选项
oracle.install.db.eeoptionsselection=false
# 用于数据库管理员(dba) 组的名称,这里设置为 "dba"
oracle.install.db.dba_group=dba
# 用于操作员组的名称,这里设置为 "dba",与dba组相同
oracle.install.db.oper_group=dba
# 是否拒绝安装安全更新,这里设置为 "true",表示拒绝安装安全更新
decline_security_updates=true
# 自动更新选项,这里设置为 "skip_updates",表示跳过自动更新
oracle.installer.autoupdates.option=skip_updates
2.2 运行runinstaller进行安装
[oracle@192 response]$ cd /home/soft/database/
[oracle@192 database]$ ./runinstaller -silent -noconfig -ignoreprereq -responsefile /home/oracle/response/db_install.rsp
# 以下是上述命令执行生成内容
starting oracle universal installer...
checking temp space: must be greater than 120 mb. actual 43276 mb passed
checking swap space: must be greater than 150 mb. actual 3967 mb passed
preparing to launch oracle universal installer from /tmp/orainstall2023-05-23_10-51-54pm. please wait ...[oracle@192 database]$
[oracle@192 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.
you can find the log of this install session at:
/u01/app/oracle/inventory/logs/installactions2023-05-23_10-51-54pm.log
the installation of oracle database 11g was successful.
please check '/u01/app/oracle/inventory/logs/silentinstall2023-05-23_10-51-54pm.log' for more details.
as a root user, execute the following script(s):
1. /u01/app/oracle/inventory/orainstroot.sh
2. /u01/app/oracle/product/11.2.0/db_1/root.sh
# 此时会提示要使用root用户执行上述两个脚本
# 新打开一个会话,使用root用户执行
1) 首先执行/u01/app/oracle/inventory/orainstroot.sh脚本
[root@192 db_1]# /u01/app/oracle/inventory/orainstroot.sh
# 生成内容如下
changing permissions of /u01/app/oracle/inventory.
adding read,write permissions for group.
removing read,write,execute permissions for world.
changing groupname of /u01/app/oracle/inventory to oinstall.
the execution of the script is complete.
2)再次执行/u01/app/oracle/product/11.2.0/db_1/root.sh脚本
[root@192 db_1]# /u01/app/oracle/product/11.2.0/db_1/root.sh
# 生成内容如下
check /u01/app/oracle/product/11.2.0/db_1/install/root_192.168.20.16_2023-05-23_22-59-10.log for the output of root script
# 以上两个脚本执行完毕后,返回前一个会话,按回车,结束安装,执行成功,结果如下。
successfully setup software.
3.1 使用netca.rsp响应文件创建监听
# 使用oracle用户执行
[oracle@192 ~]$ netca /silent -responsefile /home/oracle/response/netca.rsp
# 上述命令执行后,生成内容如下
parsing command line arguments:
parameter "silent" = true
parameter "responsefile" = /home/oracle/response/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
# 曾在一个测试环境执行时遇到如下报错
parsing command line arguments:
parameter "silent" = true
parameter "responsefile" = /home/oracle/response/netca.rsp
done parsing command line arguments.
oracle net services configuration:
profileexception: could not save profile: tns-04415: file i/o error
caused by: java.io.filenotfoundexception: /usr/lib/oracle/19.16/client64/lib/network/admin/sqlnet.ora (permission denied)
profile configuration complete.
listenerexception: could not save listener: tns-04415: file i/o error
caused by: java.io.filenotfoundexception: /usr/lib/oracle/19.16/client64/lib/network/admin/listener.ora (permission denied)
oracle net listener startup:
running listener control:
/u01/app/oracle/product/11.2.0/bin/lsnrctl start listener
listener control complete.
listener started successfully.
# 对于上述报错,将/usr/lib/下oracle目录进行了修改,修改为777,再执行命令就未再报错
4.1 准备dbca.rsp响应文件
# 使用oracle用户执行,编辑dbca.rsp响应文件,主要修改如下内容
# 全局数据库名
gdbname = "orcl"
# 数据库实例名
sid = "orcl"
# sys用户的密码
syspassword = "oracle"
# system用户的密码
systempassword = "oracle"
# sysman用户(用于enterprise manager)的密码
sysmanpassword = "oracle"
# dbsnmp用户(用于snmp管理)的密码
dbsnmppassword = "oracle"
# 数据文件存储路径
datafiledestination =/u01/app/oracle/oradata
# 恢复区域存储路径
recoveryareadestination=/u01/app/oracle/fast_recovery_area
# 数据库字符集
characterset = "zhs16gbk"
# 数据库实例使用的总内存大小(以mb为单位)
totalmemory = "3276"
4.2 创建数据库
# 使用oracle用户,执行如下命令
[oracle@192 ~]$ dbca -silent -responsefile /home/oracle/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
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/orcl/orcl.log" for further details
4.3 查看监听状态
[oracle@192 ~]$ lsnrctl status
lsnrctl for linux: version 11.2.0.4.0 - production on 24-may-2023 02:18:01
米乐app官网下载 copyright (c) 1991, 2013, oracle. all rights reserved.
connecting to (description=(address=(protocol=ipc)(key=extproc1521)))
status of the listener
------------------------
alias listener
version tnslsnr for linux: version 11.2.0.4.0 - production
start date 23-may-2023 23:50:11
uptime 0 days 2 hr. 27 min. 51 sec
trace level off
security on: local os authentication
snmp off
listener parameter file /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
listener log file /u01/app/oracle/diag/tnslsnr/192/listener/alert/log.xml
listening endpoints summary...
(description=(address=(protocol=ipc)(key=extproc1521)))
(description=(address=(protocol=tcp)(host=192.168.xxx.xxx)(port=1521)))
services summary...
service "orcl" has 1 instance(s).
instance "orcl", status ready, has 1 handler(s) for this service...
service "orclxdb" has 1 instance(s).
instance "orcl", status ready, has 1 handler(s) for this service...
the command completed successfully
4.4 查看实例状态
[oracle@192 ~]$ sqlplus / as sysdba
sql*plus: release 11.2.0.4.0 production on wed may 24 02:19:04 2023
米乐app官网下载 copyright (c) 1982, 2013, oracle. all rights reserved.
connected to:
oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit production
with the partitioning, olap, data mining and real application testing options
sql> select status from v$instance;
status
------------
open
4.5 修改local_listener
[oracle@192 ~]$ sqlplus / as sysdba
sql> alter system set local_listener='(address=(protocol=tcp)(host=192.168.xxx.xxx)(port=1521))';
sql> alter system register;
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」 关注作者 【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。 文章被以下合辑收录
评论