静默快速安装oracle 19c
1.配置yum源
1.配置网络yum源
1.删除redhat7.0系统自带的yum软件包;
rpm -qa|grep yum >oldyum.pkg 备份原信息
rpm -qa|grep yum|xargs rpm -e --nodeps 不检查依赖,直接删除rpm包
123
2.自行下载所需要的软件包。包名会更新,根据当前最新的下载。如有有依赖问题,下载依赖包进行安装。
阿里云网络源地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
网易163网络源地址:http://mirrors.163.com/ CentOS
网络源地址:http://centos.ustc.edu.cn/centos/
打开网页,ctrl+f 搜索相关yum包:http://mirrors.163.com/centos/7/os/x86_64/Packages/
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-langpacks-0.4.2-7.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-rhn-plugin-2.0.1-10.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
3.根据依赖项安装;
rpm -ivh yum-*
4.下载repo配置文件。
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/centos/7/atomic/x86_64/repo/CentOS-Base.repo
将文件中所有的$releasever**更换为**7,否则无法使用。
sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
5下载KEY文件:
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 http://mirrors.163.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
6.清理yum缓存。将服务器软件包信息缓存至本地,提高搜索安装效率
yum -y clean all && yum -y makecache
2.配置本地yum源
yum源配置:
## 挂载镜像
mkdir -p /mnt/cdrom
mount /dev/sr0 /mnt/cdrom
## 编辑yum源文件
cd /etc/yum.repos.d/
vi yum.repo
[base]
name=base
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@redhat yum.repos.d] yum clean all
2.配置静态IP
##配置Public IP
nmcli connection modify ens33 ipv4.addresses 192.168.134.239/24 ipv4.gateway 192.168.134.2 ipv4.method manual autoconnect yes
##生效
nmcli connection up ens33
nmcli connection show
vi /etc/sysconfig/network-scripts/ifcfg-ens33
添加下面的内容带该文件中
PEERDNS=no #使用指定DNS
DNS1=114.114.114.114 #国内运营商DNS
DNS2=8.8.8.8 #Google国外DNS
2.关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
getenforce
3.关闭防火墙
-
使用root权限登录到Red Hat系统的终端。
-
停止当前运行的防火墙服务。可以使用以下命令:
systemctl stop firewalld
-
禁止防火墙服务在系统启动时自动启动。可以使用以下命令:
systemctl disable firewalld
-
确认防火墙服务已停止并禁用。可以使用以下命令验证:
systemctl status firewalld
如果输出显示 “inactive”,则表示防火墙服务已成功停止并禁用。
-
重新启动系统,以使更改生效。
3.hosts文件配置
配置hostname:
hostnamectl set-hostname ora19
配置hosts文件:
cat <<EOF>>/etc/hosts
#Public IP
192.168.134.239 ora19
192.168.134.240 ora19std
EOF
二、准备阶段
1.安装相关软件:
## 安装常用软件
yum install -y vim tree net-tools unzip
## 安装Oracle依赖包
yum install -y 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
2.用户与组:
## 创建oinstall、dba组与oracle用户
groupadd -g 54321 oinstall
groupadd -g 54322 dba
useradd -u 9999 -g oinstall -G dba oracle
## 设置oracle用户密码
echo "oracle:123456" | chpasswd
3.修改内核参数:
## 修改内核参数文件
cat >> /etc/sysctl.conf << EOF
## add for oracle
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
EOF
## 使其生效
/sbin/sysctl -p
4.资源限制:
cat >> /etc/security/limits.d/20-nproc.conf <<EOF
* soft nproc 4096
root soft nproc unlimited
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
EOF
5.配置用户环境变量:
su - oracle
vi ~/.bash_profile
## 加入以下配置到文件尾
#日志存放位置
export TMP=/tmp
export TMPDIR=$TMP
#主机名
export ORACLE_HOSTNAME=ora19
#库名称
export ORACLE_UNQNAME=oracle
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db_1
#库名称
export ORACLE_SID=oracle
export PATH=/usr/sbin:$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 PATH=/usr/sbin:$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
6.创建相关文件目录:
su root
mkdir /u01/app
mkdir /u01/app/oracle
mkdir /u01/app/oradata
mkdir /u01/app/archive
mkdir /u01/app/oracle/oraInventory
mkdir -p /u01/app/oracle/product/19.3.0/db_1
chown -R oracle:oinstall /u01/app/
chmod -R 775 /u01/app/
7.安装Oracle软件
下载Oracle安装文件:
下载地址
上传文件到服务器,并将压缩包授权给oracle后用oracle用户解压到$ORACLE_HOME文件夹下
su - root
cd /soft
chown -R oracle:oinstall /soft
su - oracle -c "unzip -q /soft/LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/db_1/"
编辑db_install.rsp:
cd $ORACLE_HOME/install/response
cp db_install.rsp /soft
vim /soft/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
ORACLE_HOME=/u01/app/oracle/product/19.3.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=dba
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.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.SID=oracle
静默安装Oracle软件:
cd $ORACLE_HOME
./runInstaller -silent -responseFile /soft/db_install.rsp -ignorePrereq
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/19.3.0/db_1/root.sh
配置监听:
cat >>/tmp/netca.rsp <<EOF
[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"}
EOF
netca -silent -responseFile /soft/netca.rsp
8.主库安装数据库实例
dbca.rsp:
vim /soft/dbca.rsp
gdbName=oracle
sid=oracle
sysPassword=oracle
oracleHomeUserPassword=oracle
templateName=General_Purpose.dbc
emExpressPort=5500
totalMemory=1500
datafileDestination=/u01/app/oradata
characterSet=ZHS16GBK
nationalCharacterSet=AL16UTF16
databaseType=OLTP
静默安装:
dbca -silent -createDatabase -responseFile /soft/dbca.rsp
检查状态:
## 数据库状态
select name,db_unique_name,open_mode from v$database;
## 实例状态
select instance_name,status from v$instance;