CentOS 7.6 测试环境安装ORACLE 21C

一、文档说明
本文基于virtualBox上的CentOS7.6安装Oracle21C,仅适用于虚拟机环境下测试使用。
Windows主机虚拟机:virtualBox
Linux远程连接工具:MobaXterm。
主机内存2G,硬盘至少预留15G用于安装Oracle数据库。
二、安装前准备
1.关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
2.关闭seLinux
[root@localhost ~]# vi /etc/selinux/config

3.创建Oracle用户与组
创建一个用户组oinstall:
groupadd oinstall
创建一个用户组dba:
groupadd dba
创建用户oracle 到主组oinstall,副组dba,主目录/oracle:
useradd -g oinstall -G dba -d /oracle oracle
如果oracle用户已经存在则:
usermod -g oinstall -G dba -d /oracle oracle
查看用户oracle的添加情况:
id oracle
4.运行以下脚本
sh 1.sh
1.sh脚本内容如下(设置Oracle用户环境变量):
echo "export ORACLE_SID=ora21c">> /home/oracle/.bash_profile
echo "export ORACLE_BASE=/oracle/app/db">> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=/oracle/app/product/21c/db_1'>> /home/oracle/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/oracle/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/oracle/.bash_profile
echo "The Environment for oracle also has been set successfully"
sh 2.sh
2.sh脚本内容如下(创建安装目录和设置文件权限):
mkdir -p /oracle/app/db
mkdir -p /oracle/app/product/21c/db_1
mkdir –p /oracle/oradata
chown -R oracle:oinstall /oracle
chmod -R 775 /oracle
echo "The necessary directory for oracle,grid users and change the authention to oracle,grid users has been finished"
sh 3.sh
3.sh脚本内容如下(修改用户的限制文件):
cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 10240" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "oracle hard memlock 14688227" >>/etc/security/limits.conf
echo "Modifing the /etc/security/limits.conf has been succeed."
sh 4.sh
4.sh脚本内容如下:
echo "Now modify the /etc/pam.d/login,but with a backup named /etc/pam.d/login.bak"
cp /etc/pam.d/login /etc/pam.d/login.bak
echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
echo "Modifing the /etc/pam.d/login has been succeed."
sh 5.sh
5.sh脚本内容如下:
echo "Now modify the /etc/profile,but with a backup named /etc/profile.bak"
cp /etc/profile /etc/profile.bak
echo 'if [ $USER = "oracle" ]||[ $USER = "grid" ]; then' >> /etc/profile
echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo 'ulimit -p 16384' >> /etc/profile
echo 'ulimit -n 65536' >> /etc/profile
echo 'else' >> /etc/profile
echo 'ulimit -u 16384 -n 65536' >> /etc/profile
echo 'fi' >> /etc/profile
echo 'fi' >> /etc/profile
echo "Modifing the /etc/profile has been succeed."
sh 6.sh
6.sh脚本内容如下:
echo "Now modify the /etc/sysctl.conf,but with a backup named /etc/sysctl.bak"
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmax = 1054472192" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 262144 262144 2
CentOS 7.6 测试环境安装ORACLE 21C
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。



