How to automatically run a script for Oracle 10 GB on solaris 10

Source: Internet
Author: User

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:

 
 
  1. -bash-3.00$ dbstart  
  2. ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener  
  3. 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,

 
 
  1. -bash-3.00$ dbstart  
  2. -bash-3.00$ ps -aef | grep ora | grep -v grep  
  3. oracle 964 552 0 06:40:17 pts/1 0:00 ps -aef  
  4. oracle 552 546 0 06:08:08 pts/1 0:00 -bash  
  5. 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:

 
 
  1. 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 &.

 
 
  1. -bash-3.00$ dbstart  
  2. Processing Database instance "sery": log file /opt/oracle/product/10.2/db_1/startup.log  
  3. -bash-3.00$ ps -eaf | grep ora  
  4. oracle 1175 1 0 06:54:35 ? 0:00 ora_j001_sery  
  5. oracle 1173 1 1 06:54:35 ? 0:01 ora_j000_sery  
  6. oracle 1179 1 0 06:54:35 ? 0:00 ora_j003_sery  
  7. 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:

 
 
  1. #!/bin/bash  
  2. 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:

 
 
  1. #!/bin/bash  
  2. 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.