1、修改文件系統,使文件系統支持ACL功能。sql
1)執行mount命令,獲得如下輸出:shell
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
2)執行 mount -o remount,acl/,而後效果以下:bash
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw,acl) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
2、編寫oracle腳本,內容以下:oracle
1)主腳本:oracle.shapp
#/bin/bash # Oracle database server # create 2012-10-31 # author 87008170@163.com SHELLHOME=/BBS_SHELL function dbstart(){ su - oracle -c $SHELLHOME/.oracle_start.sh } function dbstop(){ su - oracle -c $SHELLHOME/.oracle_stop.sh } echo "Log information see the file /tmp/oracle.log!" case $1 in "start") dbstart ;; "stop") dbstop ;; "restart") dbstop echo "Please wait 10s!" sleep 10 echo -e "Database is starting! \n" dbstart ;; *) echo "Usage $0 { start | stop | restart }" ;;
2) 啓動腳本:.oracle_start.shrest
#!/bin/bash LOGPATH=/tmp/oracle.log echo "================$(date)=================" >> $LOGPATH sqlplus >> $LOGPATH 2>&1 <<EOF connect / as sysdba startup exit EOF lsnrctl start >> $LOGPATH 2>&1 echo "================$(date)=================" >> $LOGPATH
3) 中止腳本:.oracle_stop.shcode
#!/bin/bash LOGPATH=/tmp/oracle.log echo "================$(date)=================" >> $LOGPATH sqlplus >> $LOGPATH 2>&1 <<EOF connect / as sysdba shutdown immediate exit EOF lsnrctl stop >> $LOGPATH 2>&1 echo "================$(date)=================" >> $LOGPATH
3、設置腳本ACL,執行如下命令:orm
setfacl -m u:oracle:rx .oracle_start.sh setfacl -m u:oracle:rx .oracle_stop.sh