CentOS 7.9x64 配置ASM安装 Oracle 12cR1

Posted flyfish225

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7.9x64 配置ASM安装 Oracle 12cR1相关的知识,希望对你有一定的参考价值。

CentOS 7.9x64 配置ASM安装 Oracle 12cR1

标签(空格分隔): oracle 系列

1. 系统环境初始化

1.1 系统介绍

1. 系统:
  CentOS7.9x64

2. 主机名:

cat /etc/hosts 

----

172.16.10.11    flyfishsrvs01
172.16.10.12    flyfishsrvs02
172.16.10.13    flyfishsrvs03
172.16.10.14    flyfishsrvs04
172.16.10.15    flyfishsrvs05
172.16.10.16    flyfishsrvs06
172.16.10.17    flyfishsrvs07

----

本次安装flyfishsrvs04 主机 安装Oracle12R2 

1.2 系统初始化

echo "export LANG=en_US.UTF8" >>  ~/.bash_profile

cat ~/.bash_profile
source ~/.bash_profile

/usr/sbin/groupadd -g 60001 oinstall
/usr/sbin/groupadd -g 60002 dba
/usr/sbin/groupadd -g 60003 oper
/usr/sbin/groupadd -g 60004 backupdba
/usr/sbin/groupadd -g 60005 dgdba
/usr/sbin/groupadd -g 60006 kmdba
/usr/sbin/groupadd -g 60007 asmdba
/usr/sbin/groupadd -g 60008 asmoper
/usr/sbin/groupadd -g 60009 asmadmin

useradd -u 61001 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,oper oracle  
useradd -u 61002 -g oinstall -G asmadmin,asmdba,asmoper,dba grid  

echo grid |passwd grid --stdin 

echo oracle |passwd oracle --stdin 

mkdir -p /u01/app/grid
mkdir -p /u01/app/12.2/grid
chown -R oracle:oinstall /u01

mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle

mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01

系统依赖包

yum -y install autoconf 
yum -y install automake 
yum -y install binutils
yum -y install binutils-devel 
yum -y install bison 
yum -y install cpp 
yum -y install dos2unix 
yum -y install ftp 
yum -y install gcc 
yum -y install gcc-c++ 
yum -y install lrzsz 
yum -y install python-devel 
yum -y install compat-db* 
yum -y install compat-gcc-34 
yum -y install compat-gcc-34-c++ 
yum -y install compat-libcap1
yum -y install compat-libstdc++-33 
yum -y install compat-libstdc++-33.i686
yum -y install glibc-* 
yum -y install glibc-*.i686 
yum -y install libXpm-*.i686 
yum -y install libXp.so.6 
yum -y install libXt.so.6 
yum -y install libXtst.so.6 
yum -y install libXext
yum -y install libXext.i686
yum -y install libXtst 
yum -y install libXtst.i686
yum -y install libX11
yum -y install libX11.i686
yum -y install libXau
yum -y install libXau.i686
yum -y install libxcb
yum -y install libxcb.i686
yum -y install libXi
yum -y install libXi.i686
yum -y install libXtst
yum -y install libstdc++-docs
yum -y install libgcc_s.so.1
yum -y install libstdc++.i686
yum -y install libstdc++-devel
yum -y install libstdc++-devel.i686
yum -y install libaio
yum -y install libaio.i686
yum -y install libaio-devel
yum -y install libaio-devel.i686
yum -y install ksh 
yum -y install libXp 
yum -y install libaio-devel 
yum -y install numactl 
yum -y install numactl-devel 
yum -y install make -y
yum -y install sysstat -y
yum -y install unixODBC 
yum -y install unixODBC-devel 
yum -y install elfutils-libelf-devel-0.97 
yum -y install elfutils-libelf-devel
yum -y install redhat-lsb-core

vi /etc/security/limits.conf

#ORACLE SETTING
grid                 soft    nproc   16384 
grid                 hard    nproc   16384
grid                 soft    nofile  65536
grid                 hard    nofile  65536
grid                soft   stack    32768
grid                hard   stack    32768
oracle               soft    nproc   16384
oracle               hard    nproc   16384
oracle               soft    nofile  65536
oracle               hard    nofile  65536
oracle              soft   stack    32768
oracle               hard   stack    32768
oracle               hard    memlock 6000000
oracle               soft    memlock  6000000

echo "session    required     pam_limits.so" >> /etc/pam.d/login

cat /etc/pam.d/login

vi /etc/sysctl.conf

#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
kernel.panic_on_oops = 1
kernel.shmmax = 5033164800
kernel.shmall = 1228800
kernel.shmmni = 4096
vm.nr_hugepages = 2500
sysctl -p

cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never

cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never

vi /etc/rc.d/rc.local

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi

chmod +x /etc/rc.d/rc.local

yum install numactl -y

numactl --hardware

vi /etc/default/grub

numa=off

grub2-mkconfig -o /etc/grub2.cfg

numactl --hardware

systemctl set-default multi-user.target

vi /etc/fstab
none     /dev/shm       tmpfs   defaults,size=6144m        0 0

mount -o remount /dev/shm

echo "SELINUX=disabled" > /etc/selinux/config
echo "#SELINUXTYPE=targeted " >> /etc/selinux/config
setenforce 0

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service

ASM 环境变量:

PS1="[`whoami`@`hostname`:"$PWD]$
export PS1
umask 022
#alias sqlplus="rlwrap sqlplus"
export TMP=/tmp
export LANG=en_US.UTF8
export TMPDIR=$TMP
export TZ=Asia/Shanghai
ORACLE_SID=+ASM; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/12.2/grid; export ORACLE_HOME
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
PATH=$PATH:$HOME/.local/bin:$HOME/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

DISPLAY=172.16.10.1:0.0     
export DISPLAY

stty erase ^h 

Oracle 环境变量

PS1="[`whoami`@`hostname`:"$PWD]$
#alias sqlplus="rlwrap sqlplus"
#alias rman="rlwrap rman"
export PS1
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export TZ=Asia/Shanghai
export ORACLE_UNQNAME=flyfishdb
ORACLE_SID=flyfishdb; export ORACLE_SID
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2/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.UTF8;export NLS_LANG
PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_BASE/product/12.2/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

DISPLAY=172.16.10.1:0.0     
export DISPLAY

stty erase ^h 

2. Oracle ASM 部署实施

2.1 Oracle asm安装包准备

安装依赖包:
yum install -y bind-utils compat-libcap1 glibc-devel ksh libaio-devel libstdc++-devel nfs-utils psmisc smartmontools xorg-x11-utils xorg-x11-xauth elfutils-libelf-devel ksh libaio-devel ncurses-devel readline-devel zlib-devel gcc-c++ 
这几个包去 Oracle Linux 7.9x64 iso 里面提取
compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm  
kmod-oracleasm-2.0.8-28.0.1.el7.x86_64.rpm   
oracleasmlib-2.0.12-1.el7.x86_64.rpm             
oracleasm-support-2.1.11-2.el7.x86_64.rpm

下面这几个包去Oracle 官网下
oracleasmlib-2.0.12-1.el7.x86_64.rpm

下载地址:
   https://www.oracle.com/linux/downloads/linux-asmlib-v7-downloads.html
 rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm 

 rpm -ivh kmod-oracleasm-2.0.8-28.0.1.el7.x86_64.rpm

 rpm -ivh oracleasm-support-2.1.11-2.el7.x86_64.rpm

 rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm

oracleasm --help 

添加一块磁盘:

fdisk /dev/sdb

分区不用格式化 /dev/sdb1

新建ASM磁盘
oracleasm configure -i

 oracleasm init

 oracleasm createdisk DISK0 /dev/sdb1

 oracleasm listdisks

2.2 配置ASM grid

su - oracle

unzip linuxamd64_12102_grid_1of2.zip 
unzip linuxamd64_12102_grid_2of2.zip 

加载grid-env.sh

. ./grid-env.sh 

安装ASM 
cd /home/oracle/grid
./runInstaller

冗余方式选择——
● normal:相同的数据在磁盘中至少存储两份;
● high:存储三份;
● external:不提供冗余。
● AU size:分配单元的大小。

因为我们这边只有一块所以具选external 不提供冗余

密钥相同都用Oracle

sh /u01/app/oraInventory/orainstRoot.sh

sh /u01/app/12.2/grid/root.sh

3. 安装 Oracle 12c

加载 Oracle 12c 环境变量

source .bash_profile 

env |grep ORA 

su - oracle 

unzip linuxamd64_12102_database_1of2.zip

unzip linuxamd64_12102_database_2of2.zip

cd database 

./runInstaller

Oracle 12c 安装完成 

4. 创建数据库

netca 

5. 系统配置

登录数据库

su - oracle 

sqlplus  / as sysdba 

以上是关于CentOS 7.9x64 配置ASM安装 Oracle 12cR1的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7.9升级内核并设置默认启动

CentOS 6.5安装 ASM lib

小知识点:Mac M1/M2 VMware Fusion 安装 Centos 7.9(ARM 64 版本)

RedHat 6.8 64位安装ASM

CentOS 7.9 安装 Oracle 11gR2

Python学习笔记:CentOS 7.9安装配置pyenvpipipython和jupyter