How does one automatically start the Oracle and ArcSDE services in Linux?

Source: Internet
Author: User
In fact, the main problem is to automatically start the Oracle service. There are also many examples on the Internet, but the success may not be achieved according to the example, next, let's take a look at the issues in the configuration process based on my actual operations. 1: Modify the Oracle system configuration file etcoratab [root @ localhost ~] # Vietcoratab

In fact, the main problem is to automatically start the Oracle service. There are also many examples on the Internet, but the success may not be achieved according to the example, next, let's take a look at the issues in the configuration process based on my actual operations. 1: Modify the Oracle system configuration file/etc/oratab [root @ localhost ~] # Vi/etc/oratab

In fact, the main problem is to automatically start the Oracle service. There are also many examples on the Internet, but the success may not be achieved according to the example, next, let's take a look at the issues in the configuration process based on my actual operations.

1: Modify the Oracle system configuration file/etc/oratab

[root@localhost ~]# vi /etc/oratab
Check the following content. If Oracle is installed, the configuration file will automatically identify ORACLE_HOME

However, the default value is orcl:/opt/oracle/product/11.2.0/dbhome_1: N. You only need to change it to Y as follows:

# This file is used by ORACLE utilities.  It is created by root.sh# and updated by the Database Configuration Assistant when creating# a database.# A colon, ':', is used as the field terminator.  A new line terminates# the entry.  Lines beginning with a pound sign, '#', are comments.## Entries are of the form:#   $ORACLE_SID:$ORACLE_HOME:
 
  :## The first and second fields are the system identifier and home# directory of the database respectively.  The third filed indicates# to the dbstart utility that the database should , "Y", or should not,# "N", be brought up at system boot time.## Multiple entries with the same $ORACLE_SID are not allowed.##orcl:/opt/oracle/product/11.2.0/dbhome_1:Y
 

2: Write service scripts

You can create an Oracle configuration file in the/etc/rc. d/init. d folder.

Edit the file.

[root@localhost ~]# vi /etc/rc.d/init.d/oracle
Enter the following information.

#!/bin/bash##chkconfig:345 99 10#description: StartupScriptfororacleDatabases#/etc/rc.d/init.d/oradbstartexport ORACLE_BASE=/opt/oracle/export ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1export ORACLE_SID=orclexport SDEHOME=/home/arcsde/sdeexe100export PATH=$PATH:$ORACLE_HOME/bin:$SDEHOME/bincase "$1" instart)echo "-----startup oracle-----">>/var/log/oracle11logsu - oracle -c $ORACLE_HOME/bin/dbstarttouch /var/lock/subsys/oracle11echo "-----startup oracle successful-----">>/var/log/oracle11logecho "OK"su - arcsde  -c "sdemon -o start -p sde";;stop)echo "-----shutdown oracle-----">>/var/log/oracle11logsu - oracle -c $ORACLE_HOME/bin/dbshutrm -f /var/lock/subsys/oracle11echo "-----shutdown oracle successful-----">>/var/log/oracle11logecho "OK";;*)echo "Usage:'basename$0'start|stop"exit 1esacexit 0export  ORACLE_SID=orclexport  PATH=$PATH:$ORACLE_HOME/bincase "$1" instart)echo "-----startuporacle-----">>/var/log/oracle11logsu - oracle -c $ORACLE_HOME/bin/dbstarttouch/var/lock/subsys/oracle11echo "-----startuporaclesuccessful-----">>/var/log/oracle11logecho "OK";;stop)echo "-----shutdwnoracle-----">>/var/log/oracle11logsu - oracle -c $ORACLE_HOME/bin/dbshutrm -f /var/lock/subsys/oracle11echo "-----shutdownoraclesuccessful-----">>/var/log/oracle11logecho "OK";;*)echo "Usage:'basename$0'start|stop"exit1esacexit0
Note:

1: You need to compare and modify your own environment variables and names.

2: in particular, some users can directly edit the file in Windows and then upload the file to the relevant Linux location. This is a problem.

See http://wenku.baidu.com/view/455f66eb19e8b8f67c1cb9df.html

You can either edit the codes in Linux or convert the codes using the editing software after editing in windows.

You can also use the dos2unix file name for conversion.

3: note that the file contains spaces such as su-oracle and echo "----

After editing, You need to modify the related permissions.

[root@localhost ~]# chmod 755 /etc/rc.d/init.d/oracle


3. Establish a service connection
When the system starts the database, we need the following link:
    [root@localhost ~]# ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc2.d/S99oracle    [root@localhost ~]# ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc3.d/S99oracle    [root@localhost ~]# ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc5.d/S99oracle #rc4.d unused
To stop the database at restart, we need the following link:

    [root@localhost ~]# ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc0.d/K01oracle # stop    [root@localhost ~]# ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc6.d/K01oracle # restart

Note: S99 stands for 99th service Start

K01 indicates one Kill in the service location.

I am not sure why I am interested in setting up a soft connection to files such as rc2.d.

Bytes ---------------------------------------------------------------------------------------

You can also use the following method to replace the connection

[root@rhsde ~]# chkconfig --add oracle[root@rhsde ~]# chkconfig --level 345 oracle on[root@rhsde ~]# chkconfig --list oracleoracle          0:off   1:off   2:off   3:on    4:on    5:on    6:off

4: Modify the DBSTART and DBSHUT files in ORACLE_HOME.

[oracle@localhost ~]$ vi $ORACLE_HOME/bin/dbstart
You only need to change ORACLE_HOME_LISTNER to the correct ORACLE_HOME (consistent with the environment variable)

ORACLE_HOME_LISTNER=/opt/oracle/product/11.2.0/dbhome_1
DBSHUT is the same as DBSTART.
The modification process is basically complete. You can directly reboot the experiment.

Note: during the test:

1: first, run the following edited Oracle file to check whether the service can be started properly.

2: we can see that S99Oracle, that is, the Oracle service is started at 99th, so we need to wait patiently. After I finish the configuration at the beginning, I will check the Oracle service and it will never start, I always think there is a problem.

3: The Oracle configuration file. Note the characters.


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.