一、安装步骤简述
本文章以linux7和19c版本安装为案例,其它linux版本和oracle 12/19版本安装都类似
1、安装操作系统
2、关闭防火墙和selinux安全设置
3、配置yum源
4、安装依赖包(oracle软件安装时必须使用到的)
5、创建用户和组(用于安装oracle数据库软件)
6、配置操作系统参数和内核限制
7、规划Oracle数据库软件和Oracle数据库安装目录
8、Oracle用户环境变量设置
9、上传和检验Oracle软件安装包
10、解压安装包
上述这些步骤详见我以前的文章《Oracle 19c 单机安装总结_linux7》
11、安装数据库软件
12、安装补丁(可选项,安装数据库前将补丁安装,后续不需要运行数据字典升级脚本了)
13、安装数据库
前提说明
1、文章中的oracle安装包解压位置ORACLE_HOME(/u01/app/oracle/product/19.3.0/db_1)目录下,请根据实际环境来对应相关的目录
2、所有步骤都在操作系统oracle用户下执行(su - oracle )
3、19c版本软件包解压后,默认的静默安装应答文件位置如下
$ORACLE_HOME/install/response/db_install.rsp
$ORACLE_HOME/assistants/dbca/dbca.rsp
$ORACLE_HOME/assistants/netca/netca.rsp
4、由于默认的静默应答文件处于不同的目录,很难直接统一备份和使用,因此,为了方便管理和使用,本文中安装静默应答文件统一新建和存放至/home/oracle目录下
二、Oracle数据库软件静默安装详细步骤
1、新建应答文件(用于安装数据库软件)
su - oracle
cat > /home/oracle/db_install.rsp <<EOF
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba
#下面的选项都与安装Oracle数据库软件无关,默认或者为空都行,或者直接去掉下面所有选项也是可以的
oracle.install.db.rootconfig.executeRootScript=false
#上面这个选项表示是否直接切换root执行需要手工执行的两个脚本,默认值为false,表示不直接切换,建议保持默认false
oracle.install.db.rootconfig.configMethod=
oracle.install.db.rootconfig.sudoPath=
oracle.install.db.rootconfig.sudoUserName=
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.ConfigureAsContainerDB=false
oracle.install.db.config.PDBName=
oracle.install.db.config.starterdb.characterSet=
oracle.install.db.config.starterdb.memoryOption=false
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.password.PDBADMIN=
oracle.install.db.config.starterdb.managementOption=DEFAULT
oracle.install.db.config.starterdb.omsHost=
oracle.install.db.config.starterdb.omsPort=0
oracle.install.db.config.starterdb.emAdminUser=
oracle.install.db.config.starterdb.emAdminPassword=
oracle.install.db.config.starterdb.enableRecovery=false
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
EOF
验证
cat /home/oracle/db_install.rsp
2、执行静默安装数据库软件
1)执行静默安装(注意下面命令为一行,没有换行)
$ORACLE_HOME/runInstaller -silent -force -ignorePrereq -responseFile /home/oracle/db_install.rsp
备注:ignoreSysPrereqs 19c已经不支持这个参数
2)输出过程
[oracle@host01 soft]$ $ORACLE_HOME/runInstaller -silent -force -ignorePrereq -responseFile /home/oracle/db_install.rsp
Launching Oracle Database Setup Wizard...
[WARNING] [INS-13014] Target environment does not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2026-03-11_10-52-54PM.log
ACTION: Identify the list of failed prerequisite checks from the log: installActions2026-03-11_10-52-54PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
/u01/app/oracle/product/19.3.0/db_1/install/response/db_2026-03-11_10-52-54PM.rsp
You can find the log of this install session at:
/tmp/InstallActions2026-03-11_10-52-54PM/installActions2026-03-11_10-52-54PM.log
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/19.3.0/db_1/root.sh
Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[host01]
Execute /u01/app/oracle/product/19.3.0/db_1/root.sh on the following nodes:
[host01]
Successfully Setup Software with warning(s).
Moved the install session logs to:
/u01/app/oraInventory/logs/InstallActions2026-03-11_10-52-54PM
3)按提示root用户下执行两个脚本
[root@host01 ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@host01 ~]# /u01/app/oracle/product/19.3.0/db_1/root.sh
Check /u01/app/oracle/product/19.3.0/db_1/install/root_host01_2026-03-11_22-59-18-045053778.log for the output of root script
[root@host01 ~]# cat /u01/app/oracle/product/19.3.0/db_1/install/root_host01_2026-03-11_22-59-18-045053778.log
Performing root user operation.
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/19.3.0/db_1
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Oracle Trace File Analyzer (TFA) is available at : /u01/app/oracle/product/19.3.0/db_1/bin/tfactl
3、应答文件中的选项简要解释
应答文件中的选项简要解释
/home/oracle/db_install.rsp安装选项文件的说明:
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY //安装类型,表示只安装数据库软件
UNIX_GROUP_NAME=oinstall //安装组
INVENTORY_LOCATION=/u01/app/oraInventory //INVENTORY目录(不填就是默认值),一般需要在ORACLE_BASE的上一级目录
ORACLE_BASE=/u01/app/oracle //与.bash_profile中环境变量设置一致
oracle.install.db.InstallEdition=EE //Oracle版本版类,EE表示企业版
oracle.install.db.OSDBA_GROUP=dba //用户组选项,很多组,更精细化管理
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba
oracle.install.db.rootconfig.executeRootScript=false //是否安装过程中直接切换root手工执行的两个脚本,默认值为false,表示不直接切换,建议保持默认false
备注:基本上文件中的每一个选项内容,原有应答文件中都有详细注释,如果有疑惑的可以直接查看原文件来了解
至此完成数据库软件静默安装
4、补充,另一种方式静默安装
效果完全一样,本质就是将应答文件中的选项,直接写在命令行上
$ORACLE_HOME/runInstaller -silent -force -ignorePrereq -waitforcompletion \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
SELECTED_LANGUAGES=en,zh_CN \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSOPER_GROUP=oper \
oracle.install.db.OSBACKUPDBA_GROUP=backupdba \
oracle.install.db.OSDGDBA_GROUP=dgdba \
oracle.install.db.OSKMDBA_GROUP=kmdba \
oracle.install.db.OSRACDBA_GROUP=racdba
三、监听程序静默安装
$ORACLE_HOME/bin/netca /silent /responseFile $ORACLE_HOME/assistants/netca/netca.rsp
备注:应答文件默认即可,不需要任何修改
四、数据库静默安装
1、创建应答文件(用于安装数据库)
cat > /home/oracle/db.rsp <<EOF
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
#数据库的全局名称
gdbName=orcl
#数据库sid,一般与全局保持一致
sid=orcl
#创建的数据库类型,单实例
databaseConfigType=SI
#下面选项表示是否创建为容器类型数据库,已经容器数据库的相关选项
createAsContainerDatabase=false
#numberOfPDBs=0
#pdbName=
#useLocalUndoForPDBs=true
#pdbAdminPassword=
#创建数据库时使用的模板,通用,oltp,olap,一般选择通用模板即可如下
templateName=General_Purpose.dbc
#sys和system的默认密码
sysPassword=oracle
systemPassword=oracle
#serviceUserPassword=
#数据文件,控制文件,日志文件存放位置
datafileDestination=/oradata/
recoveryAreaDestination=
#存储方式FS表示文件系统,默认就是这个值
storageType=FS
#通常中文选择的有 ZHS16GBK 简体中文库,如果需要使用UTF8字符集,则建议选择unicode的 AL32UTF8 国际字符集
characterSet=ZHS16GBK
nationalCharacterSet=AL16UTF16
#下面这个选项,可以调整一些创建数据库时的默认参数如下
initParams=sga_target=1000MB,,processes=1000,pga_aggregate_target=100MB,open_cursors=1000,audit_trail=none
#新建数据库中不创建案例用户
sampleSchema=false
#oracle使用内存占用操作系统的百分比,如果后面的TOTALMEMORY没执行,则默认40%
memoryPercentage=40
#多用途,oltp,olap,一般选择MULTIPURPOSE
databaseType=MULTIPURPOSE
#不使用11g的新特性自动内存管理,也就是SGA_TARGET和PAG_AGGREGATE_TARGET都不用设置了,Oracle会自动调配两部分大小。使用sga和pga内存管理
automaticMemoryManagement=false
totalMemory=0
EOF
验证
cat /home/oracle/db.rsp
2、执行静默安装数据库
$ORACLE_HOME/bin/dbca -silent -createDatabase -responseFile /home/oracle/db.rsp
备注:19c版本应答文件中没有OPERATION_TYPE = "createDatabase"选项了,该选项表示新创建数据库,需要在命令行上直接加上,表示创建新数据库
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
Prepare for db operation
10% complete
Copying database files
File "/etc/oratab" is not accessible.
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
69% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/orcl.
Database Information:
Global Database Name:orcl
System Identifier(SID):orcl
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
至此完成数据库的静默安装
4、补充,另一种方式完成静默数据库安装
dbca -silent -createDatabase \
-responseFile NO_VALUE \
-templateName General_Purpose.dbc \
-gdbname orcl \
-sid orcl \
-databaseConfigType SI \
-createAsContainerDatabase true \
-numberOfPDBs 2 \
-pdbName pdb \
-useLocalUndoForPDBs true \
-pdbAdminPassword pdbadmin \
-sysPassword oracle \
-systemPassword oracle \
-datafileDestination /oradata \
-storageType FS \
-databaseType MULTIPURPOSE \
-characterSet ZHS16GBK \
-nationalCharacterSet AL16UTF16 \
-automaticMemoryManagement false \
-totalMemory 2000 \
-sampleSchema false
备注:
totalMemory 2048表示oracle总内存使用大小为2000MB
注意不要有=符号
createAsContainerDatabase true表示创建为容器类型的数据库
输出:
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
Prepare for db operation
8% complete
Copying database files
File "/etc/oratab" is not accessible.
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
53% complete
54% complete
Creating Pluggable Databases
58% complete
63% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/orcl.
Database Information:
Global Database Name:orcl
System Identifier(SID):orcl
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
容器数据库类型验证:
[oracle@host01 ~]$ sqlplus "/as sysdba"
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 PDB2 READ WRITE NO