Configure auto-start for Oracle Database startup
Every time the database server is restarted, it is necessary to restart the database listening and instances, especially when the server is powered off and restarted and routinely maintained. Can I enable the instance and listener as the service starts on a Windows server? The answer is yes, of course. We can use the dbstart file provided by Oracle to set auto-start for Oracle Database startup. The setting method is as follows:
(1) first, make sure that environment variables such as ORACLE_HOME have been configured, similar to the following:
12345 |
vi .bash_profile ORACLE_BASE=/u01/app/oracle ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 PATH=$ORACLE_HOME/bin:$PATH export ORACLE_BASE ORACLE_HOME PATH |
(2) edit the dbstart file in the $ ORACLE_HOME/bin directory, find ORACLE_HOME_LISTNER = $1, and change it to ORACLE_HOME_LISTNER = $ ORACLE_HOME.
(3) edit the oratab file in the/etc directory, find orcl:/u01/app/oracle/product/11.2.0/db_1: N, and change it to orcl: /u01/app/oracle/product/11.2.0/db_1: Y.
(4) edit the rc. local Startup file in the/etc/rc. d directory and add the database self-starting script dbstart. Note: This step must be switched to the root identity for execution.
12345 |
vi /etc/rc.d/rc.local # Start database listening. quotation marks are required for spaces su - oracle -lc "/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start" # Starting an instance su - oracle -lc /u01/app/oracle/product/11.2.0/db_1/bin/dbstart |
(5) restart and check whether the configuration is successful.