Oracle Linux 7.9 静默安装 Oracle Database 19c

前言

上一篇文章中使用图形化方式安装Oracle 21c,这一篇文章中使用静默方式安装Oracle 19c

官方文档

https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/index.html

主机规划

主机名

IP地址

磁盘空间

内存

操作系统版本

数据库版本

forest.oracle.com

192.168.255.219

500G

64G

Oracle Linux 7.9

Oracle 19c

查看操作系统

[root@forest ~]# cat /etc/os-release 
NAME="Oracle Linux Server"
VERSION="7.9"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Oracle Linux Server 7.9"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:9:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.9
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.9

查看磁盘分区

[root@forest ~]# lsblk
NAME               MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0                 11:0    1   4.5G  0 rom  
vda                251:0    0   500G  0 disk 
├─vda2             251:2    0 499.8G  0 part 
│ ├─ol_forest-swap 252:1    0    16G  0 lvm  [SWAP]
│ ├─ol_forest-tmp  252:2    0     8G  0 lvm  /tmp
│ ├─ol_forest-root 252:0    0   100G  0 lvm  /
│ └─ol_forest-u01  252:3    0 375.8G  0 lvm  /u01
└─vda1             251:1    0   200M  0 part /boot
[root@forest ~]# df -Th
Filesystem                 Type      Size  Used Avail Use% Mounted on
devtmpfs                   devtmpfs   32G     0   32G   0% /dev
tmpfs                      tmpfs      32G   41M   32G   1% /dev/shm
tmpfs                      tmpfs      32G  8.7M   32G   1% /run
tmpfs                      tmpfs      32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/ol_forest-root xfs       100G   30G   70G  31% /
/dev/mapper/ol_forest-u01  xfs       376G   44G  333G  12% /u01
/dev/mapper/ol_forest-tmp  xfs       8.0G  1.1G  7.0G  13% /tmp
/dev/vda1                  xfs       197M  167M   31M  85% /boot
tmpfs                      tmpfs     6.3G     0  6.3G   0% /run/user/0

关闭防火墙并禁止开机自启动

[root@forest ~]# systemctl stop firewalld
[root@forest ~]# systemctl disable firewalld

禁用selinux

临时生效
[root@forest ~]# setenforce 0
修改配置文件重启后永久生效
[root@forest ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

修改hosts配置文件

[root@forest ~]# vim /etc/hosts 
192.168.255.219 forest forest.oracle.com
测试
[root@forest ~]# ping forest -c 2
[root@forest ~]# ping forest.oracle.com -c 2

创建用户和组

1、创建组
[root@forest ~]# /usr/sbin/groupadd -g 54321 oinstall
[root@forest ~]# /usr/sbin/groupadd -g 54322 dba
[root@forest ~]# /usr/sbin/groupadd -g 54323 oper
[root@forest ~]# /usr/sbin/groupadd -g 54324 backupdba
[root@forest ~]# /usr/sbin/groupadd -g 54325 dgdba
[root@forest ~]# /usr/sbin/groupadd -g 54326 kmdba
[root@forest ~]# /usr/sbin/groupadd -g 54330 racdba
2、创建oracle用户,主组oinstall,附加组dba,oper,backupdba,dgdba,kmdba,racdba
[root@forest ~]# /usr/sbin/useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba oracle
3、设置oracle密码
[root@forest ~]# /usr/sbin/useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba oracle
[root@forest ~]# echo "oracle" | passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
[root@forest ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)

安装yum依赖包

参考官方文档,安装yum依赖包
[root@forest ~]# yum install bc binutils compat-openssl10 elfutils-libelf glibc glibc-devel ksh libaio libXrender libX11 libXau libXi libXtst libgcc libnsl libstdc++ libxcb libibverbs make policycoreutils policycoreutils-python-utils smartmontools sysstat

创建目录并修改权限

[root@forest ~]# mkdir -p /u01/app/oracle
[root@forest ~]# mkdir -p /u01/app/oraInventory
[root@forest ~]# chown -R oracle:oinstall /u01/app/oracle
[root@forest ~]# chown -R oracle:oinstall /u01/app/oraInventory
[root@forest ~]# chmod -R 775 /u01/app

调整系统内核参数

#kernel.shmmax 表示单个共享内存段的最大字节
#kernel.shmall 表示可以在系统范围内使用的共享内存总量(页为单位)
#kernel.shmmni 用于设置系统范围内共享内存段的最大数量
#kernel.shmmax=kernel.shmall*kernel.shmmni
#fs.aio-max-nr 表示同时可以拥有的异步IO请求数量
#fs.file-max 表示系统级别能够打开的文件句柄的数量
#net.ipv4.ip_local_port_range 表示端口范围
#net.core.rmem_default 表示接收套接字缓冲区大小默认值
#net.core.rmem_max 表示接收套接字缓冲区大小最大值
#net.core.wmem_default 表示发送套接字缓冲区大小默认值
# net.core.wmem_max 表示发送套接字缓冲区大小最大值
[root@forest ~]# vi /etc/sysctl.d/99-sysctl.conf
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
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
使参数生效
[root@forest ~]# sysctl -p

调整系统资源参数

[root@forest ~]# vim /etc/security/limits.conf
oracle   soft   nofile    1024
oracle   hard   nofile    65536
oracle   soft   nproc    16384
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768
oracle   hard   memlock    134217728
oracle   soft   memlock    134217728
oracle   soft   data    unlimited
oracle   hard   data    unlimited

调整用户访问资源参数

[root@forest ~]# vim /etc/pam.d/login 
session required pam_limits.so

设置透明大页

官方文档建议关闭透明大页,将该参数的值设为never
[root@forest ~]# sed -i 's/quiet/quiet transparent_hugepage=never/' /etc/default/grub 
使参数生效
[root@forest ~]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
done

关闭numa

[root@forest ~]# sed -i 's/quiet/quiet transparent_hugepage=never numa=off/' /etc/default/grub 
使参数生效
[root@forest ~]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
done

上传数据库软件并创建ORACLE_HOME目录

1、上传数据库软件
E:\BaiduNetdiskDownload>scp LINUX.X64_193000_db_home.zip root@192.168.255.219:~
[root@forest ~]# ll -h LINUX.X64_193000_db_home.zip 
-rw-r--r--. 1 root root 2.9G Oct 21 16:30 LINUX.X64_193000_db_home.zip
2、创建ORACLE_HOME目录
[root@forest ~]# mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
3、需要解压到ORACLE_HOME目录执行runInstaller,否则会提示报错
[root@forest ~]# unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/dbhome_1
4、修改ORACLE_HOME目录的属组
[root@forest ~]# chown -R oracle:oinstall /u01/app/oracle
[root@forest ~]# ll -hd /u01/app/oracle/product/19.3.0/dbhome_1/
drwxr-xr-x. 63 oracle oinstall 4.0K Oct 21 16:40 /u01/app/oracle/product/21.3.0/dbhome_1/

runInstaller静默安装数据库软件

1、查看runInstaller图形化安装生成的响应文件
[oracle@forest ~]$ egrep -v '^#|^$' runInstaller.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
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.install.db.rootconfig.executeRootScript=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=
2、查看runInstaller帮助命令
[oracle@forest ~]$ /u01/app/oracle/product/19.3.0/dbhome_1/runInstaller -help
Usage:  runInstaller [<flag>] [<option>]
Following are the possible flags: 
    -help - display help. 
    -silent - run in silent mode. The inputs can be a response file or a list of command line variable value pairs.
        [-ignorePrereqFailure - ignore all prerequisite checks failures.]
    -responseFile - specify the complete path of the response file to use.
    -logLevel - enable the log of messages up to the priority level provided in this argument. Valid options are: severe, warning, info, config, fine, finer, finest.
    -executePrereqs | -executeConfigTools | -createGoldImage
    -executePrereqs - execute the prerequisite checks only.
    -executeConfigTools - execute the config tools for an installed home.
    -createGoldImage - create a gold image from the current Oracle home.
        -destinationLocation - specify the complete path to where the created gold image will be located.
        [-exclFiles - specify the complete paths to the files to be excluded from the new gold image.]
    -debug - run in debug mode.
    -printdiskusage - log the debug information for the disk usage.
    -printmemory - log the debug information for the memory usage.
    -printtime - log the debug information for the time usage.
    -waitForCompletion - wait for the completion of the installation, instead of spawning the installer and returning the console prompt.
    -noconfig - do not execute the config tools.
    -noconsole - suppress the display of messages in the console. The console is not allocated.
    -ignoreInternalDriverError - ignore any internal driver errors.
    -noCopy - perform the configuration without copying the software on to the remote nodes.
    -applyRU - apply release update to the Oracle home.
    -applyOneOffs - apply one-off patch to the Oracle home. Multiple one-off patches can be passed as a comma separated list of locations.
3、执行runInstaller
[oracle@forest ~]$ /u01/app/oracle/product/19.3.0/dbhome_1/runInstaller -silent -responseFile /home/oracle/runInstaller.rsp
Launching Oracle Database Setup Wizard...
The response file for this session can be found at:
 /u01/app/oracle/product/19.3.0/dbhome_1/install/response/db_2024-10-21_04-43-52PM.rsp
You can find the log of this install session at:
 /u01/app/oraInventory/logs/InstallActions2024-10-21_04-43-52PM/installActions2024-10-21_04-43-52PM.log
As a root user, execute the following script(s):
        1. /u01/app/oracle/product/19.3.0/dbhome_1/root.sh
Execute /u01/app/oracle/product/19.3.0/dbhome_1/root.sh on the following nodes: 
[forest]
Successfully Setup Software.
4、使用root用户执行两个脚本
[root@forest ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
[root@forest ~]# /u01/app/oracle/product/19.3.0/dbhome_1/root.sh
Check /u01/app/oracle/product/19.3.0/dbhome_1/install/root_forest.oracle.com_2024-10-21_16-47-21-093565531.log for the output of root script
[root@forest ~]# more /u01/app/oracle/product/19.3.0/dbhome_1/install/root_forest.oracle.com_2024-10-21_16-47-21-093565531.log
Performing root user operation.
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19.3.0/dbhome_1
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...
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/dbhome_1/bin/tfactl

dbca静默创建数据库

1、查看dbca图形化创建数据库生成的响应文件
[oracle@forest ~]$ more dbca.rsp 
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=forest.oracle.com
sid=FOREST
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=false
createServerPool=false
serverPoolName=
cardinality=
force=false
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=2
pdbName=FORESTPDB
useLocalUndoForPDBs=true
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/19.3.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=
systemPassword= 
serviceUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=FALSE
dbsnmpPassword=
omsHost=
omsPort=0
emUser=
emPassword=
dvConfiguration=false
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination=
storageType=FS
diskGroupName=
asmsnmpPassword=
[oracle@forest ~]$ more dbca.rsp 
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=forest.oracle.com
sid=FOREST
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=false
createServerPool=false
serverPoolName=
cardinality=
force=false
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=2
pdbName=FORESTPDB
useLocalUndoForPDBs=true
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/19.3.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=
systemPassword= 
serviceUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=FALSE
dbsnmpPassword=
omsHost=
omsPort=0
emUser=
emPassword=
dvConfiguration=false
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination=
storageType=FS
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=false
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=
variablesFile=
variables=ORACLE_BASE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1,DB_UNIQUE_NAME=forest,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=forest.oracle.com,ORACL
E_HOME=/u01/app/oracle/product/19.3.0/dbhome_1,SID=FOREST
initParams=undo_tablespace=UNDOTBS1,sga_target=33239MB,db_block_size=8192BYTES,nls_language=AMERICAN,dispatchers=(PROTOCOL=TCP) (SERVICE=FORESTXDB),diagnostic_dest={ORAC
LE_BASE},control_files=("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control02.ctl"),remote_login_passwordfile=EXCLUSI
VE,audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,processes=1280,pga_aggregate_target=11413MB,nls_territory=AMERICA,local_listener=LISTENER_FOREST,open_curso
rs=300,compatible=19.0.0,db_name=forest,audit_trail=db
sampleSchema=false
memoryPercentage=40
databaseType=MULTIPURPOSE
automaticMemoryManagement=false
totalMemory=0
2、查看dbca帮助命令
[oracle@forest ~]$ dbca -help
Usage:  dbca [<flag>] [<command> <option>]
Following are the possible flags: 
        -help 
                -contextId <RAC | SI>
        -ignorePreReqs - Ignore prerequisite checks for current operation.
        -ignorePrereqFailure  - Ignore all prerequisites failures.
        -silent - This flag allows you to carry on configuration in silent mode.
                -<command>
Following are the possible commands: 
        -addInstance - Command to Add an instance to an admin managed cluster database.
        -configureDatabase - Command to Configure a database.
        -configurePluggableDatabase - Command to Configure a pluggable database.
        -createCloneTemplate - Command to Create a clone template from an existing database.
        -createDatabase - Command to Create a database.
        -createDuplicateDB - Command to Duplicate a database.
        -createPluggableDatabase - Command to Create a pluggable database.
        -createTemplateFromDB - Command to Create a template from an existing database.
        -createTemplateFromTemplate - Command to Create a template from an existing template.
        -deleteDatabase - Command to Delete a database.
        -deleteInstance - Command to Delete an instance from an admin managed cluster database.
        -deletePluggableDatabase - Command to Delete a pluggable database.
        -deleteTemplate - Command to delete a template.
        -executePrereqs - Command to execute prerequisite checks.
        -generateScripts - Command to Generate scripts which can be used to create database.
        -relocatePDB - Command to Relocate a pluggable database.
        -unplugDatabase - Command to Unplug a pluggable database.
3、执行dbca
[oracle@forest ~]$ dbca -silent -createDatabase -responseFile /home/oracle/dbca.rsp 
Enter SYS user password: 
Enter SYSTEM user password: 
Enter PDBADMIN User Password: 
Prepare for db operation
8% complete
Copying database files
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/forest.
Database Information:
Global Database Name:forest.oracle.com
System Identifier(SID):FOREST
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/forest/forest.log" for further details.

登录数据库

[oracle@forest ~]$ . oraenv
ORACLE_SID = [oracle] ? FOREST
The Oracle base has been set to /u01/app/oracle
[oracle@forest ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Oct 21 17:34:24 2024
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> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 FORESTPDB1                     READ WRITE NO
         4 FORESTPDB2                     READ WRITE NO
SQL> show parameter name
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name                     string
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      forest
db_unique_name                       string      forest
global_names                         boolean     FALSE
instance_name                        string      FOREST
lock_name_space                      string
log_file_name_convert                string
pdb_file_name_convert                string
processor_group_name                 string
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      forest.oracle.com

### Linux 系统上 Oracle 19c 数据库静默安装指南 在 Linux 系统上进行 Oracle 19c 数据库静默安装,需要完成一系列准备工作和配置步骤。以下是详细的指南和脚本示例。 #### 1. 准备工作 确保系统满足 Oracle 19c 的安装要求,包括但不限于以下内容: - 安装必要的依赖包。 - 修改主机名解析。 - 创建 Oracle 用户、组以及环境变量。 - 关闭或配置 SELinux 和防火墙。 - 检查并调整资源限制。 - 配置 PAM 验证。 这些步骤已在引用中提到,并适用于 CentOS 7 和 RHEL 7.9 等系统[^3]。 #### 2. 下载 Oracle 19c 压缩包 下载 Oracle Database 19c 的安装文件(如 `LINUX.X64_193000_db_home.zip`),并将其解压到指定目录。例如: ```bash [root@oracle19c db_1]# su - oracle Last login: Tue May 17 02:57:27 CST 2022 on pts/0 [oracle@oracle19c ~]$ cd /u01/app/oracle/product/19c/db_1/ [oracle@oracle19c db_1]$ unzip LINUX.X64_193000_db_home.zip ``` 上述命令展示了如何切换到 Oracle 用户并解压安装文件[^1]。 #### 3. 配置响应文件 静默安装需要使用响应文件(`.rsp`)。常见的响应文件包括: - `db_install.rsp`:用于数据库软件安装。 - `netca.rsp`:用于网络配置。 - `dbca.rsp`:用于创建数据库实例。 以下是 `db_install.rsp` 的一个示例: ```properties # db_install.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=localhost UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory SELECTED_LANGUAGES=en ORACLE_HOME=/u01/app/oracle/product/19c/db_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.isCustomInstall=true oracle.install.db.customComponents=oracle.server:19.0.0.0.0,oracle.sysman.ccr:19.0.0.0.0 SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true ``` 此响应文件定义了安装的基本参数,包括 Oracle 主目录、语言选择和其他选项[^2]。 #### 4. 执行静默安装 切换到 Oracle 用户后,运行以下命令以启动静默安装: ```bash [oracle@oracle19c db_1]$ ./runInstaller -silent -force -noconfig -ignorePrereq -responseFile /home/oracle/rsp/db_install.rsp ``` 该命令通过指定响应文件来执行静默安装,忽略预检查错误并强制安装[^2]。 #### 5. 配置监听器和数据库实例 安装完成后,可以使用以下命令配置监听器和创建数据库实例: - 配置监听器: ```bash [oracle@oracle19c db_1]$ netca -silent -responseFile /home/oracle/rsp/netca.rsp ``` - 创建数据库实例: ```bash [oracle@oracle19c db_1]$ dbca -silent -responseFile /home/oracle/rsp/dbca.rsp ``` #### 6. 设置开机自启 为了确保 Oracle 数据库在系统重启后自动启动,可以配置服务脚本或使用 `oradim` 工具。 --- ### 示例脚本 以下是一个完整的自动化脚本示例,用于静默安装 Oracle 19c: ```bash #!/bin/bash # Step 1: 解压安装文件 su - oracle <<EOF cd /u01/app/oracle/product/19c/db_1/ unzip LINUX.X64_193000_db_home.zip EOF # Step 2: 静默安装数据库软件 su - oracle <<EOF cd /u01/app/oracle/product/19c/db_1/ ./runInstaller -silent -force -noconfig -ignorePrereq -responseFile /home/oracle/rsp/db_install.rsp EOF # Step 3: 配置监听器 su - oracle <<EOF netca -silent -responseFile /home/oracle/rsp/netca.rsp EOF # Step 4: 创建数据库实例 su - oracle <<EOF dbca -silent -responseFile /home/oracle/rsp/dbca.rsp EOF ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值