在Linux或Unix下我们通常都是手工启动数据库,当然也可以写脚本让OS在启动或关闭时来控制数据库的启动或关闭。下面帖一个关于启动db console的控制脚本
#!/sbin/runscript
# ----------------------------------------------------------------------
# File: dbconsole
#
# Purpose: Startup Oracle Enterprise Manager DB Console
# ----------------------------------------------------------------------
start() {
ebegin "Start Oracle Enterprise Manager DB Console"
ORACLE_HOME=/opt/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=ORA10G; export ORACLE_SID
ORACLE_OWNER=oracle; export ORACLE_OWNER
TNS_ADMIN=/home/oracle/config/10.2; export TNS_ADMIN
NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1; export NLS_LANG
ORA_NLS10=${ORACLE_HOME}/nls/data; export ORA_NLS10
CLASSPATH=${CLASSPATH}:${ORACLE_HOME}/jdbc/lib/classes12.zip
LD_LIBRARY_PATH=${ORACLE_HOME}/lib; export LD_LIBRARY_PATH
su $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole"
su $ORACLE_OWNER -c "$ORACLE_HOME/bin/isqlplusctl start"
eend $? "Failed to start Oracle Enterprise Manager DB Console."
}
stop() {
ebegin "Stopping Oracle Enterprise Manager DB Console"
ORACLE_HOME=/opt/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=ORA10G; export ORACLE_SID
ORACLE_OWNER=oracle; export ORACLE_OWNER
TNS_ADMIN=/home/oracle/config/10.2; export TNS_ADMIN
NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1; export NLS_LANG
ORA_NLS10=${ORACLE_HOME}/nls/data; export ORA_NLS10
CLASSPATH=${CLASSPATH}:${ORACLE_HOME}/jdbc/lib/classes12.zip
LD_LIBRARY_PATH=${ORACLE_HOME}/lib; export LD_LIBRARY_PATH
su $ORACLE_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
su $ORACLE_OWNER -c "$ORACLE_HOME/bin/isqlplusctl stop"
eend $? "Failed to stop Oracle Enterprise Manager DB Console."
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51988/,如需转载,请注明出处,否则将追究法律责任。