下面给你一份**在 Linux 上配置 Oracle 数据库(以 Oracle 19c 为例,适用于 RHEL / CentOS / Oracle Linux)**的系统性步骤。如果你用的是 11g / 12c,流程类似,只是部分参数和版本不同。
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01
chmod -R 775 /u01
编辑 /etc/sysctl.conf:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
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 = 1048576
执行:
sysctl -p
编辑 /etc/security/limits.conf:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
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
切换到 oracle 用户:
su - oracle
编辑 ~/.bash_profile:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.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
LINUX.X64_193000_db_home.zip)$ORACLE_HOMEunzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
cd $ORACLE_HOME
./runInstaller
安装过程:
dbca
或静默方式:
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname orcl -sid orcl \
-responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword Oracle123 \
-systemPassword Oracle123
sqlplus / as sysdba
startup;
exit;
监听:
lsnrctl start
lsnrctl status
编辑 /etc/oratab:
orcl:/u01/app/oracle/product/19.0.0/dbhome_1:Y
使用 dbstart / dbshut 或 systemd 管理。
hostname 和 /etc/hostsAL32UTF8如果你愿意,可以告诉我:
我可以给你更精确的一步到位方案。