Linux Oracle Services Start & Stop scripts and boot from boot

Source: Internet
Author: User
Tags stop script sqlplus

After installing the Oracle 10g R2 in CentOS 6.3, after rebooting, you will find that Oracle does not boot itself, which is normal, because the installation of Oracle under Linux does not start on its own, you must set the relevant parameters, First introduce how to start Oracle in general.

First, start Oracle under Linux

Log in to CentOS and switch to Oracle user rights

# su–oracle

Then enter:

$ sqlplus "/as sysdba"

The original picture will change to
Sql>

then please enter
Sql> Startup

You can start the database normally.

Also the instructions to stop the database are as follows:
sql> shutdown Immediate

Second, check whether the Oracle DB Listener is normal

Back to Terminal mode, enter:

$ LSNRCTL Status

Check to see if the listener has a boot.

If it does not start, you can enter:

$ lsnrctl Start

Start listener

sql> Conn [email protected] as SYSDBA

Then enter the password, sys to log into the database as SYSDBA.

Third, start Emctl

In addition, it can be found that http://localhost.localdomain:1158/em is not responding at present, this side to start another, start the following instructions:

$ emctl Start Dbconsole

This command runs for a long time and finishes with the following screen:

After manually starting the Oracle database, create the system to start the Oracle script itself.

Iv. Oracle Startup & Stop Scripts

1. Modify the Oracle System configuration file:/etc/oratab, only then can Oracle's own Dbstart and Dbshut work.

# Vi/etc/oratab
Orcl:/opt/oracle/102:y

# Entries is of the form:
# $ORACLE _sid: $ORACLE _home:<n| Y>:

2. Under/etc/init.d/, create the file Oracle with the following content:

#!/bin/SH# Chkconfig: *  the Ten# description:oracle Auto Start-Stop script.## Set ora_home to being equivalent to the $ORACLE _home# fromwhichYou wish to execute Dbstart and dbshut;## Set Ora_owner to the userIDOf the owner of the# Oracle databaseinchOra_home. Ora_home=/opt/oracle/102Ora_owner=Oracleif[!-F $ORA _home/bin/Dbstart] Then    Echo "Oracle startup:cannot Start"Exitfi Case " $" inch'Start') # Start the Oracle databases:Echo "starting Oracle Databases ..."Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:starting Oracle Databases as part of the system up.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oraclesu-$ORA _owner-c"$ORA _home/bin/dbstart">>/var/log/OracleEcho " Done"# Start The Listener:Echo "starting Oracle Listeners ..."Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:starting Oracle Listeners as part of the system up.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oraclesu-$ORA _owner-c"$ORA _home/bin/lsnrctl Start">>/var/log/OracleEcho "Done ."Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:finished.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/OracleTouch/var/lock/subsys/Oracle;;'Stop') # Stop the Oracle Listener:Echo "stoping Oracle Listeners ..."Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:stoping Oracle Listener as part of the system down.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oraclesu-$ORA _owner-c"$ORA _home/bin/lsnrctl Stop">>/var/log/OracleEcho "Done ."RM-f/var/lock/subsys/oracle# Stop The Oracle Database:Echo "stoping Oracle Databases ..."Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:stoping Oracle Databases as part of the system down.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oraclesu-$ORA _owner-c"$ORA _home/bin/dbshut">>/var/log/OracleEcho "Done ."Echo ""Echo "-------------------------------------------------">>/var/log/OracleDate+"%T%a%d:finished.">>/var/log/OracleEcho "-------------------------------------------------">>/var/log/Oracle;;'Restart')$0stop$0start;;Esac

3. Change file permissions
# chmod 755/etc/init.d/oracle

4. Add a service
# chkconfig--level Oracle on

5. Need to stop the database before shutting down or restarting the machine and doing the operation
# ln-s/etc/init.d/oracle/etc/rc0.d/k01oracle//shutdown
# ln-s/etc/init.d/oracle/etc/rc6.d/k01oracle//restart

6. How to use
# service Oracle Start//Launch Oracle
# Service Oracle Stop//Turn off Oracle
# Service Oracle Restart//Restart Oracle

7. Testing

A. Boot from boot

Last Login:mon 19:57:06-10.0.0.145[[email protected] ~]# su-oracle[[email protected] ~]$ sql Plus "/as sysdba" Sql*plus:release 10.2.0.1.0-production on Mon Nov 20:07:33 2012Copyright (c) 1982, 2005, ORACLE.&NB Sp All rights reserved. Connected to:oracle Database 10g Enterprise Edition Release 10.2.0.1.0-productionwith The partitioning, OLAP and Data Mi Ning Optionssql> set linesize 300; Sql> set pagesize 30; Sql> SELECT * from scott.emp;     EMPNO ename      JOB               MGR hiredate          sal       comm     DEPTNO------------------- -----------------------------------------------------------      7369 smith       clerk           7902 17-dec-80        800                     20      7499 allen       salesman        7698 20-feb-81        1600        300         30      7521 ward       SALESMAN         7698 22-feb-81       1250         500         30      7566 JONES       manager         7839 02-apr-81        2975                    20      7654 martin     SALESMAN         7698 28-sep-81       1250        1400         30      7698 BLAKE       manager         7839 01-may-81        2850                     30      7782 clark      manager         7839 09-jun-81       2450                      10      7788 scott      analyst          7566 19-apr-87       3000                     20      7839 king       president             17-nov-81       5000                     10      7844 turner      salesman        7698 08-sep-81        1500          0          30      7876 adams      clerk            7788 23-may-87       1100                     20       7900 james      clerk            7698 03-dec-81        950                     30      7902 ford       analyst         7566 03- dec-81       3000                     20      7934 miller      clerk           7782 23-jan-82        1300                     1014 rows selected.  Sql>

B. Service Oracle Stop

Sql> disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-productionwith the partitioning, OLA P and Data Mining options[[email protected] ~]$ logout[[email protected] ~]# service Oracle stopstoping Oracle Listeners. .. Done.stoping Oracle Databases ... Done. [[email protected] ~]# su-oracle[[email protected] ~]$ sqlplus "/as sysdba" Sql*plus:release 10.2.0.1.0-production on Mon Nov 20:17:20 2012Copyright (c) 1982, 2005, Oracle.  

C. Service Oracle Start

D. Service Oracle Restart

At this point, the Oracle Service start & Stop script is set up with the boot boot setting.

Linux Oracle Services Start & Stop scripts and boot from boot

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.