在Linux系統中設置Oracle權限涉及多個步驟,包括創建用戶、分配權限、修改系統配置等。以下是詳細的操作指南:
創建用戶組:
groupadd oinstall
groupadd dba
創建用戶并加入到相應的組:
useradd -g dba -m oracle
usermod -a -G oinstall oracle
passwd oracle
修改 /etc/sysctl.conf
文件以優化系統性能:
fs.aio-max-nr 1048576
fs.file-max 6815744
kernel.shmmni 4096
kernel.sem 25032000 100 128
kernel.shmall 2097152
kernel.shmmax 2147483648
net.ipv4.ip_local_port_range 9000 65500
net.ipv4.icmp_echo_ignore_broadcasts 1
net.ipv4.conf.all.rp_filter 1
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
修改 /etc/pam.d/login
文件:
vi /etc/pam.d/login
添加以下內容:
session required /lib/security/pam_limits.so
修改 /etc/profile
文件:
vi /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
使 /etc/profile
更改立即生效:
source /etc/profile
使用 GRANT
語句為用戶分配權限,例如:
grant connect, resource to test_user;
使用 REVOKE
語句撤銷用戶權限,例如:
revoke connect from test_user;
create role myrole;
grant create session to myrole;
grant myrole to zhangsan;