Oracle 10g runs scripts automatically under solaris 10, Solaris 10 uses SMF service management facilities) to centrally manage various systems and network services, the purpose is to reduce the difficulty of system management and the probability of system errors.
Practice has shown that it is still very troublesome to configure and manage services through the SMF management platform. For example, to configure a third-party software customized and installed by a user to SMF for management, we need to do a lot of work. In addition, if a service fails, it will involve both the service itself and the SMF, which increases the difficulty of recovery. Personal bias: the goal of system management is the simpler the better-easy deployment, simple maintenance, and fast recovery. Just as there is an oracle 10g in the solaris 10 system, we will use it as an example to configure an Oracle 10g automatic run script under solaris 10.
First introduce the system environment:
SunOS sery 5.10 Generic_118855-33 i86pc i386 i86pc
Oracle version racle Database 10g Enterprise Edition Release 10.2.0.2.0-Prod
Oracle installation path/opt/oracle/product/10.2/db_1
Dbstart path/opt/oracle/product/10.2/db_1/bin/dbstart
Oracle comes with a script dbstart, which is used to create an automatic script for running Oracle 10 Gb under solaris 10. Before starting an oracle instance, run the script dbstart:
- -bash-3.00$ dbstart
- ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
- Usage: /opt/oracle/product/10.2/db_1/bin/dbstart ORACLE_HOME
The prompt "ORACL_HOME_LISTNER" is not set, and the usage of this command is given. Use ps-aef | grep ora to check whether oracle-related processes are up. Oh, no! Modify the file dbstart and find the ORACL_HOME_LISTNER line. It only has one row.) its default value is "$1", which indicates accepting a location parameter, since the program needs to manually add the location parameter ORACLE_HOME, we may replace "$1" with "ORACLE_HOME", that is, ORACLE_HOME_LISTNER = $1-à ORACLE_HOME_LISTNER = $ ORACLE_HOME, save and run the script dbstart,
- -bash-3.00$ dbstart
- -bash-3.00$ ps -aef | grep ora | grep -v grep
- oracle 964 552 0 06:40:17 pts/1 0:00 ps -aef
- oracle 552 546 0 06:08:08 pts/1 0:00 -bash
- oracle 696 1 0 06:22:25 ? 0:00 /opt/oracle/product/10.2/db_1/bin/tnslsnr LISTENER –inherit
The listener is up.
But there is no oracle process, and only the oracle listener is up. There is also a file/var/opt/oracle/oratab to be modified. This file is created by manually executing root. sh during oracle installation. Open this file and there is only one valid configuration line. The output on a system is as follows:
- sery:/opt/oracle/product/10.2/db_1:N
According to the annotation prompt, we need to change the value of the last field with the colon ":" As the field delimiter) from "N" to "Y". Save and execute dbstart &.
- -bash-3.00$ dbstart
- Processing Database instance "sery": log file /opt/oracle/product/10.2/db_1/startup.log
- -bash-3.00$ ps -eaf | grep ora
- oracle 1175 1 0 06:54:35 ? 0:00 ora_j001_sery
- oracle 1173 1 1 06:54:35 ? 0:01 ora_j000_sery
- oracle 1179 1 0 06:54:35 ? 0:00 ora_j003_sery
- oracle 1177 1 0 06:54:35 ? 0:00 ora_j002_sery
...... Omitted output)
The oracle instance is running. Based on this experience, we modified the file dbshut by the way.
When everything is ready, you can start writing automatic scripts at the running level. Create the file/etc/rc3.d/S33dbstart in the running level 3 directory. The content is as follows:
- #!/bin/bash
- su - oracle -c /opt/oracle/product/10.2/db_1/bin/dbstart&
-C command will not execute this script.
Save and grant it the execution permission. Similarly, create the file/etc/rcS. d/K33dbshut in the directory of runtime level S. The file content is as follows:
- #!/bin/bash
- su - oracle -c /opt/oracle/product/10.2/db_1/bin/dbshut &
Run init 6 to restart solaris 10 to check whether the oracle instance and listener are running properly. Of course, there are still many steps to complete if SMF is used to manage oracle services without running level, if you are interested, you can try the above content to introduce the automatic running script of Oracle 10g under solaris 10. I hope you will get something.