Oracle 19.3 Sharding 安装配置之01 (安裝
2020-03-18 本文已影响0人
轻飘飘D
先準備一台基礎VM,通過此基礎VM克隆出其他VM出來
- 網卡配置
[root@xag100 network-scripts]# cat ifcfg-ens192
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens192
UUID=62f940e3-fb9f-4f0e-8f95-01e93669e8c8
DEVICE=ens192
ONBOOT=yes
IPADDR=10.0.99.100
NETMASK=255.255.0.0
DNS1=8.8.8.8
GATEWAY=10.0.10.37
#重啟網卡
[root@xag100 network-scripts]# service network restart
- 硬盤劃分
序号 | 分区名称 | 大小 | 用途说明 |
---|---|---|---|
1 | /boot | 200MB | 引导分区 |
2 | /tmp | 3G | 临时空间 |
3 | /home | 1G | 所有用户的home目录 |
4 | swap | 8G | 交换分区(物理內存小於8G則 *2 反之 同物理內存 |
5 | / | 39G | 根分区 |
[root@xag100 network-scripts]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 39G 896M 38G 3% /
/dev/sda1 187M 120M 68M 65% /boot
/dev/mapper/centos-home 953M 33M 921M 4% /home
/dev/mapper/centos-tmp 2.8G 33M 2.8G 2% /tmp
- 禁用防火墙
#关闭firewall:停止firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
- 安裝基本工具
yum -y install nano vim wget curl net-tools lsof zip unzip perl autoconf autoconf
cd /usr/local/src
wget http://www.rpmfind.net/linux/epel/6/x86_64/Packages/r/rlwrap-0.42-1.el6.x86_64.rpm
rpm -ivh rlwrap-0.42-1.el6.x86_64.rpm
- linux完整更新
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 -y
yum install gcc gcc-c++ xterm libXp e2fsprogs e2fsprogs-libs elfutils-libelf-devel libXrender -y
yum -y install bc
#可選項
yum update -y
- 检查并卸载OpenJDK & 安裝JDK 1.8
#卸载
rpm -qa | grep java
#安装jdk
mkdir /u01/java -p
cd /u01/java/
#上传jdk-8u181-linux-x64.tar.gz
tar -zxvf jdk-8u181-linux-x64.tar.gz
#设置环境变量
vim /etc/profile
在profile中添加如下内容:
#set java environment
JAVA_HOME=/u01/java/jdk1.8.0_181
JRE_HOME=/u01/java/jdk1.8.0_181/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
#让修改生效:
source /etc/profile
#输入java -version查看一下jdk版本信息:
java -version
- sysctl.conf 配置
grep MemTotal /proc/meminfo
MemTotal: 3861320 kB
#計算方法如下
shmall = 3861320 * 1024 /4096 =965330
shmmax = 3861320 * 1024 *0.9 =3558592512
[root@xag100 java]# cat /etc/sysctl.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 965330
kernel.shmmax = 3558592512
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
#生效
sysctl -p
- 配置主机名
[root@xag100 ~]# cat /etc/hostname
xag100
[root@xag100 java]# cat /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
HOSTNAME=xag100
vim /etc/hosts
#增加如下
10.0.99.100 xag100
- 配置limits.conf
vim /etc/security/limits.conf
#增加如下配置
#最后两行memlock =kernel.shmmax/1024 = 3558592512/1024=3475188
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 16384
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 3475188
oracle hard memlock 3475188
- 编辑 /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=enforcing
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
#SELINUXTYPE=targeted
SELINUX=permissive
#生效
setenforce Permissive
- 配置/dev/shm大小
#验证共享内存是否已正确安装且大小足够
# > SGA+PGA 或 =物理内存*50%
vim /etc/fstab
#修改/dev/shm的大小
修改/etc/fstab的这行: 默认的:
tmpfs /dev/shm tmpfs defaults 0 0
改成:
tmpfs /dev/shm tmpfs defaults,size=4G 0 0
#重新mount /dev/shm使之生效:
mount -o remount /dev/shm
df -h
...
tmpfs 4.0G 0 4.0G 0% /dev/shm
...
12 . 创建用户和组
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
#groupadd -g 54324 backupdba
#groupadd -g 54325 dgdba
#groupadd -g 54326 kmdba
#groupadd -g 54327 asmdba
#groupadd -g 54328 asmoper
#groupadd -g 54329 asmadmin
#groupadd -g 54330 racdba
useradd -u 54321 -g oinstall -G dba,oper oracle
#oracle用户的登录密码,后续登录要用,记着。
echo "123456" | passwd --stdin oracle
#设置密码永不过期
chage -M -1 oracle
chage -l oracle
id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper)
- 限制参数修改(可)
vim /etc/pam.d/login
#add
#这是对应64位的
session required /lib64/security/pam_limits.so
#这是对应32位的
#session required /lib/security/pam_limits.so
#修改ulimit:
vim /etc/profile
#添加oracle 用户 limit:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
#生效
source /etc/profile
14.创建目录
mkdir -p /u01/app/oracle/
mkdir -p /u01/tmp/
#mkdir -p /u02/oradata/
#mkdir -p /u03/fra/
mkdir -p /u01/app/oracle/oradata/
mkdir -p /u01/app/oracle/fast_recovery_area
chown -R oracle:oinstall /u01/app/
chown -R oracle:oinstall /u01/tmp/
#chown -R oracle:oinstall /u02/oradata/
#chown -R oracle:oinstall /u03/fra/
chmod -R 775 /u01/app/
chmod -R 775 /u01/tmp/
#chmod -R 775 /u02/oradata/
#chmod -R 775 /u03/fra/
- 创建scripts 目录及setEnv.sh文件(从此处开始无特别说明都是在oracle用户下操作)
mkdir /home/oracle/scripts
#创建 setEnv.sh 文件 [不同机器上 ORACLE_ 的 HOSTNAME、UNQNAME、SID 不同]
----------------------------------------------------------------------
cat > /home/oracle/scripts/setEnv.sh <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=xag100
export ORACLE_UNQNAME=db100
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db_1
export ORACLE_SID=db100
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
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
EOF
=================================================================
#Add a reference to the "setEnv.sh" file at "/home/oracle/.bash_profile" file
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
#生效
source /home/oracle/.bash_profile
#Create a "start_all.sh" and "stop_all.sh" script
---------------------------------------------------------------
cat > /home/oracle/scripts/start_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbstart \$ORACLE_HOME
EOF
---------------------------------------------------------------
cat > /home/oracle/scripts/stop_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbshut \$ORACLE_HOME
EOF
=====================================================
chown -R oracle.oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh
- 安装GDS/GSM软件
#创建 gds 用户 【root 下操作】
useradd -g oinstall -G dba,oper gds
#gds用户的登录密码,后续登录要用,记着。
echo "123456" | passwd --stdin gds
#设置密码永不过期
chage -M -1 gds
chage -l gds
#创建安装目录
mkdir -p /u05/app/oracle/
chown -R gds:oinstall /u05/app/
chmod -R 775 /u05/app/
mkdir -p /u05/tmp/
chown -R gds:oinstall /u05/tmp/
chmod -R 775 /u05/tmp/
# 查看环境变量
su - gds
vim /home/gds/.bash_profile
source /home/gds/.bash_profile
cat /home/gds/.bash_profile
-------------------------------------------------------------------------
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
ORACLE_BASE=/u05/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/19.3.0/gsm_1; export ORACLE_HOME
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
export PATH=${PATH}:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export TEMP=/u05/tmp
export TMPDIR=/u05/tmp
umask 022
=================================================================
17 ORALE19.3开始安装前
#LINUX.X64_193000_db_home.zip
[oracle@xag100 oracle]$ mkdir $ORACLE_HOME -p
[oracle@xag100 oracle]$ cd $ORACLE_HOME
[oracle@xag100 db_1]$ pwd
/u01/app/oracle/product/19.3.0/db_1
[oracle@xag100 db_1]$ ls
LINUX.X64_193000_db_home.zip
#LINUX.X64_193000_gsm.zip
[gds@xag100 setup]$ pwd
/u05/tmp/setup
[gds@xag100 setup]$ ls
LINUX.X64_193000_gsm.zip