一、ASM安装准备条件
1、ASM支持存储类型
本地祼设备(本地的磁盘和分区)
网络附加存储(NAS)
存储区域网络(SAN)
2、ASM使用本地裸设备,要点:
已经被挂载到操作系统上或者已经做了分区
映射裸设备为文件名
设置正确的权限(针对grid用户和asmadmin组,权限为660)
二、ORACLE单实例-ASM实验
1、操作系统环境准备
设置主机名
[root@oracle ~]# hostnamectl set-hostname oracle
[root@oracle ~]# hostname && hostname -i
oracle
192.168.31.52
[root@oracle ~]#
关闭selinuix
[root@oracle ~]# vi /etc/selinux/config
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
安装rpm包
yum install -y bc
yum install -y compat-libcap1*
yum install -y compat-libcap*
yum install -y binutils
yum install -y compat-libstdc++-33
yum install -y elfutils-libelf
yum install -y elfutils-libelf-devel
yum install -y gcc
yum install -y gcc-c++
yum install -y glibc-2.5
yum install -y glibc-common
yum install -y glibc-devel
yum install -y glibc-headers
yum install -y ksh libaio
yum install -y libaio-devel
yum install -y libgcc
yum install -y libstdc++
yum install -y libstdc++-devel
yum install -y make
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install -y libXp*
yum install -y glibc-kernheaders
yum install -y net-tools-*
yum install -y iscsi-initiator-utils
yum install -y udev
yum install -y xclock*推荐安装以下命令
yum install -y lrzsz
yum install -y rsync
yum install -y telnet
yum install -y vim
yum install -y curl
yum install -y wget
yum install -y openssh-server
yum install -y openssh-clients
yum install -y lsof
修改内核参数
vi /etc/sysctl.conf
kernel.shmmax = 277495689510912
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 = 67747971072
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
#net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
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
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2生成系统参数
sysctl -p
修改用户资源限制
vim /etc/security/limits.conf
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 134217728grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 16384
grid hard nproc 16384
grid soft stack 10240
grid hard stack 32768
grid hard memlock 134217728
grid soft memlock 134217728
修改/etc/pam.d/login--Linux-PAM认证方式
vim /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
/etc/pam.d/su内容详解_# uncomment the following line to implicitly trust-CSDN博客
修改环境变量
vim /etc/profile
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi#生成环境变量
source /etc/profile # 或者退出重进
创建oracle 和 grid 用户
groupadd -g 601 oinstall
groupadd -g 602 dba
groupadd -g 603 oper
groupadd -g 604 backupdba
groupadd -g 605 dgdba
groupadd -g 606 kmdba
groupadd -g 607 asmdba
groupadd -g 608 asmoper
groupadd -g 609 asmadmin
useradd -u 601 -g oinstall -G asmadmin,asmdba,dba,asmoper grid
useradd -u 602 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin,oper,asmdba oracle修改用户名密码
[root@oracle ~]# passwd grid
[root@oracle ~]# passwd oracle
passwd : Aa123321
使用root用户,创建目录,并进行赋权
1、创建Oracle Inventory 目录
[root@oracle ~]# mkdir -p /u01/app/oraInventory
[root@oracle ~]# chown -R grid:oinstall /u01/app/oraInventory
[root@oracle ~]# chmod -R 775 /u01/app/oraInventory
2、创建grid home目录[root@oracle ~]# mkdir -p /u01/app/grid
[root@oracle ~]# mkdir -p /u01/app/19c/grid
[root@oracle ~]# chown -R grid:oinstall /u01/app/grid
[root@oracle ~]# chmod -R 775 /u01/app/grid
[root@oracle ~]# chown -R grid:oinstall /u01/app/19c
[root@oracle ~]# chmod -R 775 /u01/app/19c/
3、创建Oracle Base目录[root@oracle ~]# mkdir -p /u01/app/oracle
[root@oracle ~]# mkdir /u01/app/oracle/cfgtoollogs
[root@oracle ~]# chown -R oracle:oinstall /u01/app/oracle
[root@oracle ~]# chmod -R 775 /u01/app/oracle
4、创建Oracle RDBMS Home目录
[root@oracle ~]# mkdir -p /u01/app/oracle/product/19c/db_1
[root@oracle ~]# chown -R oracle:oinstall /u01/app/oracle/product/19c/db_1
[root@oracle ~]# chmod -R 775 /u01/app/oracle/product/19c/db_1
设置grid环境变量
vim ~/.bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$'
export PS1
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19c/grid
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
export THREADS_FLAG=native
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
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap asmcmd'环境变量生效
source ~/.bash_profile
设置oracle环境变量
vim ~/.bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$'
export PS1
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19c/db_1
export ORACLE_SID=orcl
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/19c/db_1/bin:$ORACLE_HOME/bin
export 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
fialias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
环境变量生效
source ~/.bash_profile #或者退出重进