Oracle service self-launch

Source: Internet
Author: User

1. Modify the/etc/oratab File
Db1:/home/Oracle/product/11.2.0/db_1: Y
$ ORACLE_SID: $ ORACLE_HOME: Y
2. Modify the Startup File $ ORACLE_HOME/bin/dbstart.
Change ORACLE_HOME_LISTNER = $1 to ORACLE_HOME_LISTNER =/home/oracle/product/11.2.0/db_1.
3. Modify and close the file $ ORACLE_HOME/bin/dbshut.
Change ORACLE_HOME_LISTNER = $1 to ORACLE_HOME_LISTNER =/home/oracle/product/11.2.0/db_1.
4. Create a script under/etc/init. d.
Vi/etc/init. d/oracle11
#! /Bin/bash
# Chkconfig: 345 88 14
# Description: Startup Script. for oracle Databases
#/Etc/rc. d/init. d/oradbstart
Export ORACLE_BASE =/home/oracle
Export ORACLE_HOME =/home/oracle/product/11.2.0/db_1
Export ORACLE_SID = dbl
Export PATH = $ PATH: $ ORACLE_HOME/bin
Case "$1" in
Start)
Echo "----- startup oracle -----">/var/log/oracle11log
Su oracle-c $ ORACLE_HOME/bin/dbstart
Touch/var/lock/subsys/oracle11
Echo "----- startup oracle successful -----">/var/log/oracle11log
Echo "OK"
;;
 
Stop)
Echo "----- shutdwn oracle -----">/var/log/oracle11log
Su oracle-c $ ORACLE_HOME/bin/dbshut
Rm-f/var/lock/subsys/oracle11
Echo "----- shutdown oracle successful -----">/var/log/oracle11log
Echo "OK"
;;
 
*)
Echo "Usage: 'basename $ 0' start | stop"
Exit 1
Esac
Exit 0
Save and exit.
5. Grant Permissions
Chown oracle: oinstall oracle11
Chmod 774 oracle11
6. Add a service
Chkconfig -- add oracle11
Chkconfig oracle11 on
Chkconfig -- list | grep oracle11
7. Try to disable and start the service
[Root @ rman ~] # Service oracle11 stop
Processing Database instance "db1": log file/home/oracle/product/11.2.0/db_1/shutdown. log
OK
[Root @ rman ~] # Ps-elf | grep ora _
0 S root 4814 4543 0 78 0-15307 pipe_w 00:00:00 pts/1 grep ora _
[Root @ rman ~] # Service oracle11 start
Processing Database instance "db1": log file/home/oracle/product/11.2.0/db_1/startup. log
OK
[Root @ rman ~] # Ps-elf | grep ora _
0 S oracle 4959 1 0 75 0-193270 665975? 00:00:00 ora_pmon_db1
0 S oracle 4963 1 0 58--193106? 00:00:00 ora_vktm_db1
0 S oracle 4969 1 0 78 0-193106? 00:00:00 ora_gen0_db1
0 S oracle 4973 1 0 78 0-193106? 00:00:00 ora_diag_db1
0 S oracle 4977 1 0 75 0-193106? 00:00:00 ora_dbrm_db1
0 S oracle 4981 1 0 78 0-193106? 00:00:00 ora_psp0_db1
0 S oracle 4985 1 0 78 0-193234? 00:00:00 ora_dia0_db1
0 S oracle 4989 1 0 78 0-193106? 00:00:00 ora_mman_db1
0 S oracle 4993 1 0 75 0-194081? 00:00:00 ora_dbw0_db1
0 S oracle 4997 1 0 75 0-196994? 00:00:00 ora_lgwr_db1
0 S oracle 5001 1 0 76 0-193106? 00:00:00 ora_ckpt_db1
0 S oracle 5005 1 0 75 0-193106? 00:00:00 ora_smon_db1
0 S oracle 5009 1 0 78 0-193106? 00:00:00 ora_reco_db1
0 S oracle 5013 1 2 75 0-193796? 00:00:00 ora_mmon_db1
0 S oracle 5017 1 0 75 0-193106? 00:00:00 ora_mmnl_db1
0 S oracle 5021 1 0 78 0-193276 912653? 00:00:00 ora_d000_db1
0 S oracle 5025 1 0 78 0-193114 903991? 00:00:00 ora_s000_db1
0 S oracle 5043 1 0 78 0-193106? 00:00:00 ora_qmnc_db1
0 S root 5161 4543 0 78 0-15308 pipe_w 00:00:00 pts/1 grep ora _
8. Restart the test.

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.