由于管理严格,通常拿不到root权限,但是启停crs还得用root,需要申请,走流程,麻烦!
想了想,是不是有个sudo命令可以不用root密码了?
到底哪些命令需要呢?查了查发现这个地方有些提示:
可以对以下命令设置sudo:
/u01/app/12.1.0/grid/bin/crsctl
/u01/app/12.1.0/grid/bin/appvipcfg
/u01/app/12.1.0/grid/bin/srvctl
/u01/app/12.1.0/grid/bin/acfsroot
/u01/app/12.1.0/grid/bin/acfsload
/u01/app/orainventory/orainstroot.sh
/u01/app/12.1.0/grid/root.sh
/u01/app/oracle/product/12.1.0/dbhome_1/root.sh
/u01/app/12.1.0/grid/opatch/opatchauto
好的,我准备编辑一下,通过visudo命令一运行,猜我看到了什么:
往下拉
## allow root to run any commands anywhere
oracle all=(all) all
grid all=(all) all
root all=(all) all
顿时内牛满面,都给你了还不知道,还申请个屁。
干他
[oracle@dbhost01 ~]$ ps -ef|grep d.bin
root 3060 1 0 jan05 ? 02:31:56 /u01/app/grid/11.2.0/bin/ohasd.bin reboot
grid 3466 1 0 jan05 ? 00:01:13 /u01/app/grid/11.2.0/bin/mdnsd.bin
grid 3505 1 0 jan05 ? 00:15:08 /u01/app/grid/11.2.0/bin/gpnpd.bin
grid 3545 1 0 jan05 ? 02:01:05 /u01/app/grid/11.2.0/bin/gipcd.bin
root 3557 1 1 jan05 ? 10:39:59 /u01/app/grid/11.2.0/bin/osysmond.bin
grid 3601 1 1 jan05 ? 07:39:50 /u01/app/grid/11.2.0/bin/ocssd.bin
root 4372 1 0 jan05 ? 02:22:31 /u01/app/grid/11.2.0/bin/octssd.bin reboot
grid 4394 1 0 jan05 ? 01:29:54 /u01/app/grid/11.2.0/bin/evmd.bin
root 4716 1 0 jan05 ? 03:42:36 /u01/app/grid/11.2.0/bin/crsd.bin reboot
oracle 10116 9560 0 17:21 pts/0 00:00:00 grep d.bin
[oracle@dbhost01 ~]$
sudo /u01/app/grid/11.2.0/bin/crsctl stop crs
[sudo] password for oracle:
crs-2791: starting shutdown of oracle high availability services-managed resources on 'dbhost01'
crs-2673: attempting to stop 'ora.crsd' on 'dbhost01'
crs-2790: starting shutdown of cluster ready services-managed resources on 'dbhost01'
crs-2673: attempting to stop 'ora.ocr_voting.dg' on 'dbhost01'
crs-2673: attempting to stop 'ora.registry.acfs' on 'dbhost01'
crs-2673: attempting to stop 'ora.arch.dg' on 'dbhost01'
crs-2673: attempting to stop 'ora.data.dg' on 'dbhost01'
crs-2673: attempting to stop 'ora.listener.lsnr' on 'dbhost01'
crs-2673: attempting to stop 'ora.listener_dg.lsnr' on 'dbhost01'
crs-2677: stop of 'ora.listener.lsnr' on 'dbhost01' succeeded
crs-2677: stop of 'ora.listener_dg.lsnr' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.dbhost01.vip' on 'dbhost01'
crs-2677: stop of 'ora.registry.acfs' on 'dbhost01' succeeded
crs-2677: stop of 'ora.arch.dg' on 'dbhost01' succeeded
crs-2677: stop of 'ora.data.dg' on 'dbhost01' succeeded
crs-2677: stop of 'ora.dbhost01.vip' on 'dbhost01' succeeded
crs-2672: attempting to start 'ora.dbhost01.vip' on 'dbhost02'
crs-2676: start of 'ora.dbhost01.vip' on 'dbhost02' succeeded
crs-2677: stop of 'ora.ocr_voting.dg' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.asm' on 'dbhost01'
crs-2677: stop of 'ora.asm' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.ons' on 'dbhost01'
crs-2677: stop of 'ora.ons' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.net1.network' on 'dbhost01'
crs-2677: stop of 'ora.net1.network' on 'dbhost01' succeeded
crs-2792: shutdown of cluster ready services-managed resources on 'dbhost01' has completed
crs-2677: stop of 'ora.crsd' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.crf' on 'dbhost01'
crs-2673: attempting to stop 'ora.ctssd' on 'dbhost01'
crs-2673: attempting to stop 'ora.evmd' on 'dbhost01'
crs-2673: attempting to stop 'ora.asm' on 'dbhost01'
crs-2673: attempting to stop 'ora.mdnsd' on 'dbhost01'
crs-2673: attempting to stop 'ora.drivers.acfs' on 'dbhost01'
crs-2677: stop of 'ora.crf' on 'dbhost01' succeeded
crs-2677: stop of 'ora.ctssd' on 'dbhost01' succeeded
crs-2677: stop of 'ora.mdnsd' on 'dbhost01' succeeded
crs-2677: stop of 'ora.evmd' on 'dbhost01' succeeded
crs-2677: stop of 'ora.drivers.acfs' on 'dbhost01' succeeded
crs-2677: stop of 'ora.asm' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.cluster_interconnect.haip' on 'dbhost01'
crs-2677: stop of 'ora.cluster_interconnect.haip' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.cssd' on 'dbhost01'
crs-2677: stop of 'ora.cssd' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.gipcd' on 'dbhost01'
crs-2677: stop of 'ora.gipcd' on 'dbhost01' succeeded
crs-2673: attempting to stop 'ora.gpnpd' on 'dbhost01'
crs-2677: stop of 'ora.gpnpd' on 'dbhost01' succeeded
crs-2793: shutdown of oracle high availability services-managed resources on 'dbhost01' has completed
crs-4133: oracle high availability services has been stopped.
[oracle@dbhost01 ~]$ ps -ef|grep d.bin
oracle 10797 9560 0 17:22 pts/0 00:00:00 grep d.bin
[oracle@dbhost01 ~]$
真香。