CentOS 7.9 安装 Oracle 11gR2

Posted flyfish225

tags:

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

CentOS 7.9 安装 Oracle 11gR2

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


一: 系统环境介绍

1.1 系统环境准备

1. 系统:
   centos7.9x64 mini 

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
172.16.10.18    flyfishsrvs08
172.16.10.19    flyfishsrvs09

-----------------

本次安装只安装第一台机器

系统关闭selinux ,firewalld,清空iptables防火墙

本次只在flyfishsrvs01上面安装

#关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

#关闭selinux

sed -i s/enforcing/disabled/ /etc/selinux/config  # 永久
setenforce 0  # 临时

#时间同步

yum install chronyd
server ntp1.aliyun.com

#系统修改
 vim /etc/redhat-release   [默认Oracle 是不支持centos的版本]

 ----
 Red Hat Enterprise Linux Server release 7.9 (Maipo)
 ----

1.2 系统初始化

1. 系统字符集

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

source ~/.bash_profile 

2. 设置Oracle相关目录

mkdir /u01 
mkdir /oradata 
mkdir /backup 
mkdir /archive 

3. 数据安装说需要的用户

groupadd -g 60001 oinstall 
groupadd -g 60002 dba 
groupadd -g 60003 oper

useradd -u 61001 -g oinstall -G dba,oper oracle 
echo oracle |passwd oracle --stdin

mkdir -p /u01 
mkdir -p /u01/app/oracle/product/11.2.0 
mkdir -p /u01/app/oraInventory 

chown -R oracle:oinstall /u01 
chown -R oracle:oinstall /oradata 
chown -R oracle:oinstall /backup 
chown -R oracle:oinstall /archive 

chmod -R 775 /u01 
chmod -R 775 /oradata 
chmod -R 775 /backup 
chmod -R 775 /archive 

4. Oracle 数据库安装所需依赖包

# From Public Yum or ULN 
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 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 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 
yum -y install unzip 
yum -y install *vnc*

5. 系统句柄数

vi /etc/security/limits.conf

----

#ORACLE SETTING 
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 hard memlock 8000000 
oracle soft memlock 8000000

-----

vi /etc/security/limits.d/20-nproc.conf 

---

* soft nproc 16384

---

6.系统极限数

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

7. 关闭内核心/内存缓冲页
cat /proc/meminfo 
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

8. 关闭透明大页

yum install numactl -y 

numactl --hardware 

vi /etc/default/grub 

----

numa=off 
----

grub2-mkconfig -o /etc/grub2.cfg

8.设置Oracle用户的系统环境变量

su - oracle

vi ~/.bash_profile
----
PS1="[`whoami`@`hostname`:"$PWD]$ 
export PS1 
export TMP=/tmp 
export LANG=en_US 
export TMPDIR=$TMP 
export ORACLE_UNQNAME=flyfishdb 
ORACLE_SID=flyfishdb; export ORACLE_SID 
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE 
ORACLE_HOME=$ORACLE_BASE/product/11.2.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/.local/bin:$HOME/bin:$ORACLE_BASE/product/11.2.0/db_1/b in:$ORACLE_HOME/bin; export PATH 
THREADS_FLAG=native; export THREADS_FLAG 
umask=022 
if [ $USER = "oracle" ]; 
then 
   if [ $SHELL = "/bin/ksh" ]; then 
   ulimit -u 16384 
   ulimit -n 65536 
   else
   ulimit -u 16384 -n 65536 
   fi    
 fi

DISPLAY=172.16.10.1:0.0

export DISPLAY
stty erase ^h

----

source .bash_profile

二:安装Oracle11gR2

su - root

mv /root/oracle-software /home/oracle/

chown oracle:oinstall /home/oracle/oracle-software

su - oracle 

cd oracle-software
 unzip linux.x64_11gR2_database_1of2.zip
 unzip linux.x64_11gR2_database_of2.zip

 cd database

./runInstaller -jreLoc /etc/alternatives/jre_1.8.0

检查一下系统中是否已经安装了这些包,这边已经安装,如果安装的版本比这个版本高可以忽略本次步骤


sh /tmp/CVU_11.2.0.1.0_oracle/runfixup.sh

以上报错:

在makefile中添加链接libnnz11库的参数
修改$ORACLE_HOME/sysman/lib/ins_emagent.mk,将
$(MK_EMAGENT_NMECTL)修改为:$(MK_EMAGENT_NMECTL) -lnnz11
建议修改前备份原始文件
cd $ORACLE_HOME/sysman/lib

cp ins_emagent.mk ins_emagent.mk.bak

vi ins_emagent.mk

----

 $(MK_EMAGENT_NMECTL) -lnnz11

-----

需要以root执行这两个脚本:
sh /u01/app/oraInventory/orainstRoot.sh
sh /u01/app/oracle/product/11.2.0/db_1/root.sh


1.3 配置 Oracle数据库监听

配置监听
netca


lsnrctl status

lsnrctl start  启动
lsnrctl stop   停止

1.4使用dbca 建库

su - oracle 

dbca


启动EM 管理工具

设置所有用户的密钥为Oracle

设置Oracle安装目录

1.5 登录到数据库

su - oracle 

sqlplus / as sysdba

1.6 数据监控EM

https://172.16.10.11:1158/em
用户名:sys
密钥: oracle 

以上是关于CentOS 7.9 安装 Oracle 11gR2的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7.3 安装Oracle 11gR2 64位

CentOS7安装Oracle 11gR2 安装

Centos6.5 安装 Oracle11gR2(64位)

centos6.7安装oracle11gR2安装步骤记录

Centos7安装Oracle 11gR2

Centos7 Minimal安装Oracle 11gR2