Centos7 _ Oracle12c 静默安装

Oracle 版本简介

oracle 11G 之后,发布的oracle版本有ORACLE 12C、ORACLE 18C、ORACLE 19C、ORACLE 21C,自oracle 12C之后,oracle发布的版本以年份作为发型版本号,由于2020年疫情,20C未发布。
ORACLE 12C R1 12.1.0.X (12.1.0.1、12.1.0.2)
ORACLE 12C R2 12.2.0.1
ORACLE 18C 相当于12.2.0.2版本
ORACLE 19C 相当于12.2.0.3版本(ORACLE19C是ORACLE12C最后一个发行版本)
ORACLE 21C 只支持多租户,不在支持单实例。

提及一点: 如果创建用户的时候用户名以c##或者C##开头的,则需要创建容器数据库CDB。(对应2.13.2步骤+2.14.3步骤)
假如是创建了非CDB数据库,创建用户时,以c##开头,则会报错ORA-65096。

一、安装数据库前准备工作

1.1 把oracle 12c 压缩包上传服务器的目录

上传目录: /opt/dbfile

[root@localhost dbfile]# pwd
/opt/dbfile
[root@localhost dbfile]# ls
linuxx64_12201_database.zip
[root@localhost dbfile]# 
1.2 操作系统软硬件检查
1.2.1 内存要求

最小值为1 GB 内存,建议值为2 GB 或者更多

查询命令: grep MemTotal /proc/meminfo

[root@localhost ~]# grep MemTotal /proc/meminfo
MemTotal:        7990068 kB
[root@localhost ~]#

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OapG83ye-1653786038963)(thread_images/image-20220526105453091.png)]

计算出来有7.6199G内存,满足Oracle 12c 的内存安装要求。

1.2.2 系统内核版本
查询系统位数命令: uname -m
查询系统版本命令: cat /proc/version或 cat /etc/redhat-release或 lsb_release -id
查询系统内核版本: uname -r
[root@localhost ~]# uname -m
x86_64
[root@localhost ~]# 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@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# lsb_release -id
-bash: lsb_release: 未找到命令
[root@localhost ~]# yum install -y redhat-lsb
[root@localhost ~]# lsb_release -id
Distributor ID:	CentOS
Description:	CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# uname -r
3.10.0-1160.el7.x86_64
[root@localhost ~]#

​ 经查询可知,本机系统版本和内核版本都在Oracle 12c支持的范围内。

1.2.3 磁盘空间要求

查看磁盘空间:

[root@localhost ~]# df -hT
文件系统                类型      容量  已用  可用 已用% 挂载点
devtmpfs                devtmpfs  3.8G     0  3.8G    0% /dev
tmpfs                   tmpfs     3.9G     0  3.9G    0% /dev/shm
tmpfs                   tmpfs     3.9G   12M  3.8G    1% /run
tmpfs                   tmpfs     3.9G     0  3.9G    0% /sys/fs/cgroup
/dev/mapper/centos-root xfs        48G  5.1G   43G   11% /
/dev/sda1               xfs      1014M  151M  864M   15% /boot
/dev/mapper/centos-home xfs        24G   33M   24G    1% /home
tmpfs                   tmpfs     781M     0  781M    0% /run/user/0
[root@localhost ~]# 

/tmp 空间目录至少 1GB

查询命令: df -h /tmp,Oracle安装目录中的/oradata 目录用来存放数据文件,/tmp目录是根文件系统的一部分。
[root@localhost ~]# df -h /tmp/
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root   48G  5.1G   43G   11% /
[root@localhost ~]#

查看swap 空间大小(总计)

[root@localhost ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7802         494        6909          11         399        7066
Swap:          8063           0        8063
[root@localhost ~]

二、数据库安装过程

2.1 关闭防火墙
systemctl stop firewalld.service #关闭防火墙
systemctl disable firewalld.service #禁止防火墙开机启动
systemctl status firewalld.service  #查看防火墙状态
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

526 10:47:11 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
526 10:47:12 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
526 10:47:12 localhost.localdomain firewalld[751]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be re...g it now.
526 11:11:22 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
526 11:11:24 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]#
2.2 关闭selinux
vim /etc/selinux/config 
SELINUX=disabled #修改的内容,永久关闭
[root@localhost ~]# vim /etc/selinux/config
[root@localhost ~]# cat /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=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@localhost ~]# 

查看SElinux状态

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rK3JQKsM-1653786038967)(thread_images/image-20220526113629841.png)]

重启服务器即可永久生效:

[root@localhost ~]# reboot
[root@localhost ~]# sestatus 
SELinux status:                 disabled
[root@localhost ~]# getenforce 
Disabled
[root@localhost ~]# 
2.3 安装相关依赖包,多试几次
yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install make -y
yum install nfs-utils -y
yum install net-tools -y
yum install smartmontools -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -yyum install libXprenderyum install libX*

检查Oracle需要的rpm安装情况

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

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
2.4 创建用户组
groupadd oinstall     #创建用户组oinstall
groupadd dba      #创建用户组dba
useradd -g oinstall -G dba oracle  #创建用户oracle,并加入oinstall和dba附属组
passwd oracle    #设置用户oracle的登录密码,根据提示输入两次密码
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -g oinstall -G dba oracle
[root@localhost ~]# passwd oracle
2.5 修改内核参数
在安装Oracle数据库的时候,Oralce推进需要设置如下几个系统内核参数

Kernel.shmmax:共享内存段的最大尺寸(以字节为单位)。
Kernel.shmmni:系统中共享内存段的最大数量。
Kernel.shmall:共享内存总量,以页为单位。
fs.file-max:文件句柄数,表示在Linux系统中可以打开的文件数量。
net.ipv4.ip_local_port_range:应用程序可使用的IPv4端口范围。
正确设置参数 kernel.shmall 和 kernel.shmmax 否则后续安装过程中会有报错如下:
ORA-27104: system-defined limits for shared memory was misconfigured

# 检查可能是因为系统优化参数设置错误导致。kernel.shmall 和 kernel.shmmax 没有设置正确。物理内存128G,创建库按照物理内存的80%来创建的。调整优化参数。
#共享内存的页数,Linux共享内存页大小为4KB,8G内存设置为:8GB/4KB=8*1024*1024*1024/4KB=2097152
#kernel.shmall = 2097152
#128GB/4KB

kernel.shmall = 33554432
#最大共享内存,官方文档建议是内存的1/2,例如:8G内存则设置为:4*1024*1024*1024
#kernel.shmmax = 4294967296
#128G * 50%
kernel.shmmax = 68719476736

# 参数调整以后(注意:修改/etc/sysctl.conf后,需要执行 sysctl -p 立即生效)

[root@localhost ~]# vim /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).
#oracle add
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
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 = 1048586
vim使用快捷:
按住shift + G 快速跳转到末尾   
gg 快速跳转到首行  
shift + 4 快速定位行末尾 
shift + 6 快速定位到行头
root@localhost ~]# sysctl -p  ##执行 sysctl -p 立即生效
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
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 = 1048586
[root@localhost ~]# 
2.6 修改用户限制
[root@localhost ~]# vim /etc/security/limits.conf  
# 在文件末尾添加下面6行内容:
# oracle add
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
2.7 修改用户登录环境变量
[root@localhost ~]# vim /etc/profile
# 在文件末尾添加下面内容
# Oracle environment set
if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
fi
[root@localhost ~]# source /etc/profile  # 使修改的文件生效
[root@localhost ~]# 
2.8 创建安装相关目录
mkdir /u01
mkdir -p /u01/app/oracle                 //oracle数据库安装目录
mkdir -p /u01/app/oraInventory           //oracle数据库配置文件目录
mkdir -p /u01/app/oracle/oradata         //存放数据库的数据目录
chmod -R 775 /u01/app
chown -R oracle:oinstall /u01            //设置目录所有者为oinstall用户组的oracle用户
[root@localhost ~]# clear
[root@localhost ~]# mkdir /u01
[root@localhost ~]# mkdir -p /u01/app/oracle
[root@localhost ~]# mkdir -p /u01/app/oraInventory
[root@localhost ~]# mkdir -p /u01/app/oracle/oradata
[root@localhost ~]# mkdir -p /u01/app/oracle/flash_recovery_area
[root@localhost ~]# chmod -R 775 /u01/app
[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]#
2.9 配置oracle环境变量
[root@localhost ~]# su - oracle   #切换用户
[oracle@localhost ~]$ id oracle
uid=1000(oracle) gid=1000(oinstall)=1000(oinstall),1001(dba)
[oracle@localhost ~]$
[oracle@localhost ~]$ vim ~/.bash_profile
# 添加内容如下
#For Oracle
export DISPLAY=:0.0
export TMP=/tmp;
export TMPDIR=$TMP;
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export ORACLE_TERM=xterm;
export LANG=C
export PATH=/usr/sbin:$PATH;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
[oracle@localhost ~]$ source ~/.bash_profile  #使配置生效
[oracle@localhost ~]$
2.10 解压12c安装包
[root@localhost opt]# ll
总用量 0
drwxr-xr-x. 2 root root 41 526 09:56 dbfile
[root@localhost opt]# chown -R oracle:oinstall dbfile/
[root@localhost opt]# ll
总用量 0
drwxr-xr-x. 2 oracle oinstall 41 526 09:56 dbfile
[root@localhost opt]# cd dbfile/
[root@localhost dbfile]# ls
linuxx64_12201_database.zip
[root@localhost dbfile]# ll
总用量 3372752
-rw-r--r--. 1 oracle oinstall 3453696911 526 09:56 linuxx64_12201_database.zip
[root@localhost dbfile]#
[oracle@localhost dbfile]$ unzip /opt/dbfile/linuxx64_12201_database.zip -d /u01/dbfile/
[oracle@localhost dbfile]$ cd /u01/dbfile/
[oracle@localhost dbfile]$ ll   
total 0
drwxr-xr-x 7 oracle oinstall 117 Jan 27  2017 database
[oracle@localhost dbfile]$ 
[oracle@localhost ~]$ cd /u01/app/oracle
[oracle@localhost oracle]$ mkdir etc #oracle用户下创建etc文件夹用来存储待会解压后的静默安装,建监听,建库的三个参数文件
[oracle@localhost oracle]$ cp /u01/dbfile/database/response/* /u01/app/oracle/etc/
[oracle@localhost oracle]$ chmod 700 /u01/app/oracle/etc/*.rsp   #修改文件权限
[oracle@localhost oracle]$ chown -R oracle:oinstall /u01/app/oracle/etc/   #更改属组
2.11 修改静默安装配置文件db_install.rsp
[oracle@localhost etc]$ cp db_install.rsp db_install.rsp.bak   #备份源文件
[oracle@localhost etc]$ pwd
/u01/app/oracle/etc
[oracle@localhost etc]$
编辑db_install.rsp文件
将需要修改的部分写入db_install.config中:
[oracle@localhost database]$ cd /u01/app/oracle/etc/
[oracle@localhost etc]$ pwd
/u01/app/oracle/etc
[oracle@localhost etc]$ 
[oracle@localhost etc]$ ls
db_install.config  db_install.rsp  db_install.rsp.bak  dbca.rsp  netca.rsp
[oracle@localhost etc]$ 

cat >> db_install.config << EOF
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oinstall
oracle.install.db.OSBACKUPDBA_GROUP=oinstall
oracle.install.db.OSDGDBA_GROUP=oinstall
oracle.install.db.OSKMDBA_GROUP=oinstall
oracle.install.db.OSRACDBA_GROUP=oinstall
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.password.ALL=Just#Do@It123
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
EOF

快速修改:

for i in $(cat db_install.config);do
    key=$(echo $i | awk -F= '{print $1}');
    value=$(echo $i | awk -F= '{print $2}');
    sed -i "s#$key=#&$value#g" db_install.rsp;
done
[oracle@localhost etc]$ cat db_install.rsp |grep -v '^$' | grep -v '^#'  #查看内容 比对一下修改项(仔细核对是否修改了)
2.12 开始静默安装
[oracle@localhost ~]$ cd /u01/dbfile/database
[oracle@localhost database]$ ls
install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[oracle@localhost database]$ 
[oracle@localhost database]$ ./runInstaller -silent -responseFile /u01/app/oracle/etc/db_install.rsp   #这条命令是静默安装命令
[oracle@localhost database]$ ./runInstaller -silent -responseFile /u01/app/oracle/etc/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 36250 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8063 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-05-26_01-07-36PM. Please wait ...[oracle@localhost database]$ You can find the log of this install session at:
 /u01/app/oraInventory/logs/installActions2022-05-26_01-07-36PM.log

tail -f runInstaller命令输出的日志文件,可以监控安装的过程。
[oracle@localhost database]$ ls
install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[oracle@localhost database]$ tail -f runInstaller
;;
dv)
    $CMDDIR/install/.oui $* -J-Doracle.install.setup.workDir=$CWDDIR -J-D${CVU_OS_SETTINGS} -nocleanUpOnExit

;;
*)
    $CMDDIR/install/.oui $* -J-D${CVU_OS_SETTINGS} -nocleanUpOnExit
;;
esac

执行安装命令后会提示使用root用户执行两个脚本文件.安装完成.
安装不成功时删除/u01/app/oraInventory 和 /u01/app/oracle/product/12.2.0/dbhome_1/目录的内容
再重启执行安装命令:
rm -rf /u01/app/oraInventory/*
rm -rf /u01/app/oracle/product/12.2.0/dbhome_1/*

安装完成后 :

[oracle@localhost database]$ ./runInstaller -silent -responseFile /u01/app/oracle/etc/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 36250 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8063 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-05-26_01-07-36PM. Please wait ...[oracle@localhost database]$ You can find the log of this install session at:
 /u01/app/oraInventory/logs/installActions2022-05-26_01-07-36PM.log
The installation of Oracle Database 12c was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2022-05-26_01-07-36PM.log' for more details.

As a root user, execute the following script(s):
	1. /u01/app/oraInventory/orainstRoot.sh
	2. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh



Successfully Setup Software.

#切换root。执行上述提及两个脚本文件
[root@localhost ~]# sh /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@localhost ~]# sh /u01/app/oracle/product/12.2.0/dbhome_1/root.sh
Check /u01/app/oracle/product/12.2.0/dbhome_1/install/root_localhost.localdomain_2022-05-26_13-13-18-757710518.log for the output of root script
[root@localhost ~]# 
2.13 配置监听(根据所需选一步骤即可)
2.13.1 配置监听(对应2.14.2操作_创建非CDB数据库)
[oracle@localhost ~]$ cd /u01/app/oracle/etc/  #oracle用户执行
[oracle@localhost etc]$ ls
db_install.config  db_install.rsp  db_install.rsp.bak  dbca.rsp  netca.rsp
[oracle@localhost etc]$ netca -silent -responsefile /u01/app/oracle/etc/netca.rsp   #oracle用户执行
Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /u01/app/oracle/etc/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/12.2.0/dbhome_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@localhost etc]$ 
[oracle@localhost etc]$ lsnrctl start   #启动监听
[oracle@localhost etc]$ lsnrctl start   #系统显示如下

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 26-MAY-2022 13:19:54

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

Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                26-MAY-2022 13:19:54
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@localhost etc]$ 

查看默认监听端口1521的监听状态:

[oracle@localhost etc]$ netstat -an |grep 1521  #系统显示如下,说明监听启动成功
tcp6       0      0 :::1521                 :::*                    LISTEN     
unix  2      [ ACC ]     STREAM     LISTENING     77385    /var/tmp/.oracle/sEXTPROC1521
[oracle@localhost etc]$ 
2.13.2 配置监听(对应2.14.3操作_创建容器数据库(CDB))
[oracle@localhost ~]$ cd /u01/app/oracle/etc/  #oracle用户执行
[oracle@localhost etc]$ ls
db_install.config  db_install.rsp  db_install.rsp.bak  dbca.rsp  netca.rsp
[oracle@localhost etc]$ netca /silent /responseFile /u01/app/oracle/etc/netca.rsp    #oracle用户执行
Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /u01/app/oracle/etc/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/12.2.0/dbhome_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@localhost etc]$ 

##启动监听
[oracle@localhost etc]$ lsnrctl stop 
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 28-MAY-2022 22:49:16

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
The command completed successfully
[oracle@localhost etc]$ lsnrctl start  ##启动监听
2.14 配置静默建库参数(根据所需选一步骤即可)
2.14.1 dbca.rsp文件详解
oracle dbca.rsp文件详解
1、oracle 12c以前的dbca.rsp文件详解
##############################################################################
##                                                                          ##
##                            DBCA response file                            ##
##                            ------------------                            ##
## Copyright   1998, 2014, Oracle Corporation. All Rights Reserved.         ##
##                                                                          ##
## Specify values for the variables listed below to customize Oracle        ##
## Database Configuration installation.                                     ##
##                                                                          ##
## Each variable is associated with a comment. The comment identifies the   ##
## variable type.                                                           ##
##                                                                          ##
## Please specify the values in the following format :                      ##
##          Type       :  Example                                           ##
##          String     :  "<value>"                                         ##
##          Boolean    :  True or False                                     ##
##          Number     :  <numeric value>                                   ##
##          StringList :  {"<value1>","<value2>"}                           ##
##                                                                          ##
## Examples :                                                               ##
##     1. dbca -progress_only -responseFile <response file>                 ##
##        Display a progress bar depicting progress of database creation    ##
##        process.                                                          ##
##                                                                          ##
##     2. dbca -silent -responseFile <response file>                        ##
##        Creates database silently. No user interface is displayed.        ##
##                                                                          ##
##     3. dbca -silent -createDatabase -cloneTemplate                       ##
##           -responseFile <response file>                      ##
##        Creates database silently with clone template. The template in    ##
##    responsefile is a clone template.                         ##
##                                                                          ##
##     4. dbca -silent -deleteDatabase -responseFile <response file>        ##
##        Deletes database silently.                                        ##
##############################################################################

#-----------------------------------------------------------------------------
# GENERAL section is required for all types of database creations.
#-----------------------------------------------------------------------------
[GENERAL]

#-----------------------------------------------------------------------------
# Name          : RESPONSEFILE_VERSION
# Datatype      : String
# Description   : Version of the database to create
# Valid values  : "12.1.0"
# Default value : None
# Mandatory     : Yes   --是否必填Yes|No
#-----------------------------------------------------------------------------
RESPONSEFILE_VERSION = "12.1.0"

#-----------------------------------------------------------------------------
# Name          : OPERATION_TYPE
# Datatype      : String
# Description   : Type of operation
# 操作类型:
# 可选有创建数据库,从数据库创建模版,创建克隆模版,删除数据库,配置数据库,添加实例(只限RAC),删除实例(只限RAC),创建pdb,拔出pdb,删除pdb,配置pdb
# Valid values  : "createDatabase" \ "createTemplateFromDB" \ "createCloneTemplate" \ "deleteDatabase" \ "configureDatabase" \ "addInstance" (RAC-only) \ "deleteInstance" (RAC-only) \ "createPluggableDatabase" \ "unplugDatabase" \ "deletePluggableDatabase" \ "configurePluggableDatabase"
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
###=================================================
OPERATION_TYPE = "createDatabase"
#-----------------------*** End of GENERAL section ***------------------------

#-----------------------------------------------------------------------------
# CREATEDATABASE section is used when OPERATION_TYPE is defined as "createDatabase". 
#-----------------------------------------------------------------------------
[CREATEDATABASE]

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

#-----------------------------------------------------------------------------
# Name          : DATABASECONFTYPE
# 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
# 数据库配置类型为单个实例,Real Application Cluster或Real Application Cluster One Nodes数据库
#-----------------------------------------------------------------------------
DATABASECONFTYPE  = "SI"

#-----------------------------------------------------------------------------
# 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 ]
# RAC 单节点服务器名称
#-----------------------------------------------------------------------------
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
# 是否为策略管理,默认为false即管理员管理
#-----------------------------------------------------------------------------
POLICYMANAGED = "FALSE"

#-----------------------------------------------------------------------------
# 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
# 如果需要为数据库创建新服务器池,则设置为true,则新创建的数据库将使用此新创建的服务器池。 不能为数据库指定多个serverpoolname
#-----------------------------------------------------------------------------
CREATESERVERPOOL = "FALSE"

#-----------------------------------------------------------------------------
# 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
# 如果需要强制创建新服务器池,则设置为true,即使没有可用的服务器可用,也会为新创建的服务器池指定服务器。这可能会影响已运行的数据库。 
# 此标志可以为管理员管理以及策略管理数据库指定。
#-----------------------------------------------------------------------------
FORCE = "false"



#-----------------------------------------------------------------------------
# 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]
# 如果指定了“CREATESERVERPOOL”选项,则只需指定一个服务器池名称。 如果使用服务器池,则以逗号分隔的服务器池名称列表。 
# 这是创建并行查询(PQ)数据库所必需的。 适用于大集群
#-----------------------------------------------------------------------------
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          : SID
# Datatype      : String
# Description   : System identifier (SID) of the database
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : <db_name> specified in GDBNAME
# Mandatory     : No
# 指定数据库的SID
#-----------------------------------------------------------------------------
SID = "orcl"

#-----------------------------------------------------------------------------
# Name          : CREATEASCONTAINERDATABASE 
# Datatype      : boolean
# Description   : flag to create database as container database 
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : false
# Mandatory     : No
# 是否创建数据库为container数据库(需要创建pdb则填true)
#-----------------------------------------------------------------------------
CREATEASCONTAINERDATABASE = true

#-----------------------------------------------------------------------------
# Name          : NUMBEROFPDBS
# Datatype      : Number
# Description   : Specify the number of pdb to be created
# Valid values  : 0 to 252
# Default value : 0
# Mandatory     : No
# 创建pdb的数量
#-----------------------------------------------------------------------------
NUMBEROFPDBS = 2

#-----------------------------------------------------------------------------
# Name          : PDBNAME 
# Datatype      : String
# Description   : Specify the pdbname/pdbanme prefix if one or more pdb need to be created
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
PDBNAME = pdborcl1 / pdborcl2

#-----------------------------------------------------------------------------
# Name          : PDBADMINPASSWORD
# Datatype      : String
# Description   : PDB Administrator user password
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
# pdb管理员用户密码
#-----------------------------------------------------------------------------
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 )
# 逗号分隔的群集节点列表,RAC数据库必填
#-----------------------------------------------------------------------------
NODELIST=

#-----------------------------------------------------------------------------
# Name          : TEMPLATENAME
# Datatype      : String
# Description   : Name of the template
# Valid values  : Template file name
# Default value : None
# Mandatory     : Yes
# 数据库模板,必填
#-----------------------------------------------------------------------------
TEMPLATENAME = "General_Purpose.dbc"

#-----------------------------------------------------------------------------
# Name          : OBFUSCATEDPASSWORDS
# Datatype      : Boolean
# Description   : Set to true if passwords are encrypted
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
# 如果密码已加密,则设置为true
#-----------------------------------------------------------------------------
OBFUSCATEDPASSWORDS = FALSE


#-----------------------------------------------------------------------------
# Name          : SYSPASSWORD
# Datatype      : String
# Description   : Password for SYS user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
SYSPASSWORD = "change_on_install"

#-----------------------------------------------------------------------------
# Name          : SYSTEMPASSWORD
# Datatype      : String
# Description   : Password for SYSTEM user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
SYSTEMPASSWORD = "manager"

#-----------------------------------------------------------------------------
# Name          : SERVICEUSERPASSWORD
# Datatype      : String
# Description   : Password for Windows Service user
# Default value : None
# Mandatory     : If Oracle home is installed with windows service user
# 在windows上安装,安装服务用户的密码
#-----------------------------------------------------------------------------
SERVICEUSERPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : EMCONFIGURATION
# Datatype      : String
# Description   : Enterprise Manager Configuration Type
# Valid values  : CENTRAL|DBEXPRESS|ALL|NONE
# Default value : NONE
# Mandatory     : No
# 企业管理器配置类型,
#-----------------------------------------------------------------------------
EMCONFIGURATION = "NONE"


#-----------------------------------------------------------------------------
# Name          : EMEXPRESSPORT
# Datatype      : Number
# Description   : Enterprise Manager Configuration Type
# Valid values  : Check Oracle12c 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
# EMEXPRESS端口
#-----------------------------------------------------------------------------
EMEXPRESSPORT = ""


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

#-----------------------------------------------------------------------------
# Name          : DBSNMPPASSWORD
# Datatype      : String
# Description   : Password for DBSNMP user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if EMCONFIGURATION is specified or
#                 the value of RUNCVUCHECKS is TRUE
# 智能代理用户DBSNMP的密码,当且仅当指定了EMCONFIGURATION或者RUNCVUCHECKS的值为TRUE
#-----------------------------------------------------------------------------
DBSNMPPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : OMSHOST
# Datatype      : String
# Description   : EM management server host name
# Default value : None
# Mandatory     : Yes, if CENTRAL is specified for EMCONFIGURATION
# EM管理服务器主机名,当且仅当EMCONFIGURATION指定为CENTRAL
#-----------------------------------------------------------------------------
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
# DV安全策略配置,指定“True”以配置和启用Oracle Database Vault
#-----------------------------------------------------------------------------
DVCONFIGURATION = "false"

#-----------------------------------------------------------------------------
# Name          : DVOWNERNAME
# Datatype      : String
# Description   : DataVault Owner
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
DVOWNERNAME = ""

#-----------------------------------------------------------------------------
# Name          : DVOWNERPASSWORD
# Datatype      : String
# Description   : Password for DataVault Owner
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
DVOWNERPASSWORD = ""

#-----------------------------------------------------------------------------
# Name          : DVACCOUNTMANAGERNAME
# Datatype      : String
# Description   : DataVault Account Manager
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
# DV客户经理名称
#-----------------------------------------------------------------------------
DVACCOUNTMANAGERNAME = ""

#-----------------------------------------------------------------------------
# Name          : DVACCOUNTMANAGERPASSWORD
# Datatype      : String
# Description   : Password for  DataVault Account Manager
# Valid values  : Check Oracle12c 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
# OLS配置
#-----------------------------------------------------------------------------
OLSCONFIGURATION = "false"

#-----------------------------------------------------------------------------
# Name          : DATAFILEJARLOCATION 
# Datatype      : String
# Description   : Location of the data file jar 
# Valid values  : Directory containing compressed datafile jar
# Default value : None
# Mandatory     : No
# 包含压缩数据文件jar的目录
#-----------------------------------------------------------------------------
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=FS

#-----------------------------------------------------------------------------
# Name          : DISKGROUPNAME
# Datatype      : String
# Description   : Specifies the disk group name for the storage
# Default value : DATA
# Mandatory     : No
# 指定存储的磁盘组名称
#-----------------------------------------------------------------------------
DISKGROUPNAME=DATA

#-----------------------------------------------------------------------------
# Name          : ASMSNMP_PASSWORD
# Datatype      : String
# Description   : Password for ASM Monitoring
# Default value : None
# Mandatory     : No
# ASMSNMP用户密码
#-----------------------------------------------------------------------------
ASMSNMP_PASSWORD=""

#-----------------------------------------------------------------------------
# Name          : RECOVERYGROUPNAME
# Datatype      : String
# Description   : Specifies the disk group name for the recovery area
# Default value : RECOVERY
# Mandatory     : No
# 指定恢复区磁盘组名称
#-----------------------------------------------------------------------------
RECOVERYGROUPNAME=RECOVERY


#-----------------------------------------------------------------------------
# Name          : CHARACTERSET
# Datatype      : String
# Description   : Character set of the database
# Valid values  : Check Oracle12c National Language Support Guide
# Default value : "US7ASCII"
# Mandatory     : 
#  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
# 数据库字符集
#-----------------------------------------------------------------------------
CHARACTERSET = "US7ASCII"

#-----------------------------------------------------------------------------
# Name          : NATIONALCHARACTERSET
# Datatype      : String
# Description   : National Character set of the database
# Valid values  : "UTF8" or "AL16UTF16". For details, check Oracle12c National Language Support Guide
# Default value : "AL16UTF16"
# Mandatory     : No
# 数据库国家字符集
#-----------------------------------------------------------------------------
NATIONALCHARACTERSET= "UTF8"

#-----------------------------------------------------------------------------
# Name          : REGISTERWITHDIRSERVICE
# Datatype      : Boolean
# Description   : Specifies whether to register with Directory Service.
# Valid values  : TRUE \ FALSE
# Default value : FALSE
# Mandatory     : No
# 指定是否注册目录服务
#-----------------------------------------------------------------------------
REGISTERWITHDIRSERVICE= TRUE

#-----------------------------------------------------------------------------
# Name          : DIRSERVICEUSERNAME
# Datatype      : String
# Description   : Specifies the name of the directory service user
# Mandatory     : YES, if the value of registerWithDirService is TRUE
# 指定目录服务用户的名称
#-----------------------------------------------------------------------------
DIRSERVICEUSERNAME= "name"

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

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

#-----------------------------------------------------------------------------
# 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 = "listener1,listener2"

#-----------------------------------------------------------------------------
# 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
# 是否创建示例数据库,默认为false
#-----------------------------------------------------------------------------
SAMPLESCHEMA=TRUE

#-----------------------------------------------------------------------------
# Name          : MEMORYPERCENTAGE
# Datatype      : String
# Description   : percentage of physical memory for Oracle
# Default value : None
# Mandatory     : NO
# oracle所占物理内存百分百
#-----------------------------------------------------------------------------
MEMORYPERCENTAGE = "40"

#-----------------------------------------------------------------------------
# Name          : DATABASETYPE
# Datatype      : String
# Description   : used for memory distribution when MEMORYPERCENTAGE specified
# Valid values  : MULTIPURPOSE|DATA_WAREHOUSING|OLTP
# Default value : MULTIPURPOSE
# Mandatory     : NO
# 数据库类型,多用途|数据仓库|一般事务型
#-----------------------------------------------------------------------------
DATABASETYPE = "MULTIPURPOSE"

#-----------------------------------------------------------------------------
# Name          : AUTOMATICMEMORYMANAGEMENT
# Datatype      : Boolean
# Description   : flag to indicate Automatic Memory Management is used
# Valid values  : TRUE/FALSE
# Default value : TRUE
# Mandatory     : NO
# 是否启用自动内存管理
#-----------------------------------------------------------------------------
AUTOMATICMEMORYMANAGEMENT = "TRUE"

#-----------------------------------------------------------------------------
# Name          : TOTALMEMORY
# Datatype      : String
# Description   : total memory in MB to allocate to Oracle
# Valid values  : 
# Default value : 
# Mandatory     : NO
# 分配给oracle数据库的总内存
#-----------------------------------------------------------------------------
TOTALMEMORY = "800"


#-----------------------*** End of CREATEDATABASE section ***------------------------

2、oracle 12c之后的dbca.rsp文件详解
##############################################################################
##                                                                          ##
##                            DBCA response file                            ##
##                            ------------------                            ##
## Copyright   1998, 2014, Oracle Corporation. All Rights Reserved.         ##
##                                                                          ##
## Specify values for the variables listed below to customize Oracle        ##
## Database Configuration installation.                                     ##
##                                                                          ##
## Each variable is associated with a comment. The comment identifies the   ##
## variable type.                                                           ##
##                                                                          ##
## Please specify the values in the following format :                      ##
##          Type       :  Example                                           ##
##          String     :  "<value>"                                         ##
##          Boolean    :  True or False                                     ##
##          Number     :  <numeric value>                                   ##
##          StringList :  {"<value1>","<value2>"}                           ##
##                                                                          ##
## Examples :                                                               ##
##     1. dbca -progress_only -responseFile <response file>                 ##
##        Display a progress bar depicting progress of database creation    ##
##        process.                                                          ##
##                                                                          ##
##     2. dbca -silent -responseFile <response file>                        ##
##        Creates database silently. No user interface is displayed.        ##
##                                                                          ##
##     3. dbca -silent -createDatabase -cloneTemplate                       ##
##           -responseFile <response file>                      ##
##        Creates database silently with clone template. The template in    ##
##    responsefile is a clone template.                         ##
##                                                                          ##
##     4. dbca -silent -deleteDatabase -responseFile <response file>        ##
##        Deletes database silently.                                        ##
##############################################################################

#-----------------------------------------------------------------------------
# GENERAL section is required for all types of database creations.
#-----------------------------------------------------------------------------
[GENERAL]

#-----------------------------------------------------------------------------
# Name          : RESPONSEFILE_VERSION
# Datatype      : String
# Description   : Version of the database to create
# Valid values  : "12.1.0"
# Default value : None
# Mandatory     : Yes   --是否必填Yes|No
#-----------------------------------------------------------------------------
RESPONSEFILE_VERSION = "12.1.0"

#-----------------------------------------------------------------------------
# Name          : OPERATION_TYPE
# Datatype      : String
# Description   : Type of operation
# 操作类型:
# 可选有创建数据库,从数据库创建模版,创建克隆模版,删除数据库,配置数据库,添加实例(只限RAC),删除实例(只限RAC),创建pdb,拔出pdb,删除pdb,配置pdb
# Valid values  : "createDatabase" \ "createTemplateFromDB" \ "createCloneTemplate" \ "deleteDatabase" \ "configureDatabase" \ "addInstance" (RAC-only) \ "deleteInstance" (RAC-only) \ "createPluggableDatabase" \ "unplugDatabase" \ "deletePluggableDatabase" \ "configurePluggableDatabase"
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
###=================================================
OPERATION_TYPE = "createDatabase"
#-----------------------*** End of GENERAL section ***------------------------

#-----------------------------------------------------------------------------
# CREATEDATABASE section is used when OPERATION_TYPE is defined as "createDatabase". 
#-----------------------------------------------------------------------------
[CREATEDATABASE]

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

#-----------------------------------------------------------------------------
# Name          : DATABASECONFTYPE
# 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
# 数据库配置类型为单个实例,Real Application Cluster或Real Application Cluster One Nodes数据库
#-----------------------------------------------------------------------------
DATABASECONFTYPE  = "SI"

#-----------------------------------------------------------------------------
# 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 ]
# RAC 单节点服务器名称
#-----------------------------------------------------------------------------
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
# 是否为策略管理,默认为false即管理员管理
#-----------------------------------------------------------------------------
POLICYMANAGED = "FALSE"

#-----------------------------------------------------------------------------
# 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
# 如果需要为数据库创建新服务器池,则设置为true,则新创建的数据库将使用此新创建的服务器池。 不能为数据库指定多个serverpoolname
#-----------------------------------------------------------------------------
CREATESERVERPOOL = "FALSE"

#-----------------------------------------------------------------------------
# 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
# 如果需要强制创建新服务器池,则设置为true,即使没有可用的服务器可用,也会为新创建的服务器池指定服务器。这可能会影响已运行的数据库。 
# 此标志可以为管理员管理以及策略管理数据库指定。
#-----------------------------------------------------------------------------
FORCE = "false"



#-----------------------------------------------------------------------------
# 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]
# 如果指定了“CREATESERVERPOOL”选项,则只需指定一个服务器池名称。 如果使用服务器池,则以逗号分隔的服务器池名称列表。 
# 这是创建并行查询(PQ)数据库所必需的。 适用于大集群
#-----------------------------------------------------------------------------
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          : SID
# Datatype      : String
# Description   : System identifier (SID) of the database
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : <db_name> specified in GDBNAME
# Mandatory     : No
# 指定数据库的SID
#-----------------------------------------------------------------------------
SID = "orcl"

#-----------------------------------------------------------------------------
# Name          : CREATEASCONTAINERDATABASE 
# Datatype      : boolean
# Description   : flag to create database as container database 
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : false
# Mandatory     : No
# 是否创建数据库为container数据库(需要创建pdb则填true)
#-----------------------------------------------------------------------------
CREATEASCONTAINERDATABASE = true

#-----------------------------------------------------------------------------
# Name          : NUMBEROFPDBS
# Datatype      : Number
# Description   : Specify the number of pdb to be created
# Valid values  : 0 to 252
# Default value : 0
# Mandatory     : No
# 创建pdb的数量
#-----------------------------------------------------------------------------
NUMBEROFPDBS = 2

#-----------------------------------------------------------------------------
# Name          : PDBNAME 
# Datatype      : String
# Description   : Specify the pdbname/pdbanme prefix if one or more pdb need to be created
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
PDBNAME = pdborcl1 / pdborcl2

#-----------------------------------------------------------------------------
# Name          : PDBADMINPASSWORD
# Datatype      : String
# Description   : PDB Administrator user password
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
# pdb管理员用户密码
#-----------------------------------------------------------------------------
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 )
# 逗号分隔的群集节点列表,RAC数据库必填
#-----------------------------------------------------------------------------
NODELIST=

#-----------------------------------------------------------------------------
# Name          : TEMPLATENAME
# Datatype      : String
# Description   : Name of the template
# Valid values  : Template file name
# Default value : None
# Mandatory     : Yes
# 数据库模板,必填
#-----------------------------------------------------------------------------
TEMPLATENAME = "General_Purpose.dbc"

#-----------------------------------------------------------------------------
# Name          : OBFUSCATEDPASSWORDS
# Datatype      : Boolean
# Description   : Set to true if passwords are encrypted
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
# 如果密码已加密,则设置为true
#-----------------------------------------------------------------------------
OBFUSCATEDPASSWORDS = FALSE


#-----------------------------------------------------------------------------
# Name          : SYSPASSWORD
# Datatype      : String
# Description   : Password for SYS user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
SYSPASSWORD = "change_on_install"

#-----------------------------------------------------------------------------
# Name          : SYSTEMPASSWORD
# Datatype      : String
# Description   : Password for SYSTEM user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
SYSTEMPASSWORD = "manager"

#-----------------------------------------------------------------------------
# Name          : SERVICEUSERPASSWORD
# Datatype      : String
# Description   : Password for Windows Service user
# Default value : None
# Mandatory     : If Oracle home is installed with windows service user
# 在windows上安装,安装服务用户的密码
#-----------------------------------------------------------------------------
SERVICEUSERPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : EMCONFIGURATION
# Datatype      : String
# Description   : Enterprise Manager Configuration Type
# Valid values  : CENTRAL|DBEXPRESS|ALL|NONE
# Default value : NONE
# Mandatory     : No
# 企业管理器配置类型,
#-----------------------------------------------------------------------------
EMCONFIGURATION = "NONE"


#-----------------------------------------------------------------------------
# Name          : EMEXPRESSPORT
# Datatype      : Number
# Description   : Enterprise Manager Configuration Type
# Valid values  : Check Oracle12c 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
# EMEXPRESS端口
#-----------------------------------------------------------------------------
EMEXPRESSPORT = ""


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

#-----------------------------------------------------------------------------
# Name          : DBSNMPPASSWORD
# Datatype      : String
# Description   : Password for DBSNMP user
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if EMCONFIGURATION is specified or
#                 the value of RUNCVUCHECKS is TRUE
# 智能代理用户DBSNMP的密码,当且仅当指定了EMCONFIGURATION或者RUNCVUCHECKS的值为TRUE
#-----------------------------------------------------------------------------
DBSNMPPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : OMSHOST
# Datatype      : String
# Description   : EM management server host name
# Default value : None
# Mandatory     : Yes, if CENTRAL is specified for EMCONFIGURATION
# EM管理服务器主机名,当且仅当EMCONFIGURATION指定为CENTRAL
#-----------------------------------------------------------------------------
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
# DV安全策略配置,指定“True”以配置和启用Oracle Database Vault
#-----------------------------------------------------------------------------
DVCONFIGURATION = "false"

#-----------------------------------------------------------------------------
# Name          : DVOWNERNAME
# Datatype      : String
# Description   : DataVault Owner
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
DVOWNERNAME = ""

#-----------------------------------------------------------------------------
# Name          : DVOWNERPASSWORD
# Datatype      : String
# Description   : Password for DataVault Owner
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
DVOWNERPASSWORD = ""

#-----------------------------------------------------------------------------
# Name          : DVACCOUNTMANAGERNAME
# Datatype      : String
# Description   : DataVault Account Manager
# Valid values  : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory     : No
# DV客户经理名称
#-----------------------------------------------------------------------------
DVACCOUNTMANAGERNAME = ""

#-----------------------------------------------------------------------------
# Name          : DVACCOUNTMANAGERPASSWORD
# Datatype      : String
# Description   : Password for  DataVault Account Manager
# Valid values  : Check Oracle12c 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
# OLS配置
#-----------------------------------------------------------------------------
OLSCONFIGURATION = "false"

#-----------------------------------------------------------------------------
# Name          : DATAFILEJARLOCATION 
# Datatype      : String
# Description   : Location of the data file jar 
# Valid values  : Directory containing compressed datafile jar
# Default value : None
# Mandatory     : No
# 包含压缩数据文件jar的目录
#-----------------------------------------------------------------------------
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=FS

#-----------------------------------------------------------------------------
# Name          : DISKGROUPNAME
# Datatype      : String
# Description   : Specifies the disk group name for the storage
# Default value : DATA
# Mandatory     : No
# 指定存储的磁盘组名称
#-----------------------------------------------------------------------------
DISKGROUPNAME=DATA

#-----------------------------------------------------------------------------
# Name          : ASMSNMP_PASSWORD
# Datatype      : String
# Description   : Password for ASM Monitoring
# Default value : None
# Mandatory     : No
# ASMSNMP用户密码
#-----------------------------------------------------------------------------
ASMSNMP_PASSWORD=""

#-----------------------------------------------------------------------------
# Name          : RECOVERYGROUPNAME
# Datatype      : String
# Description   : Specifies the disk group name for the recovery area
# Default value : RECOVERY
# Mandatory     : No
# 指定恢复区磁盘组名称
#-----------------------------------------------------------------------------
RECOVERYGROUPNAME=RECOVERY


#-----------------------------------------------------------------------------
# Name          : CHARACTERSET
# Datatype      : String
# Description   : Character set of the database
# Valid values  : Check Oracle12c National Language Support Guide
# Default value : "US7ASCII"
# Mandatory     : 
# 数据库字符集
#-----------------------------------------------------------------------------
CHARACTERSET = "US7ASCII"

#-----------------------------------------------------------------------------
# Name          : NATIONALCHARACTERSET
# Datatype      : String
# Description   : National Character set of the database
# Valid values  : "UTF8" or "AL16UTF16". For details, check Oracle12c National Language Support Guide
# Default value : "AL16UTF16"
# Mandatory     : No
# 数据库国家字符集
#-----------------------------------------------------------------------------
NATIONALCHARACTERSET= "UTF8"

#-----------------------------------------------------------------------------
# Name          : REGISTERWITHDIRSERVICE
# Datatype      : Boolean
# Description   : Specifies whether to register with Directory Service.
# Valid values  : TRUE \ FALSE
# Default value : FALSE
# Mandatory     : No
# 指定是否注册目录服务
#-----------------------------------------------------------------------------
REGISTERWITHDIRSERVICE= TRUE

#-----------------------------------------------------------------------------
# Name          : DIRSERVICEUSERNAME
# Datatype      : String
# Description   : Specifies the name of the directory service user
# Mandatory     : YES, if the value of registerWithDirService is TRUE
# 指定目录服务用户的名称
#-----------------------------------------------------------------------------
DIRSERVICEUSERNAME= "name"

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

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

#-----------------------------------------------------------------------------
# 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 = "listener1,listener2"

#-----------------------------------------------------------------------------
# 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
# 是否创建示例数据库,默认为false
#-----------------------------------------------------------------------------
SAMPLESCHEMA=TRUE

#-----------------------------------------------------------------------------
# Name          : MEMORYPERCENTAGE
# Datatype      : String
# Description   : percentage of physical memory for Oracle
# Default value : None
# Mandatory     : NO
# oracle所占物理内存百分百
#-----------------------------------------------------------------------------
MEMORYPERCENTAGE = "40"

#-----------------------------------------------------------------------------
# Name          : DATABASETYPE
# Datatype      : String
# Description   : used for memory distribution when MEMORYPERCENTAGE specified
# Valid values  : MULTIPURPOSE|DATA_WAREHOUSING|OLTP
# Default value : MULTIPURPOSE
# Mandatory     : NO
# 数据库类型,多用途|数据仓库|一般事务型
#-----------------------------------------------------------------------------
DATABASETYPE = "MULTIPURPOSE"

#-----------------------------------------------------------------------------
# Name          : AUTOMATICMEMORYMANAGEMENT
# Datatype      : Boolean
# Description   : flag to indicate Automatic Memory Management is used
# Valid values  : TRUE/FALSE
# Default value : TRUE
# Mandatory     : NO
# 是否启用自动内存管理
#-----------------------------------------------------------------------------
AUTOMATICMEMORYMANAGEMENT = "TRUE"

#-----------------------------------------------------------------------------
# Name          : TOTALMEMORY
# Datatype      : String
# Description   : total memory in MB to allocate to Oracle
# Valid values  : 
# Default value : 
# Mandatory     : NO
# 分配给oracle数据库的总内存
#-----------------------------------------------------------------------------
TOTALMEMORY = "800"


#-----------------------*** End of CREATEDATABASE section ***------------------------
2.14.2 开始配置(创建非CDB数据库)
[oracle@localhost etc]$ cp dbca.rsp dbca.rsp.bak  #备份源文件
[oracle@localhost etc]$ vim dbca.rsp
[oracle@localhost etc]$ cat dbca.rsp|grep -v '^#' |grep -v '^$'  ##
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=orcl
sid=orcl
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=
createServerPool=
serverPoolName=
cardinality=
force=
pqPoolName=
pqCardinality=
createAsContainerDatabase=
numberOfPDBs=1
pdbName=
useLocalUndoForPDBs=
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/12.2.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=Just#Do@It123
systemPassword=Just#Do@It123
oracleHomeUserPassword=Just#Do@It123
emConfiguration=
emExpressPort=5500
runCVUChecks=false
dbsnmpPassword=
omsHost=
omsPort=
emUser=
emPassword=
dvConfiguration=
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=
datafileJarLocation=
datafileDestination=
recoveryAreaDestination=
storageType=
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=
variablesFile=
variables=
initParams=
sampleSchema=
memoryPercentage=
databaseType=
automaticMemoryManagement=
totalMemory=


## oracle用户执行
[oracle@localhost etc]$ pwd
/u01/app/oracle/etc
[oracle@localhost etc]$ dbca -silent -createDatabase -responseFile /u01/app/oracle/etc/dbca.rsp

## 此时可看到进度条
[oracle@localhost etc]$ pwd
/u01/app/oracle/etc
[oracle@localhost etc]$ dbca -silent -createDatabase -responseFile /u01/app/oracle/etc/dbca.rsp
Copying database files
1% complete
2% complete
18% complete
33% complete
Creating and starting Oracle instance
35% complete
40% complete
44% complete
49% complete
50% complete
53% complete
55% complete
Completing Database Creation
56% complete
57% complete
58% complete
62% complete
65% complete
66% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
[oracle@localhost etc]$ 
2.14.3 开始配置(创建容器数据库(CDB)
[oracle@localhost etc]$ pwd
/u01/app/oracle/etc
[oracle@localhost etc]$ 
###复制以下命令执行
dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \
-gdbname orcl-sid orcl\
-createAsContainerDatabase TRUE \
-numberOfPDBs 3 \
-pdbName orclpdb \
-pdbAdminPassword Just#Do@It123 \
-sysPassword Just#Do@It123 
-systemPassword Just#Do@It123 \
-datafileDestination '/u01/app/oracle/oradata' \
-recoveryAreaDestination '/u01/app/oracle/flash_recovery_area' \
-redoLogFileSize 200 \
-storageType FS \
-characterset ZHS16GBK 
-nationalCharacterSet AL16UTF16 \
-sampleSchema true \
-totalMemory 1024 \
-databaseType OLTP  \
-emConfiguration NONE
说明:
-templateName : $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc
-responseFile:如果配置了responseFile,则指定,如果不指定配置文件,也可以通过参数设置进行创建
-createAsContainerDatabase TRUE:指定创建容器数据库ORCL
-numberOfPDBs 3:指定包含pdb的个数
-pdbName orclpdb:如果numberOfPDBs=1,则指定的就是pdbname,如果创建的个数大于1,则这里指定的就是pdbname的前缀,会自动根据个数进行区分
-redoLogFileSize 200 :指定redoLogFile文件大小200M
-storageType FS:FS | ASM。存储系统类型,我用的是文件系统。如果用ASM,则填 ASM
-characterset:数据库字符集,默认是US7ASCII,国内存储中文一般设置为 AL32UTF8 / ZHS16GBK
-nationalCharacterSet :UTF8 | AL16UTF16,国家语言字符集
-databaseType:MULTIPURPOSE | DATA_WAREHOUSING | OLTP。used for memory distribution when memoryPercentage specified。
-totalMemory: total memory in MB to allocate to Oracle
-emConfiguration : CENTRAL|DBEXPRESS|BOTH|NONE,Enterprise Manager Configuration Type,默认为NONE
2.15 启停数据库
[oracle@localhost etc]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Sat May 26 13:10:46 2022

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


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

SQL> 

目前数据库已经处于启动状态,所以先停止(shutdown)它在启动(startup)它:

SQL> shut immediate ;^H ## 输错了,不能回退,也不能上下翻找历史命令 ## 解决方案  安装 rlwrap

## 正常停启
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 2466250752 bytes
Fixed Size		    8623688 bytes
Variable Size		  671091128 bytes
Database Buffers	 1778384896 bytes
Redo Buffers		    8151040 bytes
Database mounted.
Database opened.
SQL> 
## 查看监听状态:
[oracle@localhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 26-MAY-2022 13:15:06

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                26-MAY-2022 13:15:06
Uptime                    0 days 0 hr. 35 min. 12 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, 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@localhost ~]$ 
2.16 测试登录
SQL> alter user sys identified by "Just#Do@It123";  ##修改用户密码

User altered.

SQL> 

打开本地 连接数据库工具,比如 plsql

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-u0bKTnuV-1653786038972)(thread_images/image-20220526141725255.png)]

第一次连接失败:

ORA-28040: No matching authentication protocol exception

[oracle@localhost admin]$ find / -name "sqlnet.ora"
/u01/app/oracle/product/12.2.0/dbhome_1/network/admin/samples/sqlnet.ora
/u01/app/oracle/product/12.2.0/dbhome_1/network/admin/sqlnet.ora

[oracle@localhost admin]$ vim sqlnet.ora  ## 修改文件sqlnet.ora
# sqlnet.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET.ALLOWED_LOGON_VERSION=10
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=10
SQLNET.ALLOWED_LOGON_VERSION_SERVER=10

参考解决:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-abVoRq8O-1653786038973)(thread_images/image-20220526142530080.png)]

再次连接OK:

select userenv('language') from dual; --SIMPLIFIED CHINESE_CHINA.AL32UTF8
select lengthb('中文') from dual; -- 6

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-mWKbPjj3-1653786038974)(thread_images/image-20220526142109822.png)]

2.17 安装 rlwrap

安装 rlwrap 包实现 sqlplus 历史命令上下翻转回退等操作。

先使用 yum 安装 readline(一定要安装成功) 然后编译安装 rlwrap
下载安装包:rlwrap-0.45.2.tar.gz

rlwrap下载

[root@localhost ~]# cd /opt/
[root@localhost opt]# mkdir rlwrap
[root@localhost opt]# cd rlwrap/
[root@localhost rlwrap]# rz
[root@localhost rlwrap]# rz
-bash: rz: 未找到命令
[root@localhost rlwrap]# yum install -y lrzsz
[root@localhost rlwrap]# ll
总用量 328
-rw-r--r-- 1 root root 335015 526 2022 rlwrap-0.45.2.tar.gz
[root@localhost rlwrap]# tar -zxvf rlwrap-0.45.2.tar.gz
[root@localhost rlwrap]# cd rlwrap-0.45.2
[root@localhost rlwrap-0.45.2]# ls
aclocal.m4  BUGS       completions  configure     COPYING  filters  Makefile.am  NEWS       src   tools
AUTHORS     ChangeLog  config.h.in  configure.ac  doc      INSTALL  Makefile.in  README.md  test
[root@localhost rlwrap-0.45.2]# 
[root@localhost rlwrap-0.45.2]# yum install -y readline*   ##先使用 yum 安装 readline(一定要安装成功) 然后编译安装 rlwrap
[root@localhost rlwrap-0.45.2]# ./configure && make && make install

##添加 oracle 用户环境变量
[root@localhost rlwrap-0.45.2]# su - oracle
[oracle@localhost ~]$ id oracle
uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)
[oracle@localhost ~]$ whoami
oracle
[oracle@localhost ~]$
[oracle@localhost ~]$ vim ~/.bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

#For Oracle
export DISPLAY=:0.0
export TMP=/tmp;
export TMPDIR=$TMP;
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export ORACLE_TERM=xterm;
export LANG=C
export PATH=/usr/sbin:$PATH;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

# Add Oracle Env Set
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias lsnrctl='rlwrap lsnrctl'
alias asmcmd='rlwrap asmcmd'
alias adrci='rlwrap adrci'
alias ggsci='rlwrap ggsci'
alias sas='sqlplus / as sysdba'

export PATH
[oracle@localhost ~]$ source ~/.bash_profile   ## 配置生效
[oracle@localhost ~]$ 

测试:

[oracle@localhost ~]$ sas   ## alias sas='sqlplus / as sysdba'

SQL*Plus: Release 12.2.0.1.0 Production on Sat May 26 14:49:23 2022

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


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

SQL> show parameter pfile;  ##此时如果输错了,可以自由回退并且上下翻找历史命令
SQL> select * from v$version;
2.18 创建表空间以及用户
-- 1.用相应的用户登录数据库,查看当前用户下有哪些表空间
select * from dba_tablespaces;
-- 2.查看对应的表空间的使用情况
SELECT f.tablespace_name AS tablespace_name
  , round(d.sumbytes / 1024 / 1024 / 1024, 2) AS "总大小(G)"
  , round(f.sumbytes / 1024 / 1024 / 1024, 2) AS "空闲大小(G)"
  , round((d.sumbytes - f.sumbytes) / 1024 / 1024 / 1024, 2) AS "使用大小(G)"
  , round((d.sumbytes - f.sumbytes) * 100 / d.sumbytes, 2) AS "利用率"
FROM (
  SELECT tablespace_name, SUM(bytes) AS sumbytes
  FROM dba_free_space
  GROUP BY tablespace_name
) f, (
    SELECT tablespace_name, SUM(bytes) AS sumbytes
    FROM dba_data_files
   -- WHERE tablespace_name IN ('SYSTEM')
    GROUP BY tablespace_name
  ) d
WHERE f.tablespace_name = d.tablespace_name
ORDER BY 利用率 DESC, d.tablespace_name;

-- 创建表空间 
create tablespace ORCL datafile '/u01/app/oracle/oradata/orcl/ORCL01.dbf' size 10G;
## 后续增加,继续执行语句,更新ORCL01.dbf为ORCL02.dbf....
## 表空间最大一次加32G,所以300G的话需要写10条这样的命令,/u01/app/oracle/oradata/orcl/ORCL02.dbf 这个文件自增。不建议自增
create tablespace ORCL datafile '/u01/app/oracle/oradata/ORCL/ORCL02.dbf' size 31G;
-- 创建用户指定表空间
create user C##myadmin identified by Just#Do@It123 default tablespace ORCL;
grant create session to C##myadmin;  #用户就能成功登录进去
grant create table to C##myadmin;  #赋予用户创建表的权限
grant create view to C##myadmin; #赋予用户创建视图的权限
grant connect, resource to  C##myadmin; #授权
grant unlimited tablespace to C##myadmin; #赋予相应的权限

#【Oracle】查看哪些用户被授予了DBA权限
select * from dba_role_privs where granted_role='DBA';

温馨提示: 需要oracle12c安装包的,可评论联系,有问题当然欢迎随时提出~~

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐