增加sudo用户访问oracle
增加zgy用户可以访问数据库
[root@DBDATA ~]# useradd zgy
--设置密码
[root@DBDATA ~]# passwd zgy
--设置组
[root@DBDATA ~]# usermod -G oinstall,dba zgy
--环境变量
[root@DBDATA ~]# cp ~oracle/.bash_profile ~zgy/.bash_profile
--yes
--生效
[root@DBDATA ~]# source ~zgy/.bash_profile
[root@DBDATA ~]# su - zgy
[zgy@DBDATA ~]$ sqlplus / as sysdba
...
--如下增加oracle,zgy两个用户
sudo vi /etc/sudoers
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
zgy ALL=(ALL) ALL --这个给的权限比较大些
[zgy@DBDATA ~]$ sql
SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 18 15:04:19 2019
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SELECT STATUS FROM GV$INSTANCE ;
STATUS
------------------------------------
OPEN
Elapsed: 00:00:00.00