Linux Oracle Services Start & Stop scripts and boot from boot

Source: Internet
Author: User
Tags stop script

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] ~]$ sqlplus "/as sysdba"

Sql*plus:release 10.2.0.1.0-production on Mon Nov 26 20:07:33 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-production
With the partitioning, OLAP and Data Mining options

Sql> 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 10

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.

Installing Oracle 10g R2 under CentOS 6.3 (x32)

Http://www.cnblogs.com/mchina/archive/2012/11/06/2737472.html

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.