centos 7.9 静默安装oracle 19.16

时间:2022-11-19 12:01:38
文档课题:centos 7.9 静默安装oracle 19.16
1、安装准备
1.1、系统版本
[root@liujun ~]# cat /etc/*release
CentOS Linux release 7.9.2009 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.9.2009 (Core)
CentOS Linux release 7.9.2009 (Core)
1.2、IP设置
# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=e7191296-fd65-478d-936e-f43dc98f1745
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.133.120
DNS1=192.168.133.2
GATEWAY=192.168.133.2
PREFIX=24
# service network restart
说明:此处将BOOTPROTO=none修改为BOOTPROTO=static,修改后重启网卡.
1.3、主机名
[root@localhost ~]# hostnamectl set-hostname liujun
1.4、关闭防火墙
# systemctl stop firewalld
# systemctl disable firewalld
1.5、域名解析
# cat <<EOF>>/etc/hosts
192.168.133.120 liujun
EOF
1.6、selinux
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
说明:重启生效.
1.7、配Yum源
# mount /dev/sr0 /mnt
# mkdir /etc/yum.repos.d/bak
# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
# cat <<EOF>>/etc/yum.repos.d/centos7.repo
[centos7]
name= centos7
baseurl=file:///mnt
enabled=1
gpgcheck=0
EOF
# yum makecache
1.8、安装包
# yum -y install bc binutils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libX11 libXau libXi libXtst libgcc libnsl librdmacm libstdc++ libstdc++-devel libxcb libibverbs make policycoreutils policycoreutils-python-utils smartmontools sysstat nfs-utils gcc iotop
sftp> lcd F:\package
sftp> put glibc-devel-2.17-317.el7.i686.rpm
# rpm -ivh glibc-devel-2.17-317.el7.i686.rpm --nodeps --force
检查安装包
# rpm -q bc binutils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libX11 libXau libXi libXtst libgcc libnsl librdmacm libstdc++ libstdc++-devel libxcb libibverbs make policycoreutils policycoreutils-python-utils smartmontools sysstat nfs-utils gcc iotop | grep "not installed"
注意:policycoreutils-python-utils、libnsl包并未成功安装,但并不影响后续数据库的安装.
1.9、用户与组
# groupadd oinstall
# groupadd dba
# groupadd oper
# useradd -g oinstall -G dba,oper oracle
# echo oracle_4U |passwd --stdin oracle
1.10、安装目录
# mkdir -p /u01/app/oracle/product/19.16.0/db_1
# mkdir -p /u01/app/oraInventory
# chown -R oracle:oinstall /u01/app/oracle
# chown -R oracle:oinstall /u01/app/oraInventory
# chmod -R 775 /u01
1.11、环境变量
# su - oracle
$ cat <<EOF>>.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.16.0/db_1
export ORACLE_SID=orcl
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib
EOF
$ source .bash_profile
1.12、内核限制
# cat <<EOF>>/etc/sysctl.conf
kernel.shmmax = 8589934591
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
fs.file-max = 6815744

kernel.shmall = 2097152
net.ipv4.ip_local_port_range = 11000 65000
net.ipv4.tcp_tw_reuse = 1
net.core.somaxconn = 65500
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_keepalive_intvl = 5
net.ipv4.tcp_timestamps = 0
fs.aio-max-nr = 1048576
EOF

# /sbin/sysctl -p
1.13、系统限制
# cat <<EOF>>/etc/security/limits.conf
oracle soft nproc 8192
oracle hard nproc 16384
oracle soft nofile 8192
oracle hard nofile 65536
oracle soft stack 10240
EOF
# cat <<EOF>>/etc/pam.d/login
session required /usr/lib64/security/pam_limits.so
EOF
1.14、上传文件
# mkdir -p /u01/setup/db
sftp> lcd F:\installmedium\19c
sftp> cd /u01/setup/db
sftp> put LINUX.X64_1916_db_home.zip
# chown -R oracle:oinstall /u01/setup/db
2、安装DB
2.1、解压文件
# su - oracle
$ cd /u01/setup/db
$ unzip -q LINUX.X64_1916_db_home.zip -d $ORACLE_HOME
2.2、修改响应文件
说明:此处采用静默安装,修改响应文件.
[oracle@liujun response]$ pwd
/u01/app/oracle/product/19.16.0/db_1/install/response
[oracle@liujun response]$ cat db_install.rsp | grep -v "^#" | grep -v "^$"
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/19.16.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.rootconfig.executeRootScript=false
oracle.install.db.rootconfig.configMethod=ROOT
oracle.install.db.rootconfig.sudoPath=
oracle.install.db.rootconfig.sudoUserName=
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.ConfigureAsContainerDB=
oracle.install.db.config.PDBName=
oracle.install.db.config.starterdb.characterSet=
oracle.install.db.config.starterdb.memoryOption=
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=
oracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.password.PDBADMIN=
oracle.install.db.config.starterdb.managementOption=
oracle.install.db.config.starterdb.omsHost=
oracle.install.db.config.starterdb.omsPort=
oracle.install.db.config.starterdb.emAdminUser=
oracle.install.db.config.starterdb.emAdminPassword=
oracle.install.db.config.starterdb.enableRecovery=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
2.3、开始安装
[oracle@liujun db_1]$ /u01/app/oracle/product/19.16.0/db_1/runInstaller -force -silent -noconfig -ignorePrereq -responseFile /u01/app/oracle/product/19.16.0/db_1/install/response/db_install.rsp

Launching Oracle Database Setup Wizard...

The response file for this session can be found at:
/u01/app/oracle/product/19.16.0/db_1/install/response/db_2022-11-19_10-30-35AM.rsp

You can find the log of this install session at:
/tmp/InstallActions2022-11-19_10-30-35AM/installActions2022-11-19_10-30-35AM.log

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

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[liujun]
Execute /u01/app/oracle/product/19.16.0/db_1/root.sh on the following nodes:
[liujun]


Successfully Setup Software.
Moved the install session logs to:
/u01/app/oraInventory/logs/InstallActions2022-11-19_10-30-35AM
执行脚本.
[root@liujun ~]# /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@liujun ~]# /u01/app/oracle/product/19.16.0/db_1/root.sh
Check /u01/app/oracle/product/19.16.0/db_1/install/root_liujun_2022-11-19_10-32-50-088540249.log for the output of root script
2.4、日志查看
$ cat /u01/app/oraInventory/logs/InstallActions2022-11-19_10-30-35AM/installActions2022-11-19_10-30-35AM.log
3、创建监听
[oracle@liujun netca]$ pwd
/u01/app/oracle/product/19.16.0/db_1/assistants/netca
[oracle@liujun netca]$ cat netca.rsp | grep -v "^#" | grep -v "^$"
[GENERAL]
RESPONSEFILE_VERSION="19.0"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
说明:监听响应文件不用修改.
[oracle@liujun netca]$ netca -silent -responsefile /u01/app/oracle/product/19.16.0/db_1/assistants/netca/netca.rsp

Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u01/app/oracle/product/19.16.0/db_1/assistants/netca/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/19.16.0/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
4、安装实例
4.1、修改响应文件
[oracle@liujun dbca]$ pwd
/u01/app/oracle/product/19.16.0/db_1/assistants/dbca
[oracle@liujun dbca]$ cp dbca.rsp dbca.rsp.bak
[oracle@liujun dbca]$ cat dbca.rsp | grep -v "^#" | grep -v "^$"
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v19.0.0
gdbName=orcl
sid=orcl
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=
createServerPool=
serverPoolName=
cardinality=
force=
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=1
pdbName=orclpdb
useLocalUndoForPDBs=
pdbAdminPassword=oracle_4U
nodelist=
templateName=General_Purpose.dbc
sysPassword=oracle_4U
systemPassword= oracle_4U
oracleHomeUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=
dbsnmpPassword=
omsHost=
omsPort=
emUser=
emPassword=
dvConfiguration=
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=
datafileJarLocation=
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}
recoveryAreaDestination=
storageType=
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=
variablesFile=
variables=
initParams=
sampleSchema=
memoryPercentage=40
databaseType=
automaticMemoryManagement=false
totalMemory=6500
4.2、开始安装
[oracle@liujun dbca]$ dbca -silent -createDatabase -responseFile /u01/app/oracle/product/19.16.0/db_1/assistants/dbca/dbca.rsp
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
53% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/orcl.
Database Information:
Global Database Name:orcl
System Identifier(SID):orcl
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
4.3、日志查看
[oracle@liujun orcl]$ pwd
/u01/app/oracle/cfgtoollogs/dbca/orcl
[oracle@liujun orcl]$ tail -5000f trace.log_2022-11-19_11-03-59AM
5、数据验证
5.1、监听状态
[oracle@liujun dbca]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 19-NOV-2022 11:29:36

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=liujun)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 19-NOV-2022 10:49:42
Uptime 0 days 0 hr. 39 min. 53 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/19.16.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/liujun/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=liujun)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "edcb65af56a5fb15e0537885a8c0f9dc" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
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...
Service "orclpdb" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
5.2、数据文件
SQL> col file_name for a60
SQL> set line 200
SQL> select 'datafile' file_type,file#,name FILE_NAME,status,enabled from v$datafile
2 union all
3 select 'tempfile',file#,name FILE_NAME,status,enabled from v$tempfile
4 union all
5 select 'logfile',group# file#,member FILE_NAME,status,'' from v$logfile
6 union all
7 select 'controlfile', to_number('') ,name FILE_NAME,status,'' from v$controlfile;

FILE_TYPE FILE# FILE_NAME STATUS ENABLED
----------- ---------- ------------------------------------------------------------ ------- ----------
datafile 1 /u01/app/oracle/oradata/ORCL/system01.dbf SYSTEM READ WRITE
datafile 3 /u01/app/oracle/oradata/ORCL/sysaux01.dbf ONLINE READ WRITE
datafile 4 /u01/app/oracle/oradata/ORCL/undotbs01.dbf ONLINE READ WRITE
datafile 5 /u01/app/oracle/oradata/ORCL/pdbseed/system01.dbf SYSTEM READ WRITE
datafile 6 /u01/app/oracle/oradata/ORCL/pdbseed/sysaux01.dbf ONLINE READ WRITE
datafile 7 /u01/app/oracle/oradata/ORCL/users01.dbf ONLINE READ WRITE
datafile 8 /u01/app/oracle/oradata/ORCL/pdbseed/undotbs01.dbf ONLINE READ WRITE
datafile 9 /u01/app/oracle/oradata/ORCL/orclpdb/system01.dbf SYSTEM READ WRITE
datafile 10 /u01/app/oracle/oradata/ORCL/orclpdb/sysaux01.dbf ONLINE READ WRITE
datafile 11 /u01/app/oracle/oradata/ORCL/orclpdb/undotbs01.dbf ONLINE READ WRITE
datafile 12 /u01/app/oracle/oradata/ORCL/orclpdb/users01.dbf ONLINE READ WRITE

FILE_TYPE FILE# FILE_NAME STATUS ENABLED
----------- ---------- ------------------------------------------------------------ ------- ----------
tempfile 1 /u01/app/oracle/oradata/ORCL/temp01.dbf ONLINE READ WRITE
tempfile 2 /u01/app/oracle/oradata/ORCL/pdbseed/temp012022-11-19_11-15- ONLINE READ WRITE
43-924-AM.dbf

tempfile 3 /u01/app/oracle/oradata/ORCL/orclpdb/temp01.dbf ONLINE READ WRITE
logfile 3 /u01/app/oracle/oradata/ORCL/redo03.log
logfile 2 /u01/app/oracle/oradata/ORCL/redo02.log
logfile 1 /u01/app/oracle/oradata/ORCL/redo01.log
controlfile /u01/app/oracle/oradata/ORCL/control01.ctl
controlfile /u01/app/oracle/oradata/ORCL/control02.ctl

19 rows selected.
5.3、实例内存
SQL> show parameter pga

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_limit big integer 3250M
pga_aggregate_target big integer 1625M
SQL> show parameter memory

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
inmemory_adg_enabled boolean TRUE
inmemory_automatic_level string OFF
inmemory_clause_default string
inmemory_expressions_usage string ENABLE
inmemory_force string DEFAULT
inmemory_max_populate_servers integer 0
inmemory_optimized_arithmetic string DISABLE
inmemory_prefer_xmem_memcompress string
inmemory_prefer_xmem_priority string
inmemory_query string ENABLE

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
inmemory_size big integer 0
inmemory_trickle_repopulate_servers_ integer 1
percent
inmemory_virtual_columns string MANUAL
inmemory_xmem_size big integer 0
memory_max_target big integer 0
memory_target big integer 0
optimizer_inmemory_aware boolean TRUE
shared_memory_address integer 0
5.4、组件版本
SQL> select comp_id,comp_name,version,status from dba_registry

COMP_ID COMP_NAME VERSION STATUS
--------------- ----------------------------------- --------------- ---------------
CATALOG Oracle Database Catalog Views 19.0.0.0.0 VALID
CATPROC Oracle Database Packages and Types 19.0.0.0.0 VALID
RAC Oracle Real Application Clusters 19.0.0.0.0 OPTION OFF
JAVAVM JServer JAVA Virtual Machine 19.0.0.0.0 VALID
XML Oracle XDK 19.0.0.0.0 VALID
CATJAVA Oracle Database Java Packages 19.0.0.0.0 VALID
APS OLAP Analytic Workspace 19.0.0.0.0 VALID
XDB Oracle XML Database 19.0.0.0.0 VALID
OWM Oracle Workspace Manager 19.0.0.0.0 VALID
CONTEXT Oracle Text 19.0.0.0.0 VALID
ORDIM Oracle Multimedia 19.0.0.0.0 VALID

COMP_ID COMP_NAME VERSION STATUS
--------------- ----------------------------------- --------------- ---------------
SDO Spatial 19.0.0.0.0 VALID
XOQ Oracle OLAP API 19.0.0.0.0 VALID
OLS Oracle Label Security 19.0.0.0.0 VALID
DV Oracle Database Vault 19.0.0.0.0 VALID

15 rows selected.