1.配置hosts级语言环境
echo "192.168.10.200 oracle" >> /etc/hosts && cat /etc/hosts echo "export LANG=en_US.UTF-8" >> ~/.bash_profile && source ~/.bash_profile
2.创建组、用户并设置密码
groupadd -g 501 oinstall groupadd -g 502 dba groupadd -g 503 oper groupadd -g 504 backupdba groupadd -g 505 kmdba useradd -u 601 -g oinstall -G dba,oper,backupdba,kmdba oracle passwd oracle
3.创建客户端所需目录并授予相应的权限
mkdir -p /u01/app/oracle/product/19.3.0/db_1 mkdir -p /u01/app/oraInventory chown -R oracle:oinstall /u01/ chmod -R 755 /u01/
4.配置本地镜像源,安装依赖包
cd /etc/yum.repos.d/ && mkdir bk mv *.repo bk/ mkdir -p /mnt/cdrom mount /dev/sr0 /mnt/cdrom echo "[REHL]" >> /etc/yum.repos.d/eheng.repo echo "name=Linux 7.x DVD" >> /etc/yum.repos.d/eheng.repo echo "baseurl=file:///mnt/cdrom" >> /etc/yum.repos.d/eheng.repo echo "gpgcheck=0" >> /etc/yum.repos.d/eheng.repo echo "enabled=1" >> /etc/yum.repos.d/eheng.repo
compat-libstdc++-33-3.2.3-72.el7.x86_64这个包需要用rpm安装
yum install autoconf -y yum install automake -y yum install binutils -y yum install binutils-devel -y yum install bison -y yum install cpp -y yum install dos2unix -y yum install ftp -y yum install gcc -y yum install gcc-c++ -y yum install lrzsz -y yum install python-devel -y yum install compat-db* -y yum install compat-gcc-34 -y yum install compat-gcc-34-c++ -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 libXpm-*.i686 -y yum install libXp.so.6 -y yum install libXt.so.6 -y yum install libXtst.so.6 -y yum install libXetxt -y yum install libXetxt.i686 -y yum install libXtst -y yum install libXtst.i686 -y yum install libX11 -y yum install libX11.i686 -y yum install libXau -y yum install libXau.i686 -y yum install libxcb -y yum install libxcb.i686 -y yum install libXi -y yum install libXi.i686 -y yum install libstdc++-docs -y yum install libgcc_s.so.1 -y yum install libstdc++.i686 -y yum install libstdc++-devel -y yum install libstdc++-devel.i686 -y yum install libaio -y yum install libaio-devel -y yum install libaio.i686 -y yum install libaio.i686-devel -y yum install ksh -y yum install libXp -y yum install numactl -y yum install numactl-devel -y yum install make -y yum install sysstat -y yum install unixODBC -y yum install unixODBC-devel -y yum install elfutils-libelf-devel-0.97 -y yum install elfutils-libelf-devel -y yum install redhat-lsb-core -y
5.关闭防火墙与selinux
systemctl stop firewalld systemctl status firewalld systemctl disable firewalld sed -i 's/SELINUX=enforcing/SELINUX=disable/g' /etc/selinux/config && cat /etc/selinux/config
6.系统参数配置
修改vim /etc/security/limits.conf,在末尾追加如下内容
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768
修改/etc/security/limits.d/20-nproc.conf文件内容
#* soft nproc 1024 #root soft nproc unlimited * - nproc 16384
修改/etc/pam.d/login文件,在末尾追加如下内容
echo "session required pam_limits.so" >> /etc/pam.d/login
修改sysctl.conf配置文件
fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmax = 2147483648 kernel.shmall = 2097152 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
配置oracle用户环境变量
PS1="[`whoami`@`hostname`:"'$PWD]$' alias sqlplus="rlwrap sqlplus" alias rman="rlwrap rman" export PS1 export TMP=/tmp export LANG=en_US.UTF-8 export TMPDIR=$TMP export TZ=Asia/Shanghai export ORACLE_HOSTNAME=oracle ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db_1; export ORACLE_HOME ORACLE_TERM=xterm; export ORACLE_TERM NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/19.3.0/db_1/bin:$ORACLE_HOME/bin; export PATH THREADS_FLAG=native; export THREADS_FLAG if [ $USER = "oracle" ] || [ $USER = "grid" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi
7.编辑client_install.rsp文件
UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION= /u01/app/oraInventory/ ORACLE_HOME=/u01/app/oracle/product/19.3.0/db_1 ORACLE_BASE=/u01/app/oracle/ oracle.install.client.installType=Administrator
9.静默安装客户端
./runInstaller -silent -responseFile /u01/app/client/response/client_install.rsp -ignoreSysPrereqs --root用户执行脚本 /u01/app/oraInventory/orainstRoot.sh
10.配置客户端监听
netca -silent -responseFile /u01/app/client/response/netca.rsp 注:如若失败,请再次执行 --编辑tnsnames.ora如没有此文件,则新建即可 roobbin1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.40)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = roobbin) (SID = roobbin1) ) )
11.测试客户端是否正常
[oracle@oracle:/u01/]$sqlplus sys/oracle@roobbin1 as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 19 20:57:21 2021 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ roobbin1 OPEN SQL> exit