3、linux静默安装oracle11g

linux静默安装oracle11g

1、环境准备

1.1下载安装包

http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip

1.2、安装rz依赖

yum install lrzsz -y

1.3、关闭selinux

vi /etc/selinux/config

设置SELINUX=disabled

1.4、关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service

1.5、安装oracle依赖

yum install -y gcc make binutils gcc-c++ compat-libstdc++-33elfutils-libelf-devel elfutils-libelf-devel-static ksh libaio libaio-develnumactl-devel sysstat unixODBC unixODBC-devel pcre-devel

1.6、创建用户以及用户组

groupadd -g 54321 oinstall
useradd -u 54321 -g oinstall oracle
passwd oracle

1.7、创建oracle安装目录

root用户执行

mkdir -p /u01/app/oracle/product/11.2.0/db_1
mkdir -p /u01/app/oracle/oradata
chown -R oracle:oinstall /u01
chmod -R 775 /u01

2、更改系统环境

2.1、修改系统内核配置

vi /etc/sysctl.conf

追加:

#Oracle
#Oracle
# oracle-database-preinstall-19c setting for fs.file-max is 6815744
fs.file-max = 6815744
# oracle-database-preinstall-19c setting for kernel.sem is '250 32000 100 128'
kernel.sem = 250 32000 100 128
# oracle-database-preinstall-19c setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# oracle-database-preinstall-19c setting for kernel.shmall is 1073741824 on x86_64
kernel.shmall = 1073741824
# oracle-database-preinstall-19c setting for kernel.shmmax is 4398046511104 on x86_64
kernel.shmmax = 4398046511104
# oracle-database-preinstall-19c setting for kernel.panic_on_oops is 1 per Orabug 19212317
kernel.panic_on_oops = 1
# oracle-database-preinstall-19c setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# oracle-database-preinstall-19c setting for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# oracle-database-preinstall-19c setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# oracle-database-preinstall-19c setting for net.core.wmem_max is 1048576
net.core.wmem_max = 1048576
# oracle-database-preinstall-19c setting for net.ipv4.conf.all.rp_filter is 2
net.ipv4.conf.all.rp_filter = 2
# oracle-database-preinstall-19c setting for net.ipv4.conf.default.rp_filter is 2
net.ipv4.conf.default.rp_filter = 2
# oracle-database-preinstall-19c setting for fs.aio-max-nr is 1048576
fs.aio-max-nr = 1048576
# oracle-database-preinstall-19c setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500

修改后刷新配置:

sysctl -p

2.2、设定oracle用户的环境变量

oracle用户编辑 ~/.bash_profile 文件

vi ~/.bash_profile

需要更改指定实例名

export ORACLE_UNQNAME

export ORACLE_SID

export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=dbserver24.localdomain
export ORACLE_UNQNAME=cpicdev #标识
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cpicdev #实例名
export DATA_DIR=/u01/app/oracle/oradata
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LANG="zh_CN.UTF-8"
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATA_FORMAT="yyyy-mm-dd hh24:mi:ss"

使环境变量生效(最好重启机器,确保所有配置生效)

source ~/.bash_profile

3、安装数据库

3.1、解压文件

oracle用户执行

cd /u01/package/
unzip /u01/package/linux.x64_11gR2_database_1of2.zip
unzip /u01/package/linux.x64_11gR2_database_2of2.zip

3.2、静默安装软件

在oracle用户执行(使用图形安装需要直接用oracle用户登录,用su到oracle用户出现问题)(一行的)

/u01/package/database下执行:

这里选择的版本oracle.install.db.InstallEdition=EE,还可选SE

./runInstaller -waitforcompletion -silent -ignorePrereq
-responseFile /u01/package/database/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=${ORACLE_HOSTNAME}
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=${ORA_INVENTORY}
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=${ORACLE_HOME}
ORACLE_BASE=${ORACLE_BASE}
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.DBA_GROUP=oinstall
oracle.install.db.OPER_GROUP=oinstall
DECLINE_SECURITY_UPDATES=true
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
./runInstaller -waitforcompletion -silent -ignorePrereq -responseFile /u01/package/database/response/db_install.rsp oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=${ORACLE_HOSTNAME} UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ORA_INVENTORY} SELECTED_LANGUAGES=en,zh_CN,zh_TW ORACLE_HOME=${ORACLE_HOME} ORACLE_BASE=${ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.isCustomInstall=true oracle.install.db.OSBACKUPDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dba oracle.install.db.OSKMDBA_GROUP=dba oracle.install.db.DBA_GROUP=oinstall oracle.install.db.OPER_GROUP=oinstall DECLINE_SECURITY_UPDATES=true SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

成功如下:

Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 670901 MB Passed
Checking swap space: must be greater than 150 MB. Actual 7934 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-11-29_05-44-21PM. Please wait ...You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2022-11-29_05-44-21PM.log
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oracle/product/11.2.0/dbhome_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用户执行:生成/etc/oratab

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

3.2.1可能会出现的问题:

邮件问题,加上:

DECLINE_SECURITY_UPDATES=true

组内执行权限问题:

User is not a member of the following chosen OS groups: [null, null]

oracle.install.db.DBA_GROUP=oinstall
oracle.install.db.OPER_GROUP=oinstall

有些强制参数问题:

Target environment do not meet some mandatory requirements.

-ignorePrereq

3.3、安装实例

oracle用户执行(一行的)

dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ${ORACLE_SID} -sid ${ORACLE_SID} -responseFile NO_VALUE -characterSet AL32UTF8 -sysPassword Password1 -systemPassword Password1 -databaseType MULTIPURPOSE -totalMemory 2000 -storageType FS -datafileDestination "${DATA_DIR}" -redoLogFileSize 50 -emConfiguration NONE

安装完成后提示:

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/insapi/insapi.log" for further details.

3.4、将动态参数写入到静态参数文件中

参数将会写在 $ORACLE_HOME/dbs 目录下

sqlplus / as sysdba
SQL> create pfile from spfile;

3.5、启动监听

lsnrctl status
lsnrctl start

4、cat: /etc/oratab: No such file or directory

find -name root.sh
sh /u01/app/oracle/product/11.2.0/db_1/root.sh
posted @   站着说话不腰疼  阅读(429)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· 字符编码:从基础到乱码解决
· Open-Sora 2.0 重磅开源!
点击右上角即可分享
微信分享提示