oracle 12c 自动启动

在很多的企业级应用中,数据库是其中非常重要的一个组成部分。Oracle Database作为一款非常重量级的数据库,在各种场景下都扮演着非常重要的角色。但是,在某些场景下,仅仅只是安装好Oracle数据库还不能够满足业务需求,常常还需要配置自动启动。

Oracle 12c提供了非常方便的自动启动解决方案。我们只需要在数据库安装之后,进行简单的配置,就可以让Oracle数据库随着系统自动启动。这在一些需要长时间运行的服务中非常有用,可以让应用及时响应请求。

那么,在Oracle 12c中,要怎样进行自动启动的配置呢?首先,我们需要为Oracle数据库创建一个启动脚本。这个脚本会负责启动Oracle数据库,并且安装到系统的服务列表中,这样就可以随时随地启动数据库。

# For usage with chkconfig on RedHat Linux 1. chkconfig: 35 80 30 1. description: Oracle auto start-stop script. 1. 1. Set ORACLE_HOME to be equivalent to the $ORACLE_HOME 1. from which you wish to execute dbstart and dbshut; 1. 1. Set ORACLE to the executable for dbstart and dbshut; 1. 1. Set the user and group IDs for UNIX/Linux 1. ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1 ORACLE=oracle PATH=$PATH:$ORACLE_HOME/bin HOST= hostnameif [ ! -f /etc/oratab ]; then echo "Expected file /etc/oratab does not exists. Please fix ORACLE_HOME and try again." exit 1 fi ORAENV_ASK=NO . oraenv > /dev/null case "$1" in 'start') echo -n "Starting Oracle: " su - $ORACLE -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" & echo "OK" ;; 'stop') echo -n "Shutting down Oracle: " su - $ORACLE -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" & echo "OK" ;; *) echo "Usage: $0 {start|stop}" exit 1 ;; esac