由于管理严格,通常拿不到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 ~]$
真香。