首页 > 数据库 > Oracle > 配置Oracle单实例随机启动(11gR2)
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database software.
ORA_OWNER=oracle
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
# Remove "&" if you don't want startup as a background process.
su $ORA_OWNER -c "/home/oracle/scripts/startup.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" &
touch /var/lock/subsys/dbora
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su $ORA_OWNER -c "/home/oracle/scripts/shutdown.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1"
rm -f /var/lock/subsys/dbora
;;
esac
chmod 750 /etc/init.d/dbora
chkconfig --add dbora
# mkdir -p /home/oracle/scripts # chown oracle.oinstall /home/oracle/scripts
#!/bin/bash
export TMP=/tmp
export TMPDIR=$TMP
export PATH=/usr/sbin:/usr/local/bin:$PATH export ORACLE_HOSTNAME=localhost.localdomain
export ORACLE_UNQNAME=phyprimary
export ORACLE_SID=phyprimary ORAENV_ASK=NO
. oraenv
ORAENV_ASK=YES
# Start Listener
lsnrctl start
# Start Database
sqlplus / as sysdba << EOF
STARTUP;
EXIT;
EOF
#!/bin/bash
export TMP=/tmp
export TMPDIR=$TMP
export PATH=/usr/sbin:/usr/local/bin:$PATH export ORACLE_HOSTNAME=localhost.localdomain
export ORACLE_UNQNAME=phyprimary
export ORACLE_SID=phyprimary ORAENV_ASK=NO
. oraenv
ORAENV_ASK=YES
# Stop Database
sqlplus / as sysdba << EOF
SHUTDOWN IMMEDIATE;
EXIT;
EOF
# Stop Listener
lsnrctl stop
# service dbora start # service dbora stop
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29734436/viewspace-1257948/ ,如需转载,请注明出处,否则将追究法律责任。