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 262144" >> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4194304 4194304 4194304" >> /etc/sysctl.conf
echo "kernel.panic_on_oops = 1" >>/etc/sysctl.conf
echo "Modifing the /etc/sysctl.conf has been succeed."
echo "Now make the changes take effect......."
sh 7.sh
7.sh脚本内容如下:
echo "NOZEROCONF=yes" >>/etc/sysconfig/network
sh 8.sh
8.sh脚本内容如下(安装oracle依赖包):
yum install -y binutils compat-libstdc++ elfutils-libelf elfutils-elf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
yum -y install compat-db*
yum -y install compat-libstdc*
yum -y install elfutils-libelf*
yum -y install *unzip*
yum -y install compat-libcap1*
yum -y install smartmontools
yum -y groupinstall "X Window System"
yum install -y cjkuni-uming-fonts
三、软件安装
1.上传oracle21c的安装包到虚拟机
安装包下载地址:https://www.oracle.com/database/technologies/oracle-database-software-downloads.html
上传安装包到虚拟机的任意目录下,如/oracle/backup,再移动到$ORACLE_HOME目录下:
mv LINUX.X64_213000_db_home.zip $ORACLE_HOME
也可以直接上传到$ORACLE_HOME目录。
解压:
[oracle@localhost /oracle/app/product/21c/db_1]$unzip LINUX.X64_213000_db_home.zip
解压完成后就可以把压缩包删除了。
运行xhost +命令,确保输出结果是access control disabled, clients can connect from any host,说明图形化界面可以成功显示。
如果运行xhost +命令出来的结果是unable to open display "192.168.56.111:0.0",可尝试运行export DISPLAY=:0命令
进入$ORACLE_HOME目录,调出图形化进行安装:
2.仅安装软件
3.单个实例
4.数据库版本,选择企业版
5.选择oracle base位置
6.创建日志位置
7.操作系统组
8.自动脚本选项,直接下一步
9.安装前检查
不通过的项,需点击 Fix & Check Again,按照提示解决。
10.安装选项总述,点击Install
11.使用root用户,执行这两个脚本,如下图所示
直接回车即可,点击OK
12.安装完成。点击close
软件安装结束。
四、监听配置
1.运行命令 netca
选择Listener configuration
2.添加
3.默认监听名,点击下一步
4.默认监听协议,点击下一步
5.使用默认监听端口1521
6.选择No
7.监听配置完成,点击下一步
8.配置服务名
9.添加服务名
10.输入服务名,如ora21c
11.服务名协议
12.服务名IP
13.不测试连接
14.创建服务名
15.选择No
16.结束配置
17.点击finish
五、创建实例
1. 创建数据库
运行命令dbca
[oracle@localhost /oracle/app/product/21c/db_1]$dbca
2.选择创建模式为advanced configuration
3.部署类型
4.库名与$ORACLE_SID变量保持一致
20c之后oracle不再支持非CDB,在dbca创建的过程发现【Create as Container database】已不能取消勾选,默认创建了CDB。
5.规划存放数据库数据文件目录
6.闪回选项,点击下一步即可
7.监听配置,点击下一步
8.直接点下一步
9.内存管理,选择手动管理内存
10.增大进程数到1000
11.注意:环境字符集选择utf-8,点击下一步
12.管理选择,点击下一步即可
13.用户认证,设置密码
14.创建选项,点下一步
15.创建总述,点击完成即可
16.等待创建完成
17.创建完成,点击close结束
六、测试连接
CentOS 7.6 测试环境安装ORACLE 21C
本文2024-09-22 20:21:33发表“eas cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-eas-113119.html