在Linux系统中设置Oracle权限涉及多个步骤,包括创建用户、分配权限、修改系统配置等。以下是详细的操作指南:
创建用户和组创建用户组:
groupadd oinstallgroupadd dba
创建用户并加入到相应的组:
useradd -g dba -m oracleusermod -a -G oinstall oraclepasswd oracle
修改系统配置修改 /etc/sysctl.conf
文件以优化系统性能:
fs.aio-max-nr 1048576fs.file-max 6815744kernel.shmmni 4096kernel.sem 25032000 100 128kernel.shmall 2097152kernel.shmmax 2147483648net.ipv4.ip_local_port_range 9000 65500net.ipv4.icmp_echo_ignore_broadcasts 1net.ipv4.conf.all.rp_filter 1net.core.rmem_default 262144net.core.rmem_max 4194304net.core.wmem_default 262144net.core.wmem_max 1048576
使配置生效:
sysctl -p
修改 /etc/security/limits.conf
文件以设置用户限制:
oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle 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" ]; thenif [ SHELL"/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fifi
使 /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;