在Debian系统中设置Oracle的安全配置涉及多个步骤,以下是一个基本的指南:
安装和配置Oracle数据库:
设置主机名和hosts映射:
hostnamectl set-hostname oracle
设置主机名。/etc/hosts
文件,添加主机名和IP地址的映射。创建用户和用户组:
groupadd -g 54321 oinstall
groupadd -g 54322 dbagroup
groupadd -g 54323 opergroup
groupadd -g 54324 backupdbagroup
groupadd -g 54325 dgdbagroup
groupadd -g 33061 racdbauser
useradd -u 54321 -g oinstall oracle
echo "oracle" | passwd oracle --stdin
设置安全限制:
/etc/security/limits.d/30-oracle.conf
文件,设置Oracle用户的安全限制:cat <<EOF > /etc/security/limits.d/30-oracle.conf
Oracle soft nofile 1024
Oracle hard nofile 65536
Oracle soft nproc 16384
Oracle hard nproc 16384
Oracle soft stack 10240
Oracle hard stack 32768
Oracle hard memlock 134217728
Oracle soft memlock 134217728
EOF
设置环境变量:
/etc/profile
文件,为Oracle用户设置环境变量:cat <<EOF > /etc/profile
if [ USER "oracle" ]; then
if [ SHELL "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
source /etc/profile
修改Linux内核参数:
/etc/sysctl.d/98-oracle.conf
文件,修改内核参数:cat <<EOF > /etc/sysctl.d/98-oracle.conf
fs.file-max 6815744
kernel.sem 250 32000 100 128
kernel.shmmni 4096
kernel.shmall 1073741824
kernel.shmmax 4398046511104
kernel.panic_on_oops 1
net.core.rmem_default 262144
net.core.rmem_max 4194304
net.core.wmem_default 262144
net.core.wmem_max 1048576
net.ipv4.conf.all.rp_filter 2
net.ipv4.conf.default.rp_filter 2
fs.aio-max-nr 1048576
net.ipv4.ip_local_port_range 9000 65500
EOF
sysctl --system
创建Oracle数据库目录:
mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
mkdir -p /u01/oradata
chown -R oracle:oinstall /u01
chmod -R 775 /u01
配置防火墙:
apt update
apt install ufw
ufw allow OpenSSH
ufw enable
定期更新和维护:
apt update
和 apt upgrade
命令,确保系统和软件包保持最新。通过以上步骤,您可以在Debian系统中完成Oracle数据库的基本安全设置。请根据实际需求和环境调整配置。