温馨提示×

linux oracle配置注意什么

小樊
62
2026-10-10 08:13:05
栏目: 云计算

在 Linux 上部署和配置 Oracle 数据库(以常见的 Oracle 11g/12c/19c 为例),需要注意以下关键方面,避免安装失败或后期运行不稳定。


一、系统准备

1. 操作系统版本

  • 确认 Oracle 版本支持的 Linux 发行版
    • Oracle Linux / RHEL / CentOS 常见支持
    • 内核版本符合要求(如 19c 对内核有最低要求)
  • 建议使用 Oracle Linux(官方支持最好)

2. 主机名与网络

  • 设置固定 IP(不要 DHCP)
  • 配置 /etc/hosts
    IP  主机名
    
  • 主机名不要包含下划线 _

3. 关闭不必要服务

  • 防火墙(测试环境可关,生产需开放端口)
    systemctl stop firewalld
    systemctl disable firewalld
    
  • SELinux 设为 disabled
    vi /etc/selinux/config
    SELINUX=disabled
    

二、用户与组

1. 创建 Oracle 用户和组

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

2. 目录规划

mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chmod -R 775 /u01

三、内核参数(非常重要)

编辑 /etc/sysctl.conf:

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmax = 4294967295
kernel.shmall = 2097152
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 nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768

确保 /etc/pam.d/login 包含:

session required pam_limits.so

五、依赖包安装

以 RHEL/CentOS 为例:

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

19c 还需 compat-libstdc++-33、libnsl 等


六、环境变量

~oracle/.bash_profile:

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

七、图形界面与安装

  • 安装可使用:
    • 静默安装(推荐服务器)
    • 图形安装(需 X11)
  • 使用 oracle 用户运行:
./runInstaller
  • 按提示执行 root.sh

八、监听与数据库

1. 监听

netca
lsnrctl status

2. 建库

dbca

九、常见坑点总结

⚠️ 注意事项:

  • 内存不足(建议 ≥ 2G,生产更大)
  • /tmp 空间不足(≥ 1G)
  • 字符集选择(避免后期乱码)
  • 不要使用 root 运行 Oracle
  • 时间同步(NTP)
  • 生产环境必须备份

如果你告诉我:

  • Oracle 版本(11g / 12c / 19c)
  • Linux 发行版和版本
  • 单机还是 RAC

我可以给你一份针对性的配置清单或静默安装模板。

0 踩