文章大纲
静默安装是在实际环境中使用最多的一种方式,而且部署可能还是离线环境。
安装前系统准备工作
在安装数据库之前需要对系统环境进行检查和配置来满足安装要求。
系统检查
在准备安装的系统上进行检查内存、系统版本、共享内存、磁盘空间、CPU 信息和架构:
[student@oel7-2 ~]$ free -m
total used free shared buff/cache available
Mem: 3926 393 3217 11 315 3292
Swap: 4095 0 4095
[student@oel7-2 ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
[student@oel7-2 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 9.5M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/mapper/ol-root 35G 6.5G 29G 19% /
/dev/mapper/ol-u01 60G 33M 60G 1% /u01
/dev/sda1 1014M 218M 797M 22% /boot
tmpfs 393M 8.0K 393M 1% /run/user/42
tmpfs 393M 0 393M 0% /run/user/1000
[student@oel7-2 ~]$ uname -m
x86_64
[student@oel7-2 ~]$ cat /proc/version
Linux version 5.4.17-2102.201.3.el7uek.x86_64 (mockbuild@host-100-100-224-4) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39.0.3) (GCC)) #2 SMP Fri Apr 23 09:05:55 PDT 2021
系统配置
设置 /etc/hosts
解析:
[student@oel7-2 ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.131.140 oel7-2 oel7-2.example.com
[student@oel7-2 ~]$ hostname
oel7-2.example.com
关闭防火墙和 SELinux:
[student@oel7-2 ~]$ sudo systemctl disable --now firewalld
[student@oel7-2 ~]$ sudo setenforce 0
[student@oel7-2 ~]$ grep SELINUX= /etc/selinux/config
# SELINUX= can take one of these three values:
SELINUX=disabled
配置使用 ISO 的 YUM 仓库:
[student@oel7-2 ~]$ sudo mkdir /mnt/iso
[student@oel7-2 ~]$ sudo mount /dev/sr0 /mnt/iso
mount: /dev/sr0 is write-protected, mounting read-only
[student@oel7-2 ~]$ sudo mkdir /etc/yum.repos.d/bak
[student@oel7-2 ~]$ sudo mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
[student@oel7-2 ~]$ cat /etc/yum.repos.d/iso.repo
[iso]
name=iso
baseurl=file:///mnt/iso
gpgcheck=0
enabled=1
手动准备环境
ISO 带有 oracle-database-preinstall-19c
rpm 包,可以帮助我们自动的创建所需用户和配置内核参数,也可以手动进行配置。
手动配置之前可以检查是否有安装过 Oracle 软件:
[student@oel7-2 ~]$ ls /etc/oraInst.loc
ls: cannot access /etc/oraInst.loc: No such file or directory
创建用户和组
创建所需组和用户:
[student@oel7-2 ~]$ sudo groupadd -g 54321 oinstall
[student@oel7-2 ~]$ sudo groupadd -g 54322 dba
[student@oel7-2 ~]$ sudo groupadd -g 54323 oper
[student@oel7-2 ~]$ sudo useradd -u 54321 -g oinstall -G dba,oper oracle
[student@oel7-2 ~]$ echo oracle | sudo passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
创建 Oracle 安装目录
创建目录时需要注意权限:
[student@oel7-2 ~]$ sudo mkdir -p /u01/app/oracle
[student@oel7-2 ~]$ sudo chown -R oracle:oinstall /u01/app/oracle
[student@oel7-2 ~]$ sudo chmod 775 /u01/app/oracle
配置环境变量
为 oracle 用户设置环境变量:
[oracle@oel7-2 ~]$ vim .bash_profile
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export CLASSPATH=$ORACLE_HOME/JRE:ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
[oracle@oel7-2 ~]$ source .bash_profile
配置内核参数
Oracle 对内核一组内核参数值有要求:
[student@oel7-2 ~]$ sudo vim /etc/sysctl.d/oracle.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
[student@oel7-2 ~]$ sudo sysctl --system
[student@oel7-2 ~]$ sysctl kernel.shmmax
kernel.shmmax = 4398046511104
安装所需依赖
检查依赖情况,对缺少的依赖进行安装:
[student@oel7-2 ~]$ rpm -q bc \
> binutils \
> compat-libcap1 \
> compat-libstdc++-33 \
> elfutils-libelf \
> elfutils-libelf-devel \
> fontconfig-devel \
> glibc \
> glibc-devel \
> ksh \
> libaio \
> libaio-devel \
> libXrender \
> libXrender-devel \
> libX11 \
> libXau \
> libXi \
> libXtst \
> libgcc \
> libstdc++ \
> libstdc++-devel \
> libxcb \
> make \
> policycoreutils \
> policycoreutils-python \
> smartmontools \
> sysstat \ | grep "not installed"
package elfutils-libelf-devel is not installed
package fontconfig-devel is not installed
package ksh is not installed
package libaio-devel is not installed
package libXrender-devel is not installed
sudo yum install -y elfutils-libelf-devel fontconfig-devel ksh libaio-devel libXrender-devel
解压 Oracle 软件包
将 oracle zip 软件包上传至系统,然后解压至 $ORACLE_HOME
目录:
[oracle@oel7-2 ~]$ mkdir -p /u01/app/oracle/product/19.3.0/db_1
[oracle@oel7-2 ~]$ unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/db_1
[oracle@oel7-2 ~]$ chown -R oracle:oinstall /u01/app/oracle/product/19.3.0/db_1
[oracle@oel7-2 ~]$ chmod 775 -R /u01/app/oracle/product/19.3.0/db_1
静默安装 Oracle 数据库
静默安装通过使用已存在的响应文件进行安装,避免了安装过程中交互的输入安装参数。
静默安装 Oracle 软件
在 $ORACLE_HOME/install/response
目录中存在一个响应文件,可以以此为基础进行修改:
[oracle@oel7-2 ~]$ cd $ORACLE_HOME/install/response
[oracle@oel7-2 response]$ cp db_install.rsp /tmp/
对 /tmp/db_install.rsp
进行修改,该文件每一个参数都有描述,如果仅安装数据库软件并不需要对所有参数进行配置:
####################################################################
## Copyright(c) Oracle Corporation 1998,2019. All rights reserved.##
## ##
## Specify values for the variables listed below to customize ##
## your installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## can help to populate the variables with the appropriate ##
## values. ##
## ##
## IMPORTANT NOTE: This file contains plain text passwords and ##
## should be secured to have read permission only by oracle user ##
## or db administrator who owns this installation. ##
## ##
####################################################################
#------------------------------------------------------------------------------
# Do not change the following system generated value.
#------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
#-------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# - INSTALL_DB_SWONLY
# - INSTALL_DB_AND_CONFIG
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY
#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall
#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/u01/app/oraInventory
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/product/19.3.0/db_1
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=/u01/app/oracle
#-------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# - EE : Enterprise Edition
# - SE2 : Standard Edition 2
#-------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE
###############################################################################
# #
# PRIVILEGED OPERATING SYSTEM GROUPS #
# ------------------------------------------ #
# Provide values for the OS groups to which SYSDBA and SYSOPER privileges #
# needs to be granted. If the install is being performed as a member of the #
# group "dba", then that will be used unless specified otherwise below. #
# #
# The value to be specified for OSDBA and OSOPER group is only for UNIX based #
# Operating System. #
# #
###############################################################################
#------------------------------------------------------------------------------
# The OSDBA_GROUP is the OS group which is to be granted SYSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.OSDBA_GROUP=dba
#------------------------------------------------------------------------------
# The OSOPER_GROUP is the OS group which is to be granted SYSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OSOPER_GROUP=oper
#------------------------------------------------------------------------------
# The OSBACKUPDBA_GROUP is the OS group which is to be granted SYSBACKUP privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSBACKUPDBA_GROUP=dba
#------------------------------------------------------------------------------
# The OSDGDBA_GROUP is the OS group which is to be granted SYSDG privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSDGDBA_GROUP=dba
#------------------------------------------------------------------------------
# The OSKMDBA_GROUP is the OS group which is to be granted SYSKM privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSKMDBA_GROUP=dba
#------------------------------------------------------------------------------
# The OSRACDBA_GROUP is the OS group which is to be granted SYSRAC privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSRACDBA_GROUP=dba
################################################################################
# #
# Root script execution configuration #
# #
################################################################################
#-------------------------------------------------------------------------------------------------------
# Specify the root script execution mode.
#
# - true : To execute the root script automatically by using the appropriate configuration methods.
# - false : To execute the root script manually.
#
# If this option is selected, password should be specified on the console.
#-------------------------------------------------------------------------------------------------------
oracle.install.db.rootconfig.executeRootScript=
#--------------------------------------------------------------------------------------
# Specify the configuration method to be used for automatic root script execution.
#
# Following are the possible choices:
# - ROOT
# - SUDO
#--------------------------------------------------------------------------------------
oracle.install.db.rootconfig.configMethod=
#--------------------------------------------------------------------------------------
# Specify the absolute path of the sudo program.
#
# Applicable only when SUDO configuration method was chosen.
#--------------------------------------------------------------------------------------
oracle.install.db.rootconfig.sudoPath=
#--------------------------------------------------------------------------------------
# Specify the name of the user who is in the sudoers list.
# Applicable only when SUDO configuration method was chosen.
# Note:For Single Instance database installations,the sudo user name must be the username of the user installing the database.
#--------------------------------------------------------------------------------------
oracle.install.db.rootconfig.sudoUserName=
###############################################################################
# #
# Grid Options #
# #
###############################################################################
#------------------------------------------------------------------------------
# Value is required only if the specified install option is INSTALL_DB_SWONLY
#
# Specify the cluster node names selected during the installation.
#
# Example : oracle.install.db.CLUSTER_NODES=node1,node2
#------------------------------------------------------------------------------
oracle.install.db.CLUSTER_NODES=
###############################################################################
# #
# Database Configuration Options #
# #
###############################################################################
#-------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
# - GENERAL_PURPOSE
# - DATA_WAREHOUSE
# GENERAL_PURPOSE: A starter database designed for general purpose use or transaction-heavy applications.
# DATA_WAREHOUSE : A starter database optimized for data warehousing applications.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
#-------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=
#-------------------------------------------------------------------------------
# Specify the Starter Database SID.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=
#-------------------------------------------------------------------------------
# Specify whether the database should be configured as a Container database.
# The value can be either "true" or "false". If left blank it will be assumed
# to be "false".
#-------------------------------------------------------------------------------
oracle.install.db.ConfigureAsContainerDB=
#-------------------------------------------------------------------------------
# Specify the Pluggable Database name for the pluggable database in Container Database.
#-------------------------------------------------------------------------------
oracle.install.db.config.PDBName=
#-------------------------------------------------------------------------------
# Specify the Starter Database character set.
#
# One of the following
# AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
# EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
# BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
# AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
# IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
# KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
# ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.characterSet=
#------------------------------------------------------------------------------
# This variable should be set to true if Automatic Memory Management
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryOption=
#-------------------------------------------------------------------------------
# Specify the total memory allocation for the database. Value(in MB) should be
# at least 256 MB, and should not exceed the total physical memory available
# on the system.
# Example: oracle.install.db.config.starterdb.memoryLimit=512
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryLimit=
#-------------------------------------------------------------------------------
# This variable controls whether to load Example Schemas onto
# the starter database or not.
# The value can be either "true" or "false". If left blank it will be assumed
# to be "false".
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=
###############################################################################
# #
# Passwords can be supplied for the following four schemas in the #
# starter database: #
# SYS #
# SYSTEM #
# DBSNMP (used by Enterprise Manager) #
# #
# Same password can be used for all accounts (not recommended) #
# or different passwords for each account can be provided (recommended) #
# #
###############################################################################
#------------------------------------------------------------------------------
# This variable holds the password that is to be used for all schemas in the
# starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.ALL=
#-------------------------------------------------------------------------------
# Specify the SYS password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYS=
#-------------------------------------------------------------------------------
# Specify the SYSTEM password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSTEM=
#-------------------------------------------------------------------------------
# Specify the DBSNMP password for the starter database.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.DBSNMP=
#-------------------------------------------------------------------------------
# Specify the PDBADMIN password required for creation of Pluggable Database in the Container Database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.PDBADMIN=
#-------------------------------------------------------------------------------
# Specify the management option to use for managing the database.
# Options are:
# 1. CLOUD_CONTROL - If you want to manage your database with Enterprise Manager Cloud Control along with Database Express.
# 2. DEFAULT -If you want to manage your database using the default Database Express option.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.managementOption=
#-------------------------------------------------------------------------------
# Specify the OMS host to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.omsHost=
#-------------------------------------------------------------------------------
# Specify the OMS port to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.omsPort=
#-------------------------------------------------------------------------------
# Specify the EM Admin user name to use to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.emAdminUser=
#-------------------------------------------------------------------------------
# Specify the EM Admin password to use to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.emAdminPassword=
###############################################################################
# #
# SPECIFY RECOVERY OPTIONS #
# ------------------------------------ #
# Recovery options for the database can be mentioned using the entries below #
# #
###############################################################################
#------------------------------------------------------------------------------
# This variable is to be set to false if database recovery is not required. Else
# this can be set to true.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.enableRecovery=
#-------------------------------------------------------------------------------
# Specify the type of storage to use for the database.
# It can be one of the following:
# - FILE_SYSTEM_STORAGE
# - ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.storageType=
#-------------------------------------------------------------------------------
# Specify the database file location which is a directory for datafiles, control
# files, redo logs.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
#-------------------------------------------------------------------------------
# Specify the recovery location.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
#-------------------------------------------------------------------------------
# Specify the existing ASM disk groups to be used for storage.
#
# Applicable only when oracle.install.db.config.starterdb.storageType=ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.diskGroup=
#-------------------------------------------------------------------------------
# Specify the password for ASMSNMP user of the ASM instance.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.ASMSNMPPassword=
主要修改以下参数:
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_HOME=/u01/app/oracle/product/19.3.0/db_1
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
使用 runInstaller
静默安装配合 rsp
文件:
[oracle@oel7-2 ~]$ cd $ORACLE_HOME
[oracle@oel7-2 db_1]$ ./runInstaller -silent -responseFile /tmp/db_install.rsp -ignorePrereq
安装成功的输出:

根据要求使用 root
权限运行脚本:
[oracle@oel7-2 db_1]$ su -
Password:
Last login: Sat Jan 4 13:44:19 CST 2025 on pts/0
[root@oel7-2 ~]# /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@oel7-2 ~]# /u01/app/oracle/product/19.3.0/db_1/root.sh
Check /u01/app/oracle/product/19.3.0/db_1/install/root_oel7-2.example.com_2025-01-04_13-46-20-502192761.log for the output of root script
创建监听
监听也有 response 文件,可以查找名为 netca.rsp
的文件:
[oracle@oel7-2 ~]$ find $ORACLE_HOME -name netca.rsp
/u01/app/oracle/product/19.3.0/db_1/assistants/netca/netca.rsp
文件默认配置监听 TCP 1521,静默配置监听:
[oracle@oel7-2 ~]$ netca -silent -responseFile /u01/app/oracle/product/19.3.0/db_1/assistants/netca/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u01/app/oracle/product/19.3.0/db_1/assistants/netca/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/19.3.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
[oracle@oel7-2 ~]$
[oracle@oel7-2 ~]$ lsnrctl status
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-JAN-2025 13:54:39
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel7-2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 04-JAN-2025 13:54:35
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/19.3.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oel7-2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel7-2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
静默创建数据库
创建数据库使用 dbca
工具,它也支持静默安装。
首先需要找到 response 文件:
[oracle@oel7-2 ~]$ find $ORACLE_HOME -name dbca.rsp
/u01/app/oracle/product/19.3.0/db_1/assistants/dbca/dbca.rsp
找到后,根据创建数据参数修改文件:
[oracle@oel7-2 ~]$ cp /u01/app/oracle/product/19.3.0/db_1/assistants/dbca/dbca.rsp /tmp/
[oracle@oel7-2 ~]$ vim /tmp/dbca.rsp
文件内容:
##############################################################################
## ##
## DBCA response file ##
## ------------------ ##
## Copyright(c) Oracle Corporation 1998,2019. All rights reserved. ##
## ##
## Specify values for the variables listed below to customize ##
## your installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## can help to populate the variables with the appropriate ##
## values. ##
## ##
## IMPORTANT NOTE: This file contains plain text passwords and ##
## should be secured to have read permission only by oracle user ##
## or db administrator who owns this installation. ##
##############################################################################
#-------------------------------------------------------------------------------
# Do not change the following system generated value.
#-------------------------------------------------------------------------------
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v19.0.0
#-----------------------------------------------------------------------------
# Name : gdbName
# Datatype : String
# Description : Global database name of the database
# Valid values : <db_name>.<db_domain> - when database domain isn't NULL
# <db_name> - when database domain is NULL
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
gdbName=
#-----------------------------------------------------------------------------
# Name : sid
# Datatype : String
# Description : System identifier (SID) of the database
# Valid values : Check Oracle19c Administrator's Guide
# Default value : <db_name> specified in GDBNAME
# Mandatory : No
#-----------------------------------------------------------------------------
sid=
#-----------------------------------------------------------------------------
# Name : databaseConfigType
# Datatype : String
# Description : database conf type as Single Instance, Real Application Cluster or Real Application Cluster One Nodes database
# Valid values : SI\RAC\RACONENODE
# Default value : SI
# Mandatory : No
#-----------------------------------------------------------------------------
databaseConfigType=
#-----------------------------------------------------------------------------
# Name : RACOneNodeServiceName
# Datatype : String
# Description : Service is required by application to connect to RAC One
# Node Database
# Valid values : Service Name
# Default value : None
# Mandatory : No [required in case DATABASECONFTYPE is set to RACONENODE ]
#-----------------------------------------------------------------------------
RACOneNodeServiceName=
#-----------------------------------------------------------------------------
# Name : policyManaged
# Datatype : Boolean
# Description : Set to true if Database is policy managed and
# set to false if Database is admin managed
# Valid values : TRUE\FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
policyManaged=
#-----------------------------------------------------------------------------
# Name : createServerPool
# Datatype : Boolean
# Description : Set to true if new server pool need to be created for database
# if this option is specified then the newly created database
# will use this newly created serverpool.
# Multiple serverpoolname can not be specified for database
# Valid values : TRUE\FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
createServerPool=
#-----------------------------------------------------------------------------
# Name : serverPoolName
# Datatype : String
# Description : Only one serverpool name need to be specified
# if Create Server Pool option is specified.
# Comma-separated list of Serverpool names if db need to use
# multiple Server pool
# Valid values : ServerPool name
# Default value : None
# Mandatory : No [required in case of RAC service centric database]
#-----------------------------------------------------------------------------
serverPoolName=
#-----------------------------------------------------------------------------
# Name : cardinality
# Datatype : Number
# Description : Specify Cardinality for create server pool operation
# Valid values : any positive Integer value
# Default value : Number of qualified nodes on cluster
# Mandatory : No [Required when a new serverpool need to be created]
#-----------------------------------------------------------------------------
cardinality=
#-----------------------------------------------------------------------------
# Name : force
# Datatype : Boolean
# Description : Set to true if new server pool need to be created by force
# if this option is specified then the newly created serverpool
# will be assigned server even if no free servers are available.
# This may affect already running database.
# This flag can be specified for Admin managed as well as policy managed db.
# Valid values : TRUE\FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
force=
#-----------------------------------------------------------------------------
# Name : pqPoolName
# Datatype : String
# Description : Only one serverpool name needs to be specified
# if create server pool option is specified.
# Comma-separated list of serverpool names if use
# server pool. This is required to
# create Parallel Query (PQ) database. Applicable to Big Cluster
# Valid values : Parallel Query (PQ) pool name
# Default value : None
# Mandatory : No [required in case of RAC service centric database]
#-----------------------------------------------------------------------------
pqPoolName=
#-----------------------------------------------------------------------------
# Name : pqCardinality
# Datatype : Number
# Description : Specify Cardinality for create server pool operation.
# Applicable to Big Cluster
# Valid values : any positive Integer value
# Default value : Number of qualified nodes on cluster
# Mandatory : No [Required when a new serverpool need to be created]
#-----------------------------------------------------------------------------
pqCardinality=
#-----------------------------------------------------------------------------
# Name : createAsContainerDatabase
# Datatype : boolean
# Description : flag to create database as container database
# Valid values : Check Oracle19c Administrator's Guide
# Default value : false
# Mandatory : No
#-----------------------------------------------------------------------------
createAsContainerDatabase=
#-----------------------------------------------------------------------------
# Name : numberOfPDBs
# Datatype : Number
# Description : Specify the number of pdb to be created
# Valid values : 0 to 4094
# Default value : 0
# Mandatory : No
#-----------------------------------------------------------------------------
numberOfPDBs=
#-----------------------------------------------------------------------------
# Name : pdbName
# Datatype : String
# Description : Specify the pdbname/pdbanme prefix if one or more pdb need to be created
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
pdbName=
#-----------------------------------------------------------------------------
# Name : useLocalUndoForPDBs
# Datatype : boolean
# Description : Flag to create local undo tablespace for all PDB's.
# Valid values : TRUE\FALSE
# Default value : TRUE
# Mandatory : No
#-----------------------------------------------------------------------------
useLocalUndoForPDBs=
#-----------------------------------------------------------------------------
# Name : pdbAdminPassword
# Datatype : String
# Description : PDB Administrator user password
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
pdbAdminPassword=
#-----------------------------------------------------------------------------
# Name : nodelist
# Datatype : String
# Description : Comma-separated list of cluster nodes
# Valid values : Cluster node names
# Default value : None
# Mandatory : No (Yes for RAC database-centric database )
#-----------------------------------------------------------------------------
nodelist=
#-----------------------------------------------------------------------------
# Name : templateName
# Datatype : String
# Description : Name of the template
# Valid values : Template file name
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
templateName=
#-----------------------------------------------------------------------------
# Name : sysPassword
# Datatype : String
# Description : Password for SYS user
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
sysPassword=
#-----------------------------------------------------------------------------
# Name : systemPassword
# Datatype : String
# Description : Password for SYSTEM user
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
systemPassword=
#-----------------------------------------------------------------------------
# Name : oracleHomeUserPassword
# Datatype : String
# Description : Password for Windows Service user
# Default value : None
# Mandatory : If Oracle home is installed with windows service user
#-----------------------------------------------------------------------------
oracleHomeUserPassword=
#-----------------------------------------------------------------------------
# Name : emConfiguration
# Datatype : String
# Description : Enterprise Manager Configuration Type
# Valid values : CENTRAL|DBEXPRESS|BOTH|NONE
# Default value : NONE
# Mandatory : No
#-----------------------------------------------------------------------------
emConfiguration=
#-----------------------------------------------------------------------------
# Name : emExpressPort
# Datatype : Number
# Description : Enterprise Manager Configuration Type
# Valid values : Check Oracle19c Administrator's Guide
# Default value : NONE
# Mandatory : No, will be picked up from DBEXPRESS_HTTPS_PORT env variable
# or auto generates a free port between 5500 and 5599
#-----------------------------------------------------------------------------
emExpressPort=5500
#-----------------------------------------------------------------------------
# Name : runCVUChecks
# Datatype : Boolean
# Description : Specify whether to run Cluster Verification Utility checks
# periodically in Cluster environment
# Valid values : TRUE\FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
runCVUChecks=
#-----------------------------------------------------------------------------
# Name : dbsnmpPassword
# Datatype : String
# Description : Password for DBSNMP user
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : Yes, if emConfiguration is specified or
# the value of runCVUChecks is TRUE
#-----------------------------------------------------------------------------
dbsnmpPassword=
#-----------------------------------------------------------------------------
# Name : omsHost
# Datatype : String
# Description : EM management server host name
# Default value : None
# Mandatory : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
omsHost=
#-----------------------------------------------------------------------------
# Name : omsPort
# Datatype : Number
# Description : EM management server port number
# Default value : None
# Mandatory : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
omsPort=
#-----------------------------------------------------------------------------
# Name : emUser
# Datatype : String
# Description : EM Admin username to add or modify targets
# Default value : None
# Mandatory : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
emUser=
#-----------------------------------------------------------------------------
# Name : emPassword
# Datatype : String
# Description : EM Admin user password
# Default value : None
# Mandatory : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
emPassword=
#-----------------------------------------------------------------------------
# Name : dvConfiguration
# Datatype : Boolean
# Description : Specify "True" to configure and enable Oracle Database vault
# Valid values : True/False
# Default value : False
# Mandatory : No
#-----------------------------------------------------------------------------
dvConfiguration=
#-----------------------------------------------------------------------------
# Name : dvUserName
# Datatype : String
# Description : DataVault Owner
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
dvUserName=
#-----------------------------------------------------------------------------
# Name : dvUserPassword
# Datatype : String
# Description : Password for DataVault Owner
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
dvUserPassword=
#-----------------------------------------------------------------------------
# Name : dvAccountManagerName
# Datatype : String
# Description : DataVault Account Manager
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
dvAccountManagerName=
#-----------------------------------------------------------------------------
# Name : dvAccountManagerPassword
# Datatype : String
# Description : Password for DataVault Account Manager
# Valid values : Check Oracle19c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
dvAccountManagerPassword=
#-----------------------------------------------------------------------------
# Name : olsConfiguration
# Datatype : Boolean
# Description : Specify "True" to configure and enable Oracle Label Security
# Valid values : True/False
# Default value : False
# Mandatory : No
#-----------------------------------------------------------------------------
olsConfiguration=
#-----------------------------------------------------------------------------
# Name : datafileJarLocation
# Datatype : String
# Description : Location of the data file jar
# Valid values : Directory containing compressed datafile jar
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
datafileJarLocation=
#-----------------------------------------------------------------------------
# Name : datafileDestination
# Datatype : String
# Description : Location of the data file's
# Valid values : Directory for all the database files
# Default value : $ORACLE_BASE/oradata
# Mandatory : No
#-----------------------------------------------------------------------------
datafileDestination=
#-----------------------------------------------------------------------------
# Name : recoveryAreaDestination
# Datatype : String
# Description : Location of the data file's
# Valid values : Recovery Area location
# Default value : $ORACLE_BASE/flash_recovery_area
# Mandatory : No
#-----------------------------------------------------------------------------
recoveryAreaDestination=
#-----------------------------------------------------------------------------
# Name : storageType
# Datatype : String
# Description : Specifies the storage on which the database is to be created
# Valid values : FS (CFS for RAC), ASM
# Default value : FS
# Mandatory : No
#-----------------------------------------------------------------------------
storageType=
#-----------------------------------------------------------------------------
# Name : diskGroupName
# Datatype : String
# Description : Specifies the disk group name for the storage
# Default value : DATA
# Mandatory : No
#-----------------------------------------------------------------------------
diskGroupName=
#-----------------------------------------------------------------------------
# Name : asmsnmpPassword
# Datatype : String
# Description : Password for ASM Monitoring
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
asmsnmpPassword=
#-----------------------------------------------------------------------------
# Name : recoveryGroupName
# Datatype : String
# Description : Specifies the disk group name for the recovery area
# Default value : RECOVERY
# Mandatory : No
#-----------------------------------------------------------------------------
recoveryGroupName=
#-----------------------------------------------------------------------------
# Name : characterSet
# Datatype : String
# Description : Character set of the database
# Valid values : Check Oracle19c National Language Support Guide
# Default value : "US7ASCII"
# Mandatory : NO
#-----------------------------------------------------------------------------
characterSet=
#-----------------------------------------------------------------------------
# Name : nationalCharacterSet
# Datatype : String
# Description : National Character set of the database
# Valid values : "UTF8" or "AL16UTF16". For details, check Oracle19c National Language Support Guide
# Default value : "AL16UTF16"
# Mandatory : No
#-----------------------------------------------------------------------------
nationalCharacterSet=
#-----------------------------------------------------------------------------
# Name : registerWithDirService
# Datatype : Boolean
# Description : Specifies whether to register with Directory Service.
# Valid values : TRUE \ FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
registerWithDirService=
#-----------------------------------------------------------------------------
# Name : dirServiceUserName
# Datatype : String
# Description : Specifies the name of the directory service user
# Mandatory : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
dirServiceUserName=
#-----------------------------------------------------------------------------
# Name : dirServicePassword
# Datatype : String
# Description : The password of the directory service user.
# You can also specify the password at the command prompt instead of here.
# Mandatory : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
dirServicePassword=
#-----------------------------------------------------------------------------
# Name : walletPassword
# Datatype : String
# Description : The password for wallet to created or modified.
# You can also specify the password at the command prompt instead of here.
# Mandatory : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
walletPassword=
#-----------------------------------------------------------------------------
# Name : listeners
# Datatype : String
# Description : Specifies list of listeners to register the database with.
# By default the database is configured for all the listeners specified in the
# $ORACLE_HOME/network/admin/listener.ora
# Valid values : The list should be comma separated like "listener1,listener2".
# Mandatory : NO
#-----------------------------------------------------------------------------
listeners=
#-----------------------------------------------------------------------------
# Name : variablesFile
# Datatype : String
# Description : Location of the file containing variable value pair
# Valid values : A valid file-system file. The variable value pair format in this file
# is <variable>=<value>. Each pair should be in a new line.
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
variablesFile=
#-----------------------------------------------------------------------------
# Name : variables
# Datatype : String
# Description : comma separated list of name=value pairs. Overrides variables defined in variablefile and templates
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
variables=
#-----------------------------------------------------------------------------
# Name : initParams
# Datatype : String
# Description : comma separated list of name=value pairs. Overrides initialization parameters defined in templates
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
initParams=
#-----------------------------------------------------------------------------
# Name : sampleSchema
# Datatype : Boolean
# Description : Specifies whether or not to add the Sample Schemas to your database
# Valid values : TRUE \ FALSE
# Default value : FASLE
# Mandatory : No
#-----------------------------------------------------------------------------
sampleSchema=
#-----------------------------------------------------------------------------
# Name : memoryPercentage
# Datatype : String
# Description : percentage of physical memory for Oracle
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
memoryPercentage=
#-----------------------------------------------------------------------------
# Name : databaseType
# Datatype : String
# Description : used for memory distribution when memoryPercentage specified
# Valid values : MULTIPURPOSE|DATA_WAREHOUSING|OLTP
# Default value : MULTIPURPOSE
# Mandatory : NO
#-----------------------------------------------------------------------------
databaseType=
#-----------------------------------------------------------------------------
# Name : automaticMemoryManagement
# Datatype : Boolean
# Description : flag to indicate Automatic Memory Management is used
# Valid values : TRUE/FALSE
# Default value : TRUE
# Mandatory : NO
#-----------------------------------------------------------------------------
automaticMemoryManagement=
#-----------------------------------------------------------------------------
# Name : totalMemory
# Datatype : String
# Description : total memory in MB to allocate to Oracle
# Valid values :
# Default value :
# Mandatory : NO
#-----------------------------------------------------------------------------
totalMemory=
需要修改的内容:
responseFileVersion=/home/oracle/rspfmt_dbca_response_schema_v19.0.0
gdbName=orcl
sid=orcl
databaseConfigType=SI
templateName=General_Purpose.dbc
oracleHomeUserPassword=oracle
totalMemory=1500
sysPassword=oracle
systemPassword=oracle
datafileDestination=/u01/app/oracle/oradata
characterSet=ZHS16GBK
nationalCharacterSet=AL16UTF16
databaseType=OLTP
使用 rsp 文件静默创建数据库:
[oracle@oel7-2 ~]$ dbca -silent -createDatabase -responseFile /tmp/dbca.rsp
输出结果:

验证数据库已创建:
[oracle@oel7-2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jan 4 15:33:44 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> select status from v$instance;
STATUS
------------
OPEN