oracle12c静默安装

发布时间 2023-12-18 23:33:50作者: 程序员的小梦想

oracle12c 静默安装

先决条件

● 至少 1 GB RAM 用于 Oracle 数据库安装。建议使用 2 GB 内存。
● 至少 8 GB RAM 用于 Oracle Grid Infrastructure 安装。


支持以下 Linux x86-64 内核:
● 带有 Unbreakable Enterprise Kernel 6 的
Oracle Linux 8.2:5.4.17-2011.1.2.el8uek.x86_64 或更高版本带有 Red Hat 兼容内核的 Oracle Linux 8.2:4.18.0-193.19.1.el8_2.x86_64 或更高版本
● 带有 Unbreakable Enterprise Kernel 3 的 Oracle Linux 7:3.8.13-35.3.1.el7uek.x86_64 或更高版本
带有 Unbreakable Enterprise Kernel 4 的 Oracle Linux 7.2 :4.1.12-32.2.3.el7uek.x86_64 或更高版本 带有 Unbreakable Enterprise Kernel 4 的
Oracle Linux 7 Red Hat 兼容内核:3.10.0-123.el7.x86_64 或更高版本
● 带有 Unbreakable Enterprise Kernel 2 的 Oracle Linux 6.4
:2.6.39-400.211.1.el6uek.x86_64 或更高版本带有 Unbreakable Enterprise Kernel 3 的 Oracle Linux 6.6:3.8.13-44.1.1.el6uek.x86_64 或更高版本
带有Unbreakable Enterprise Kernel 4:4.1.12-37.6.2.el6uek.x86_64 或更高版本
带有 Red Hat 兼容内核的 Oracle Linux 6.4:2.6.32-358.el6.x86_64 或更高版本
● Red Hat Enterprise Linux 8.2:4.18.0-193.19.1.el8_2.x86_64 或更高版本
● Red Hat Enterprise Linux 7:3.10.0-123.el7.x86_64 或更高版本
● Red Hat Enterprise Linux 6.4:2.6.32-358.el6.x86_64 或更高版本
● SUSE Linux Enterprise Server 15:4.12.14-25-default 或更高版本
● SUSE Linux Enterprise Server 12 SP1:3.12.49-11.1 或更高版本
● NeoKylin Linux Advanced Server 7: 3.10.0-693.el7.x86_64 或更高版本


对于 Linux x86-64:
至少 8.6 GB 用于独立服务器安装的 Oracle Grid Infrastructure。
Oracle 数据库企业版至少需要 7.5 GB。
至少 7.5 GB 用于 Oracle Database Standard Edition 2。

对于 IBM:Linux on System z:
至少 6.5 GB 用于 Oracle Grid Infrastructure,用于独立服务器安装。
Oracle 数据库企业版至少需要 5.7 GB。
Oracle 数据库标准版 2 至少需要 5.7 GB。
Oracle 建议您分配大约 100 GB 以留出额外空间,以便在现有 Oracle 主目录上应用任何未来的补丁。有关与补丁相关的特定磁盘空间要求,请参阅您的补丁文档。

环境准备

# 查看系统位数以及内核版本
[root@dev2oracle ~]# uname -a
Linux dev2oracle 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

# 查看系统版本
[root@dev2oracle ~]# cat /proc/version
Linux version 3.10.0-1160.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Mon Oct 19 16:18:59 UTC 2020
[root@dev2oracle ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@dev2oracle ~]#


# 配置国内 yum源,请参考文末。
#备份源
[root@dev2oracle ~]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#下载新的CentOS-Base.repo 到/etc/yum.repos.d/
[root@dev2oracle ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
##或
[root@dev2oracle ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#添加EPEL
[root@dev2oracle ~]# curl -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@dev2oracle ~]# yum clean all
[root@dev2oracle ~]# yum makecache


# 安装必要软件
[root@dev2oracle ~]# yum install -y unzip zip


# 查看ip
[root@dev2oracle dbs]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:bb:fa:ff brd ff:ff:ff:ff:ff:ff
    inet 10.115.28.244/24 brd 10.115.28.255 scope global noprefixroute ens192
       valid_lft forever preferred_lft forever
    inet6 fe80::633d:3dae:577c:168d/64 scope link noprefixroute
       valid_lft forever preferred_lft forever


# 查看内存
[root@dev2oracle dbs]$ free -h
              total        used        free      shared  buff/cache   available
Mem:            31G        1.8G        239M        1.0G         29G         28G
Swap:           15G         20M         15G


# 查看硬盘
[root@dev2oracle dbs]$ df -h
文件系统                 容量  已用  可用 已用% 挂载点
devtmpfs                  16G     0   16G    0% /dev
tmpfs                     16G 1008M   15G    7% /dev/shm
tmpfs                     16G   18M   16G    1% /run
tmpfs                     16G     0   16G    0% /sys/fs/cgroup
/dev/mapper/centos-root   50G  2.6G   48G    6% /
/dev/sda1               1014M  151M  864M   15% /boot
/dev/mapper/centos-home  1.5T  220G  1.3T   15% /home
tmpfs                    3.2G     0  3.2G    0% /run/user/0

# 查看临时目录空间
[root@dev2oracle ~]# df -h /tmp/
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root   50G  2.6G   48G    6% /


# 查看并设置主机名
[root@dev2oracle dbs]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.115.28.244 dev2oracle
10.115.13.137  testServer

[oracle@dev2oracle dbs]$ hostname
dev2oracle
[oracle@dev2oracle dbs]$ hostnamectl set-hostname dev2oracle
[oracle@dev2oracle dbs]$ hostname
dev2oracle
[oracle@dev2oracle dbs]$


# 查看并设置防火墙
[root@dev2oracle ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since 一 2023-11-20 11:39:04 CST; 3 days ago
     Docs: man:firewalld(1)
  Process: 994 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 994 (code=exited, status=0/SUCCESS)

11月 16 11:23:14 dev2oracle systemd[1]: Starting firewalld - dynamic firewall daemon...
11月 16 11:23:14 dev2oracle systemd[1]: Started firewalld - dynamic firewall daemon.
11月 16 11:23:14 dev2oracle firewalld[994]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure co... now.
11月 16 14:12:53 dev2oracle firewalld[994]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure co... now.
11月 20 11:39:04 dev2oracle systemd[1]: Stopping firewalld - dynamic firewall daemon...
11月 20 11:39:04 dev2oracle systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@dev2oracle ~]# systemctl stop firewalld
[root@dev2oracle ~]# systemctl start firewalld


# 关闭selinux
# 临时关闭selinux
[root@dev2oracle ~]# setenforce 0
setenforce: SELinux is disabled

# 永久关闭selinux,需要重启服务器
#修改配置文件中的SELINUX=disabled
[root@dev2oracle ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@dev2oracle ~]# reboot
[root@dev2oracle ~]# getenforce
Disabled


# 修改内核参数
[root@dev2oracle ~]# vi /etc/sysctl.conf

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
# 设置共享内存最大值
kernel.shmmax = 17179869184
# 设置每个共享内存段的最大值
kernel.shmall = 4194304
# 设置共享内存的最大数量
kernel.shmmni = 4096
# 设置每个进程可用共享内存的最大值
kernel.shm_rmid_forced = 0

[root@dev2oracle ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
kernel.shmmax = 17179869184
kernel.shmall = 4194304
kernel.shmmni = 4096
kernel.shm_rmid_forced = 0


# 修改资源限制
[root@dev2oracle ~]# vi /etc/security/limits.conf

# End of file
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240

正式安装

安装依赖包

# 安装依赖包
[root@dev2oracle ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686


# 检查依赖包是否安装
[root@dev2oracle ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libxcb libXi make sysstat


# 安装缺失的rpm包
[root@dev2oracle ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutilslibelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel glibc-devel*.i686 ksh libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBCdevel*.i686 libXp

创建用户和组

[root@dev2oracle ~]# groupadd oinstall
[root@dev2oracle ~]# groupadd dba
[root@dev2oracle ~]# groupadd oper
[root@dev2oracle ~]# useradd -g oinstall -G dba,oper oracle
[root@dev2oracle ~]# passwd oracle  #输密码

修改 oracle 用户环境变量

[oracle@dev2oracle ~]$ vi .bash_profile

## 修改内容
if [ $USER = "oracle" ];then
 if [ $SHELL = "/bin/ksh" ];then
     ulimit -p 16384
     ulimit -n 65536
 else
     ulimit -u 16384 -n 65536
 fi
fi
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=dev2oracle; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
ORACLE_BASE=/home/oracle/app; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
export PATH=$PATH:$ORACLE_HOME/bin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

[oracle@dev2oracle ~]$ source .bash_profile

拷贝压缩包并解压

# oracle用户创建目录并把压缩包拷贝到新建目录下
[oracle@dev2oracle downloads]$ mkdir downloads
[oracle@dev2oracle downloads]$ ll
总用量 16437384
-rw-r--r-- 1 oracle oinstall  3453696911 11月 16 11:57 linuxx64_12201_database.zip

[oracle@dev2oracle downloads]$ unzip linuxx64_12201_database.zip
[oracle@dev2oracle downloads]$ ll
总用量 16437384
-rw-r--r-- 1 oracle oinstall  3453696911 11月 16 11:57 linuxx64_12201_database.zip
drwxr-xr-x 7 oracle oinstall         117 1月  27 2017 database

[oracle@dev2oracle downloads]$ cd database/
[oracle@dev2oracle database]$ ll
总用量 20
drwxr-xr-x  4 oracle oinstall  234 1月  26 2017 install
drwxrwxr-x  2 oracle oinstall   81 11月 16 13:34 response
drwxr-xr-x  2 oracle oinstall   35 1月  26 2017 rpm
-rwxr-xr-x  1 oracle oinstall 8771 1月  26 2017 runInstaller
drwxrwxr-x  2 oracle oinstall   29 1月  26 2017 sshsetup
drwxr-xr-x 14 oracle oinstall 4096 1月  26 2017 stage
-rwxr-xr-x  1 oracle oinstall  500 2月   7 2013 welcome.html
[oracle@dev2oracle database]$

修改实例配置文件

[oracle@dev2oracle database]$ vi /home/oracle/downloads/db_2021-03-24_08-07-50PM.rsp
[oracle@dev2oracle database]$ cat  /home/oracle/downloads/db_2021-03-24_08-07-50PM.rsp
####################################################################
## Copyright(c) Oracle Corporation 1998,2017. 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_v12.2.0

#-------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
#   - INSTALL_DB_SWONLY
#   - INSTALL_DB_AND_CONFIG
#   - UPGRADE_DB
#-------------------------------------------------------------------------------
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=/home/oracle/oraInventory
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=/home/oracle/app/product/12.2.0/dbhome_1

#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=/home/oracle/app

#-------------------------------------------------------------------------------
# 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=

#------------------------------------------------------------------------------
# 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

###############################################################################
#                                                                             #
#                               Grid Options                                  #
#                                                                             #
###############################################################################
#------------------------------------------------------------------------------
# Specify the type of Real Application Cluster Database
#
#   - ADMIN_MANAGED: Admin-Managed
#   - POLICY_MANAGED: Policy-Managed
#
# If left unspecified, default will be ADMIN_MANAGED
#------------------------------------------------------------------------------
oracle.install.db.rac.configurationType=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is ADMIN_MANAGED
#
# Specify the cluster node names selected during the installation.
# Leaving it blank will result in install on local server only (Single Instance)
#
# Example : oracle.install.db.CLUSTER_NODES=node1,node2
#------------------------------------------------------------------------------
oracle.install.db.CLUSTER_NODES=

#------------------------------------------------------------------------------
# This variable is used to enable or disable RAC One Node install.
#
#   - true  : Value of RAC One Node service name is used.
#   - false : Value of RAC One Node service name is not used.
#
# If left blank, it will be assumed to be false.
#------------------------------------------------------------------------------
oracle.install.db.isRACOneInstall=false

#------------------------------------------------------------------------------
# Value is required only if oracle.install.db.isRACOneInstall is true.
#
# Specify the name for RAC One Node Service
#------------------------------------------------------------------------------
oracle.install.db.racOneServiceName=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is POLICY_MANAGED
#
# Specify a name for the new Server pool that will be configured
# Example : oracle.install.db.rac.serverpoolName=pool1
#------------------------------------------------------------------------------
oracle.install.db.rac.serverpoolName=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is POLICY_MANAGED
#
# Specify a number as cardinality for the new Server pool that will be configured
# Example : oracle.install.db.rac.serverpoolCardinality=2
#------------------------------------------------------------------------------
oracle.install.db.rac.serverpoolCardinality=0

###############################################################################
#                                                                             #
#                        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=false

#-------------------------------------------------------------------------------
# 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=false

#-------------------------------------------------------------------------------
# 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=false

###############################################################################
#                                                                             #
# 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=DEFAULT

#-------------------------------------------------------------------------------
# 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=0

#-------------------------------------------------------------------------------
# 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=false

#-------------------------------------------------------------------------------
# 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=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username.
#
#  Example   : MYORACLESUPPORT_USERNAME=abc@oracle.com
#------------------------------------------------------------------------------
MYORACLESUPPORT_USERNAME=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password.
#
# Example    : MYORACLESUPPORT_PASSWORD=password
#------------------------------------------------------------------------------
MYORACLESUPPORT_PASSWORD=

#------------------------------------------------------------------------------
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example    : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

#------------------------------------------------------------------------------
# Specify whether user doesn't want to configure Security Updates.
# The value for this variable should be true if you don't want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be true.
#
# Example    : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true

#------------------------------------------------------------------------------
# Specify the Proxy server name. Length should be greater than zero.
#
# Example    : PROXY_HOST=proxy.domain.com
#------------------------------------------------------------------------------
PROXY_HOST=

#------------------------------------------------------------------------------
# Specify the proxy port number. Should be Numeric and at least 2 chars.
#
# Example    : PROXY_PORT=25
#------------------------------------------------------------------------------
PROXY_PORT=

#------------------------------------------------------------------------------
# Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_USER=username
#------------------------------------------------------------------------------
PROXY_USER=

#------------------------------------------------------------------------------
# Specify the proxy password. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_PWD=password
#------------------------------------------------------------------------------
PROXY_PWD=

#------------------------------------------------------------------------------
# Specify the Oracle Support Hub URL.
#
# Example    : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/
#------------------------------------------------------------------------------
COLLECTOR_SUPPORTHUB_URL=

[oracle@dev2oracle database]$

创建实例


[oracle@dev2oracle database]$ ./runInstaller -ignorePrereq  -silent -responseFile /home/oracle/downloads/db_2021-03-24_08-07-50PM.rsp


# 创建成功后需要登录root账户,执行下边两个脚本
可以在以下位置找到本次安装会话的日志:
 /home/oracle/oraInventory/logs/installActions2023-11-16_12-02-45PM.log
Oracle Database 12c 的 安装 已成功。
请查看 '/home/oracle/oraInventory/logs/silentInstall2023-11-16_12-02-45PM.log' 以获取详细资料。

以 root 用户的身份执行以下脚本:
        1. /home/oracle/oraInventory/orainstRoot.sh
        2. /home/oracle/app/product/12.2.0/dbhome_1/root.sh



Successfully Setup Software.
~

[oracle@dev2oracle database]$su - root
[oracle@dev2oracle database]$/home/oracle/oraInventory/orainstRoot.sh
[oracle@dev2oracle database]$/home/oracle/app/product/12.2.0/dbhome_1/root.sh

配置监听

# 任选其一执行
[oracle@dev2oracle database]$ netca -silent -responseFile $ORACLE_HOME/assistants/netca/netca.rsp
[oracle@dev2oracle assistants]$ ./netca /silent /responsefile /home/oracle/downloads/database/response/netca.rsp

创建数据库

#修改dbca.rsp配置文件
[oracle@dev2oracle database]$ cd $ORACLE_HOME
[oracle@dev2oracle dbhome_1]$ cd assistants/dbca/
[oracle@dev2oracle dbca]$ cp dbca.rsp /tmp
[oracle@dev2oracle dbca]$ vim /tmp/dbca.rsp

# 参考下边
[oracle@dev2oracle app]$ vi /home/oracle/downloads/dbca.rsp
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=orcl
sid=orcl
databaseConfigType=SI
createAsContainerDatabase=false
numberOfPDBs=1
pdbName=orclpdb
templateName=/home/oracle/app/product/12.2.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
emExpressPort=5500
omsPort=0
characterSet=AL32UTF8
listeners=LISTENER
memoryPercentage=40
automaticMemoryManagement=false
totalMemory=0

[oracle@dev2oracle app]$ dbca -silent -createDatabase -responseFile /home/oracle/downloads/dbca.rsp

开放端口

[root@dev2oracle ~]# firewall-cmd --zone=public --add-port=1521/tcp --permanent
Warning: ALREADY_ENABLED: 1521:tcp
success
[root@dev2oracle ~]# firewall-cmd --reload
success
[root@dev2oracle ~]# firewall-cmd --list-ports
1521/tcp
[root@dev2oracle ~]#systemctl start firewalld

验证

查看监听状态

# 有服务名称,服务名称下有实例名称,并且status 为READY,即为成功
[oracle@dev2oracle app]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 23-NOV-2023 21:56:53

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dev2oracle)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                21-NOV-2023 17:23:34
Uptime                    2 days 4 hr. 33 min. 18 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /home/oracle/app/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /home/oracle/app/diag/tnslsnr/dev2oracle/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dev2oracle)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@dev2oracle app]$

验证实例状态

#登录数据库后台,并查询实例状态
[oracle@dev2oracle app]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Nov 23 21:58:40 2023

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
orcl             OPEN

SQL> SELECT name,db_unique_name,open_mode from v$database;

NAME      DB_UNIQUE_NAME                 OPEN_MODE
--------- ------------------------------ --------------------
ORCL      standby                        READ ONLY

SQL>

远程连接测试

远程连接成功

FAO

Invalid template file specified

dbca.rsp配置文件中templateName=General_Purpose.dbc

Automatic Memory Management option is not allowed when the total physical memory is greater than 4GB

dbca.rsp配置文件中改值设置为false
automaticMemoryManagement=FALSE

参考

centos | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror