检查包是否安装
rpm -q binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.i686 libX11 libX11*.i686 libXau libXau*.i686 libXi libXi*.i686 libXtst libXtst*.i686 libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libxcb libxcb*.i686 make nfs-utils net-tools smartmontools sysstat unixODBC unixODBC-devel gcc gcc-c++ libXext libXext*.i686 zlib-devel zlib-devel*.i686 unzip
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.i686 libX11 libX11*.i686 libXau libXau*.i686 libXi libXi*.i686 libXtst libXtst*.i686 libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libxcb libxcb*.i686 make nfs-utils net-tools smartmontools sysstat unixODBC unixODBC-devel gcc gcc-c++ libXext libXext*.i686 zlib-devel zlib-devel*.i686 unzip
安装包
yum -y install ksh
yum -y install libaio*
yum -y install gcc*
yum -y install libst*
yum -y install unzip
安装包
rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
--增加用户组与用户
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
passwd oracle
--修改机器名
hostnamectl set-hostname ccstyoradb
--关闭smartd
chkconfig smartd off
--关闭selinux
vi /etc/selinux/config
disable
setenforce 0
--关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
--配置本地主机名解析
cat > /etc/sysconfig/network <<EOF
NETWORKING=yes
HOSTNAME=ccstyoradb
NOZEROCONF=yes
EOF
--配置hosts
vi /etc/hosts
111.224.0.248 ccstyoradb
--创建相关目录
mkdir -p /u01/app/oracle/product/12.2.0/dbhome_1/
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app
--jdk安装
[root@Oracle ~]# java -version # 查看安装版本
[root@Oracle ~]# yum remove openjdk # 如果是系统自带的openjdk,则卸载
[root@Oracle ~]# rpm -ivh jdk-8u221-linux-x64.rpm # 安装自己下载的JDK
--修改内核参数vi /etc/sysctl.conf systcl –p生效
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 6597069766656
kernel.shmall = 1073741824
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 = 1048576
kernel.panic_on_oops = 1
vm.swappiness=0
--修改系统资源控制文件
vi /etc/security/limits.conf
root soft nproc unlimited
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle soft memlock 16000000
oracle hard memlock 16000000
* soft nofile 10240
* soft nofile 10240
* hard nofile 10240
* hard nofile 10240
--使用pam_limits认证模块
vi /etc/pam.d/login
session required pam_limits.so
--修改环境变量
#vi /etc/profile
#if [ $USER = "oracle" ]; then
# if [ $SHELL = "/bin/ksh" ]; then
# ulimit -p 16384
# ulimit -n 65536
# else
# ulimit -u 16384 -n 65536
# fi
#fi
su - oracle
vi .bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=ccstyoradb
export ORACLE_UNQNAME=shorcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export ORACLE_SID=shorcl
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG='SIMPLIFIED CHINESE_CHINA.AL32UTF8'
source .bash_profile
--unzip linuxx64_12201_database.zip
修改响应文件
vi /home/oracle/database/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall
#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/u01/app/oraInventory
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=/u01/app/oracle
#-------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# - EE : Enterprise Edition
# - SE2 : Standard Edition 2
#-------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE
###############################################################################
# #
# PRIVILEGED OPERATING SYSTEM GROUPS #
# ------------------------------------------ #
# Provide values for the OS groups to which SYSDBA and SYSOPER privileges #
# needs to be granted. If the install is being performed as a member of the #
# group "dba", then that will be used unless specified otherwise below. #
# #
# The value to be specified for OSDBA and OSOPER group is only for UNIX based #
# Operating System. #
# #
###############################################################################
#------------------------------------------------------------------------------
# The OSDBA_GROUP is the OS group which is to be granted SYSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.OSDBA_GROUP=dba
#------------------------------------------------------------------------------
# The OSOPER_GROUP is the OS group which is to be granted SYSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OSOPER_GROUP=oper
#------------------------------------------------------------------------------
# The OSBACKUPDBA_GROUP is the OS group which is to be granted SYSBACKUP privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSBACKUPDBA_GROUP=dba
#------------------------------------------------------------------------------
# The OSDGDBA_GROUP is the OS group which is to be granted SYSDG privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSDGDBA_GROUP=dba
#------------------------------------------------------------------------------
# The OSKMDBA_GROUP is the OS group which is to be granted SYSKM privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSKMDBA_GROUP=dba
#------------------------------------------------------------------------------
# The OSRACDBA_GROUP is the OS group which is to be granted SYSRAC privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSRACDBA_GROUP=dba
cd /home/oracle/database
./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion -showProgress -silent -responseFile /home/oracle/database/response/db_install.rsp
------
------
------重要!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!
-----安装完成!!!!!!!!!!!!!!!!!!
执行root的两个sh
创建数据库----如果需要pdbs则选这个
dbca -silent -createDatabase \
-templateName /u01/app/oracle/product/12.2.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc \
-gdbname shorcl -sid shorcl -responseFile /home/oracle/database/response/dbca.rsp \
-characterSet AL32UTF8 \
-sysPassword Oracle_1234 \
-systemPassword Oracle_1234 \
-createAsContainerDatabase true \ #如果需要像11g的,不安装容器数据库。则删除这一行如下
-numberOfPDBs 1 \ #
-pdbName pdb1 \ #
-pdbAdminPassword Oracle_1234 \ #
-automaticMemoryManagement false \
-ignorePreReqs
创建数据库----如果不需要pdbs则选这个 我们不安装pdbs
---shorcl
dbca -silent -createDatabase \
-templateName /u01/app/oracle/product/12.2.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc \
-gdbname shorcl -sid shorcl -responseFile /home/oracle/database/response/dbca.rsp \
-characterSet AL32UTF8 \
-sysPassword Oracle_1234 \
-systemPassword Oracle_1234 \
-automaticMemoryManagement false \
-ignorePreReqs
静默lsnrctl创建。
netca -silent -responseFile /home/oracle/database/response/netca.rsp