下面给你一份CentOS 下 Oracle 数据库(以 Oracle 11g / 19c 为例)常见安装配置思路,偏实战,步骤清晰,适合服务器环境。
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
yum install -y \
binutils compat-libcap1 compat-libstdc++-33 \
gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel \
libgcc libstdc++ libstdc++-devel make sysstat \
unixODBC unixODBC-devel
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
/etc/sysctl.conffs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmax = 4294967295
kernel.shmall = 1048576
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
执行:
sysctl -p
/etc/security/limits.conforacle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01
chmod -R 775 /u01
切换到 oracle 用户:
su - oracle
编辑 ~/.bash_profile:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
生效:
source ~/.bash_profile
./runInstaller
./runInstaller -silent \
-responseFile /path/db_install.rsp
安装完成后执行:
/u01/app/oraInventory/orainstRoot.sh
$ORACLE_HOME/root.sh
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname orcl -sid orcl \
-sysPassword Oracle123 \
-systemPassword Oracle123 \
-memoryPercentage 40 \
-storageType FS
lsnrctl start
sqlplus / as sysdba
startup
/etc/oratab
orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y
NLS_LANGlistener.ora / tnsnames.oraSGA/PGA如果你告诉我:
我可以直接给你一套精准步骤或一键脚本。