在CentOS上安装和配置Oracle数据库是一个复杂的过程,涉及多个步骤和配置。以下是一个详细的指南,帮助你在CentOS上成功安装和配置Oracle数据库。
/etc/redhat-release 文件,将内容修改为类似于 Red Hat Enterprise Linux 7.x (Core),然后保存并退出。关闭防火墙:
sudo systemctl stop firewalld
sudo systemctl disable firewalld
临时关闭SELinux:
sudo setenforce 0
永久关闭SELinux,编辑 /etc/selinux/config 文件,将 SELINUX=enforcing 改为 SELINUX=disabled。
创建 oinstall 和 dba 组:
sudo groupadd oinstall
sudo groupadd dba
创建Oracle用户并设置密码:
sudo useradd -g oinstall -G dba oracle
sudo passwd oracle
编辑 /etc/security/limits.conf 文件,为Oracle用户设置资源限制:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
编辑 /home/oracle/.bashrc 文件,添加以下内容:
export ORACLE_BASE=/data/tools/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/lib64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export LANG=en_US.UTF-8
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
使更改生效:
source /home/oracle/.bashrc
从Oracle官网下载适用于Linux的Oracle数据库安装包,并上传到服务器。
解压安装包到指定目录,例如 /tmp:
unzip linux.x64_11gR2_database_1of2.zip -d /tmp
unzip linux.x64_11gR2_database_2of2.zip -d /tmp
编辑 /etc/sysctl.conf 文件,添加或修改以下参数:
fs.aio-max-nr 1048576
fs.file-max 6815744
kernel.shmall 2097152
kernel.shmmni 4096
kernel.sem 250 32000 100 128
kernel.shmmax 2147483648
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 1048576
使配置生效:
sudo sysctl -p
。